从JBoss 7.1引用依赖项jar文件时出错 [英] Error in Referencing a Dependency Jar File from JBoss 7.1
问题描述
I reference a jar file from JBoss 7.1 module according to the instructions provided in a stackoverflow question here. I have used this jar in JBoss 5.x, 6.x without any issue. However, when I try to deploy a war file in JBoss 7.1 which references the above jar, it gives me the following error:
15:59:19,220 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]. [/Max_client]] (MSC service thread 1-2) StandardWrapper.Throwable: java.lang
NoClassDefFoundError: org/xml/sax/SAXException
at com.systinet.wasp.webservice.ServiceClientImpl.lookup(ServiceClientImpl.java:556) [wasp.jar:]
at com.systinet.wasp.webservice.ServiceClientImpl.createProxy(ServiceClientImpl.java:437) [wasp.jar:]
at org.systinet.wasp.webservice.Registry.lookup(Registry.java:168) [wasp.jar:]
at MyServlet.init(MyServlet.java:103) at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Fi
al]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
Caused by: java.lang.ClassNotFoundException: org.xml.sax.SAXException from [Module "commons.wasp:main" from local module loader @2adb1d4 (roots: c:\jboss-as-7.1.1
Final\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
我对JBoss 7中的这个新模块概念非常陌生.您知道这里的问题是什么吗?
I'm very new to this new module concept in JBoss 7. Any idea what is the issue here?
谢谢!
有关我尝试执行的操作的详细信息:
Details on what I tried to do:
我希望能够使此依赖项jar全局可用.因此,我所做的就是创建了一个文件夹结构modules/common_libs/test/main并将所需的jar放入其中.然后创建模块描述符module.xml:
I want to be able to make this dependency jar available globally. So what I did was created a folder structure modules/common_libs/test/main and placed the required jar in it. Then created the module descriptor module.xml:
<module xmlns="urn:jboss:module:1.1" name="common_libs.test">
<resources>
<resource-root path="test.jar"/>
</resources>
</module>
然后在需要从中访问此jar的应用程序中,我在MANIFEST.MF中添加了
Then in the application from which I need to access this jar, I added in the MANIFEST.MF:
Dependencies: common_libs.test
该应用程序是一个war文件,我将其部署在部署文件夹下,并创建了一个.war.dodeploy文件.启动JBoss服务器时出现此异常.
The application is a war file and I deployed it under the deployment folder, and created a .war.dodeploy file. I get this exception when I start the JBoss server.
有什么主意吗?
谢谢!
推荐答案
您需要查看模块所需的依赖项.对于当前错误消息,看起来它需要依赖SAX.您可能应该在module.xml中添加javax.api
的依赖项(这是SAX所在的模块).
You need to look at the dependencies your module requires. With the current error message it looks like it needs a dependency on SAX. You should probably add a dependency for javax.api
(this is the module SAX is in) to your module.xml.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="common_libs.test">
<resources>
<resource-root path="test.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
您需要为共享库所需的所有依赖项添加依赖项.
You'll need to add dependencies for any dependencies your shared library needs.
这篇关于从JBoss 7.1引用依赖项jar文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!