Java Web应用程序错误 - 无法找到位于WEB-INF / classes目录中的类

时间:2014-03-14 22:36:05

标签: java deployment websphere war classnotfound

我首先启动我的WebSphere Application Server 8.5.5.0,没有部署应用程序,它启动正常,文本在下面。

Launching defaultServer (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130510-0831) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51-b13 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[INFO    ] CWWKE0002I: The kernel started after 1.714 seconds
[INFO    ] CWWKF0007I: Feature update started.
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[INFO    ] CWWKF0008I: Feature update completed in 2.472 seconds.
[AUDIT   ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.
[INFO    ] CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host 127.0.0.1  (IPv4: 127.0.0.1) port 9080.

在WebSphere启动时,我使用Eclipse将我的war文件导出到Eclipse,它将部署到plugins目录中。这部分也很成功,我在服务器日志中获得了额外的输出:

[INFO    ] CWWKZ0018I: Starting application iaat.
[WARNING ] CWWJP9991W: openjpa.Runtime: Warn: An error occurred while registering a ClassTransformer with JPAPUnitInfo(PuId=iaat#iaat.war#DB2-Config)@3476b7f1. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will not be available.
[INFO    ] CWWJP9990I: openjpa.Runtime: Info: OpenJPA dynamically loaded a validation provider.
[INFO    ] SRVE0169I: Loading Web Module: iaat.
[INFO    ] SRVE0250I: Web Module iaat has been bound to default_host.
[AUDIT   ] CWWKT0016I: Web application available (default_host): 
[AUDIT   ] CWWKZ0001I: Application iaat started in 6.774 seconds. 

我的问题是当我尝试使用WebSphere提供的URL启动我的应用程序时。当页面出现在Internet Explorer中时,我在WebSphere日志中收到以下消息。我确实查看了生成的War文件,它抱怨的类文件位于WEB-INF / classes / com / bah / iaat / model / data / Proposal

[INFO    ] FFDC1015I: An FFDC Incident has been created: "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/iaatadmin-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/bah/iaat/model/data/Proposal (wrong name: com/bah/iaat/model/data/Proposal) com.ibm.ws.webcontainer.servlet.ServletWrapper.init 181" at ffdc_14.03.14_18.20.49.0.log
[ERROR   ] Uncaught.init.exception.thrown.by.servlet 
                                                                                                               iaatadmin
                                                                                                               iaat
                                                                                                               org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/iaatadmin-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/bah/iaat/model/data/Proposal (wrong name: com/bah/iaat/model/data/Proposal)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:161)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:322)
    at [internal classes]
Caused by: java.lang.NoClassDefFoundError: WEB-INF/classes/com/bah/iaat/model/data/Proposal (wrong name: com/bah/iaat/model/data/Proposal)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:278)
    at [internal classes]
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
    at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:136)
    at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:485)
    at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:852)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:597)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 18 more

1 个答案:

答案 0 :(得分:2)

至于你的错误(第3段) - 我觉得你在类路径中错过了一个jar / class。

至于你警告(第二个片段)我有类似的问题,根据openJPA网站,可以安全地忽略它。

http://openjpa.apache.org/integration.html

  

与Spring集成:

     

使用时无需配置Spring loadTimeWeaver   OpenJPA构建时间增强。将出现以下警告消息   在创建EntityManagerFactory 时由OpenJPA记录,但它可以   安全地忽略了。

     

WARN [main]注册ClassTransformer时   PersistenceUnitInfo:name' PuName&#39 ;,根URL [file:/.../]。错误   已被消耗。要查看它,请将openjpa.Runtime日志级别设置为   跟踪。加载时类转换将不可用。

     

有关详细信息,请参阅Spring文档。