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

2019-10-19 14:02发布

我第一次开始我的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导出我的战争文件到Eclipse,它部署到插件目录。 这部分也是成功的,我得到的服务器日志的额外的输出:

[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提供的网址应用。 当页面在Internet Explorer来了,我得到在WebSphere日志中看到以下消息。 我没有看生成的WAR文件,它抱怨位于WEB-INF /班/ COM / BAH / IAAT /模型/数据/提议类文件

[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

Answer 1:

至于你的错误(第3段) - 在我看来,你在你的classpath缺少JAR /类。

至于你警告(第2段),我有一个类似的问题,并根据现场的OpenJPA它可以安全地忽略。

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

与Spring集成:

这是没有必要配置一个春天的LoadTimeWeaver在使用OpenJPA的建立时间增强。 以下警告信息会被OpenJPA的创建EntityManagerFactory的时候被记录,但它可以安全地忽略。

警告[主要]而注册与PersistenceUnitInfo一个ClassTransformer的:名称 'PuName',根URL [文件:/.../]。 该错误已被消耗。 要查看它,请将您的openjpa.Runtime日志级别追查。 负载时类转型将不可用。

请参阅更多信息Spring文档。



文章来源: Java Web Application Error - Can't find classes that are located in WEB-INF/classes directory