为了对多个应用程序可见外部 jar,我通常将外部 jar 放在 JBOSS 5.x 中的 $JBOSS_HOME/server/default/lib 目录中。这些 jar 在 AS 的启动时自动启动。我将如何在 wildfly-9.0.2.Final 中执行此操作。
@SamThankx 的回复但我仍然收到错误,请按照以下结构查看我的场景
- test.ear 中存在名为 test.jar 的 jar 存档
在 test.jar 中有 EJB3 会话 bean java 类。在这个类中有 import stmt as。
导入 com.oracle.asmc.ejb3.statelesssession.SLE3DecryptLocal;
- 上面的包 'com.oracle.asmc.ejb3.statelesssession.SLE3DecryptLocal' 存在于 testclient.jar
注意 - 上面的 testclient.jar 不是 test.ear 的一部分。(我想从多个 EAR 访问这个 testclient.jar)
要部署 test.ear,我已完成以下步骤
- ./jboss-cli.sh -c(存在于 bin 目录中)
- 模块添加 --name=testclient --resources=~/client_jar/testclient.jar
我在 jboss-deployment-structure.xml 中添加了以下配置,并在创建 test.ear 时放置在 META-INF 目录中。
<?xml version="1.0"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> <deployment> <dependencies> <module name="testclient" /> </dependencies> </deployment> </jboss-deployment-structure>
为了部署 Test.ear 应用程序,访问“ http://127.0.0.1:9990/ ”并遍历链接 Deployments --> Add -->Add Deployment --->FINISH 但仍然出现以下错误。
12:19:22,439 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "test.ear" (runtime-name: "test.ear") 12:19:22,602 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0207: Starting subdeployment (runtime-name: "test.jar") 12:19:22,608 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0207: Starting subdeployment (runtime-name: "test.war") 12:19:23,524 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0003: Processing weld deployment test.ear 12:19:23,631 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-2) HV000001: Hibernate Validator 5.1.3.Final 12:19:23,842 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.subunit."test.ear"."test.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test.ear"."test.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "test.jar" of deployment "test.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class com.oracle.test.SlsTestBean with ClassLoader ModuleClassLoader for Module "deployment.test.ear.test.jar:main" from Service Module Loader at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156) ... 5 more Caused by: java.lang.NoClassDefFoundError: com/oracle/asmc/ejb3/statelesssession/SLE3DecryptLocal at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) ... 10 more Caused by: java.lang.ClassNotFoundException: com/oracle/asmc/ejb3/statelesssession/SLE3DecryptLocal from [Module "deployment.test.ear.test.jar:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130) ... 15 more
@Sam 谢谢回复
我在 test.jar 的 META-INF 中添加了“jboss-deployment-structure.xml”。
注意 - 是的,我正在从 test.jar 访问“com/oracle/asmc/ejb3/statelesssession/SLE3DecryptLocal”(存在于 testclient.jar 模块中)。
现在我的 test.ear 包含
META-INF/application.xml
测试战争
test.jar('jboss-deployment-structure.xml' 出现在这个 test.jar 的 META-INF 目录中)
但我仍然收到以下错误。
Caused by: java.lang.NoClassDefFoundError: com.oracle.asmc.ejb3.statelesssession.SLE3DecryptLocal
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)
... 10 more
Caused by: java.lang.ClassNotFoundException: com.oracle.asmc.ejb3.statelesssession.SLE3DecryptLocal from [Module "deployment.test.ear.test.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 15 more