1

我正在尝试在eclipse中将maven生成的war文件部署到tomcat服务器中。但是我在jar文件上得到了java.lang.NoClassDefFoundError。我多次验证,jar在.war中,对应的类文件也在jar中。我可以从eclipse中生成的位置复制战争并成功部署到tomcat的webapps中(使用与eclipse中安装的服务器相同的服务器)。

除了部署程序集(已列出 jar)和 Java 构建路径( jar 在 Maven 依赖项中可用)之外,我不确定还有什么要检查的配置。我正在使用 JRE --> 指向 JDK 1.6 的备用 JRE

完整的错误日志:

2012-05-24 16:43:09,379 [main] ERROR org.springframework.web.context.ContextLoader -       Context initialization failed
java.lang.NoClassDefFoundError: Lcom/att/cso/uss/client/ws/CciClientImpl;

at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:373)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:830)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: java.lang.ClassNotFoundException: com.att.cso.uss.client.ws.CciClientImpl
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
    ... 33 more

请指教。

4

1 回答 1

0

使用服务器实例与在 tomcat 中部署 WAR 不同。服务器视图集成 tomcat 'hot' 部署源文件夹。我建议您检查 Java Build 路径设置,因为在服务器视图中将源项目“部署”到服务器时会使用这些设置。你是如何制造战争的?我假设您使用的是 maven。如果您使用的是 maven(我个人不喜欢它),它应该为您管理依赖项。您可能必须在 java 中复制 maven 的设置,或者可能使用 maven 插件进行 Eclipse。[http://www.eclipse.org/m2e/]

于 2012-05-25T14:52:02.280 回答