0
我有一個外部依賴(ejb客戶端)安裝在本地maven回購。 Eclipse和手動maven構建看到它很好,併成功編譯。它也在Maven依賴關係下正確列出。ClassNotFoundException在部署
當我部署到WildFly 8.1時,運行時無法識別類並拋出異常。我從來沒有像這樣的依賴問題。這個項目唯一的區別是它是一個SwitchYard 2.0項目(WildFly 8.1覆蓋)。我懷疑由於覆蓋或者我缺少一些Maven構建插件,或者WildFly配置是錯誤的。
我終於解決了它使用maven燈罩的插件,編譯裏面的依賴,但:
1.我從來沒有需要它之前,所以我不喜歡這個解決方案
2.從Eclipse的部署,所以當它不會自動運行我必須做一個手動的maven構建和手動部署。如何告訴maven在部署時運行陰影插件?我試圖改變階段從包到部署無濟於事。
造成麻煩的外部依賴是jmsprojekt-main。示出了從依賴類
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>si.fri.liis.jmsprojektsy</groupId>
<artifactId>vloga-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>si.fri.liis.jmsprojektsy:vloga-service</name>
<properties>
<switchyard.version>2.0.0.Final</switchyard.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-bom</artifactId>
<version>${switchyard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-bean</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-soap</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-api</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-transform</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-validate</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-test-mixin-cdi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>si.fri.liis.jmsprojekt</groupId>
<artifactId>jmsprojekt-main</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb-client</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${switchyard.version}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
<configuration>
<scannerClassNames>
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
</scannerClassNames>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>si.fri.liis.jmsprojekt:jmsprojekt-main</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
WildFly啓動日誌未找到:
20:06:26,777 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."vloga-service.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."vloga-service.jar".SwitchYardService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_51]
Caused by: java.lang.NoClassDefFoundError: si/fri/liis/jmsprojekt/data/VlogaData
at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.8.0_51]
at java.lang.Class.privateGetDeclaredMethods(Unknown Source) [rt.jar:1.8.0_51]
at java.lang.Class.privateGetPublicMethods(Unknown Source) [rt.jar:1.8.0_51]
at java.lang.Class.getMethods(Unknown Source) [rt.jar:1.8.0_51]
at org.switchyard.transform.internal.TransformerUtil.isTransformer(TransformerUtil.java:223)
at org.switchyard.transform.internal.TransformerUtil.newTransformers(TransformerUtil.java:71)
at org.switchyard.transform.internal.TransformerRegistryLoader.newTransformers(TransformerRegistryLoader.java:231)
at org.switchyard.transform.internal.TransformerRegistryLoader.registerTransformers(TransformerRegistryLoader.java:117)
at org.switchyard.transform.internal.TransformerRegistryLoader.registerTransformers(TransformerRegistryLoader.java:101)
at org.switchyard.deploy.internal.Deployment.registerTransformers(Deployment.java:271)
at org.switchyard.deploy.internal.Deployment.doInit(Deployment.java:117)
at org.switchyard.deploy.internal.AbstractDeployment.init(AbstractDeployment.java:139)
at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:155)
at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:77)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
Caused by: java.lang.ClassNotFoundException: si.fri.liis.jmsprojekt.data.VlogaData from [Module "deployment.vloga-service.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
... 19 more
20:06:26,817 ERROR [stderr] (MSC service thread 1-9) Warning: org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
20:06:26,899 ERROR [stderr] (MSC service thread 1-9) Compiler warnings:
20:06:26,900 ERROR [stderr] (MSC service thread 1-9) WARNING: 'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.'
20:06:27,265 INFO [org.switchyard.common.camel.SwitchYardCamelContextImpl] (MSC service thread 1-9) Route: direct:{urn:si.fri.liis.jmsprojektsy:vloga-service:1.0}VlogaServicePortType started and consuming from: Endpoint[direct://%7Burn:si.fri.liis.jmsprojektsy:vloga-service:1.0%7DVlogaServicePortType]
20:06:27,361 INFO [org.switchyard] (MSC service thread 1-9) Addressing [enabled = false, required = false]
20:06:27,361 INFO [org.switchyard] (MSC service thread 1-9) MTOM [enabled = false, threshold = 0]
20:06:27,443 INFO [org.jboss.ws.cxf.metadata] (MSC service thread 1-9) JBWS024061: Adding service endpoint metadata: id=VlogaService
address=http://localhost:8080/vloga-service/VlogaService
implementor=org.switchyard.component.soap.endpoint.BaseWebService
serviceName={urn:si.fri.liis.jmsprojektsy:vloga-service:1.0}VlogaService
portName={urn:si.fri.liis.jmsprojektsy:vloga-service:1.0}VlogaServicePort
annotationWsdlLocation=null
wsdlLocationOverride=vfs:/C:/Users/cen/Desktop/wildfly-8.1.0.Final-sy/bin/content/vloga-service-0.0.1-SNAPSHOT.jar/VlogaService.wsdl
mtomEnabled=false
20:06:27,982 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-9) Creating Service {urn:si.fri.liis.jmsprojektsy:vloga-service:1.0}VlogaService from WSDL: vfs:/C:/Users/cen/Desktop/wildfly-8.1.0.Final-sy/bin/content/vloga-service-0.0.1-SNAPSHOT.jar/VlogaService.wsdl
20:06:28,172 INFO [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-9) Setting the server's publish address to be http://localhost:8080/vloga-service/VlogaService
20:06:28,261 INFO [org.jboss.ws.cxf.deployment] (MSC service thread 1-9) JBWS024074: WSDL published to: file:/C:/Users/cen/Desktop/wildfly-8.1.0.Final-sy/standalone/data/wsdl/vloga-service.deployment/VlogaService.wsdl
20:06:28,266 INFO [org.jboss.as.webservices] (MSC service thread 1-5) JBAS015539: Starting service jboss.ws.endpoint."vloga-service.deployment".VlogaService
20:06:28,331 INFO [org.wildfly.extension.undertow] (MSC service thread 1-9) JBAS017534: Registered web context: /vloga-service
20:06:28,411 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "vloga-service.jar")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"vloga-service.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"vloga-service.jar\".SwitchYardService: Failed to start service
Caused by: java.lang.NoClassDefFoundError: si/fri/liis/jmsprojekt/data/VlogaData
Caused by: java.lang.ClassNotFoundException: si.fri.liis.jmsprojekt.data.VlogaData from [Module \"deployment.vloga-service.jar:main\" from Service Module Loader]"}}
20:06:28,496 INFO [org.jboss.as.server] (ServerService Thread Pool -- 33) JBAS018559: Deployed "vloga-service.jar" (runtime-name : "vloga-service.jar")
20:06:28,497 INFO [org.jboss.as.server] (ServerService Thread Pool -- 33) JBAS018559: Deployed "vloga-service-0.0.1-SNAPSHOT.jar" (runtime-name : "vloga-service-0.0.1-SNAPSHOT.jar")
20:06:28,499 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."vloga-service.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."vloga-service.jar".SwitchYardService: Failed to start service
20:06:28,751 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016009: Stopping weld service for deployment vloga-service.jar
20:06:28,803 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment vloga-service.jar (runtime-name: vloga-service.jar) in 67ms
20:06:28,805 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
20:06:28,805 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
20:06:28,806 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 17000ms - Started 287 of 340 services (98 services are lazy, passive or on-demand)
20:06:29,053 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "vloga-service.jar" (runtime-name: "vloga-service.jar")
20:06:29,054 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."vloga-service.jar".SwitchYardService