gpt4 book ai didi

java - jar 中存在的类出现 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-01 12:12:44 24 4
gpt4 key购买 nike

我进行了很多搜索,但找不到解决我的问题的方法。我使用 wsimport 从 wsdl 生成 stub ,并将其添加到我的项目中。以下是当我尝试从 stub 初始化类 MyServiceEp 时出现的错误。我认为这可能是 j-boss 7 问题。但我是服务器新手,不知道解决方法。我尝试添加

            <property name="org.jboss.osgi.system.modules.extra">
javax.xml.ws
</property>

到我的standalone.xml,因为我在另一个论坛上读到这是解决方法,但无法解决问题..

10:49:23,351 ERROR [org.springframework.web.portlet.DispatcherPortlet] (MSC service thread 1-2) Context initialization failed: org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'MyServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.NoClassDefFoundError: org/abc/bcd/MyServiceEp
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java
:288) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120) [spring-beans
-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) [spring-beans-
3.2.0.RELEASE.jar:3.2.0.RELEASE]
at
].................................
..............................
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.NoClassDefFoundError: org/abc/bcd/MyServiceEp
at org.xx.portal.ws.client.MyServiceImpl.setMyClient(MyServiceImpl.java:37) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_25]
at


... 53 more

我正在使用Liferay 6.2 - jboss 7.1.1 Final捆绑版本并使用spring MVC。 stub 中自动生成的类会发生 NoClassDefFound 错误。如果需要,我会发布更多详细信息。

更新

我使用 verbose:class 运行服务器,也收到以下错误..

12:31:00,501 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class gov.or.hix.wsdl.ee.individualcaseservice.IndividualCaseServiceEp in Modul
e "deployment.My-Portlet-1.0.0.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/abc/bcd/MyServiceEp (Module "deployment.My-Portlet-1.0.0.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at
..................................
................................
com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54) [portal-service.jar:]
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116) [portal-service.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [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.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.NoClassDefFoundError: javax/xml/ws/Service
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_25]
at java.lang.ClassLoader.defineClass(ClassLoader.java:792) [rt.jar:1.7.0_25]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_25]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
... 70 more
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.Service from [Module "deployment.My-Portlet-1.0.0.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
... 75 more

最佳答案

您可能正在使用Eclipse IDE。基于此假设,请尝试执行以下步骤:

  1. 您已经在目录 webservices 中获得了有关 Web 服务的 stub 。现在将这些文件的源链接到您的项目中。

右键单击您的项目> 属性> Java 构建路径> 查找源选项卡> 单击链接源> 从目录结构中找到webservices的路径

  • 点击确定,然后再次点击确定

  • 现在尝试导入有关您的螺柱的类。

  • 这肯定对你有用,就像在我的例子中一样。

    关于java - jar 中存在的类出现 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27187472/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com