Java应用程序日志错误

Java应用程序日志错误,java,websphere,Java,Websphere,一旦我将EAR文件部署到服务器上,就会出现以下错误。 由于我是JAVA新手,我无法找出什么可以解决这个问题。 非常感谢您的帮助 我也尝试过更改编译器版本,但这似乎也没有帮助。 此外,错误如下所示 [2017-10-04 14:23:24,716] org.springframework.web.context.ContextLoader#initWebApplicationContext ERROR: Context initialization failed org

一旦我将EAR文件部署到服务器上,就会出现以下错误。 由于我是JAVA新手,我无法找出什么可以解决这个问题。 非常感谢您的帮助

我也尝试过更改编译器版本,但这似乎也没有帮助。 此外,错误如下所示

[2017-10-04 14:23:24,716] org.springframework.web.context.ContextLoader#initWebApplicationContext


ERROR: Context initialization failed    

       org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.sl.was.cashpayment.jms.JMSApplicationListener] for bean with name 'applicationListener' defined in ServletContext resource [/WEB-INF/classes/config/spring/applicationContext-jms.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=com/sl/was/cashpayment/jms/JMSApplicationListener, offset=6
                at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1238)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
                at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1304)
                at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:870)
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
                at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
                at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
                at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
                at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1732)
                at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:415)
                at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
                at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
                at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
                at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
                at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
                at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
                at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1201)
                at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1390)
                at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
                at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:979)
                at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:785)
                at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1403)
                at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2214)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435)
                at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:126)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:653)
                at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5487)
                at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5613)
                at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:667)
                at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:611)
                at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1293)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
                at java.lang.reflect.Method.invoke(Method.java:611)
                at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69)
                at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
                at java.lang.reflect.Method.invoke(Method.java:611)
                at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272)
                at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152)
                at java.security.AccessController.doPrivileged(AccessController.java:424)
                at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
                at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
                at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146)
                at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999)
                at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847)
                at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783)
                at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
                at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
                at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
                at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
                at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
                at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
                at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
                at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1820)
                at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:558)
                at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
                at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:985)
                at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1074)
                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)

您的类是根据比服务器运行时更高的Java版本编译的。WebSphere7.0和8.0(以及8.5,开箱即用)在Java6上运行,因此我猜测您的类是用Java7或更高版本编译的。Java是向后兼容的,但不是向前兼容的——您不能在旧的spec JVM上运行新的spec类


最简单的解决方案是用Java6重新编译类。或者,如果您运行的是WebSphere 8.5.5,您可以使用WebSphere的bin目录中的“managesdk”脚本(假设您在服务器上安装了Java 8包)将服务器切换到Java 8上运行。

您的类是根据比服务器运行时更高的Java版本编译的。WebSphere7.0和8.0(以及8.5,开箱即用)在Java6上运行,因此我猜测您的类是用Java7或更高版本编译的。Java是向后兼容的,但不是向前兼容的——您不能在旧的spec JVM上运行新的spec类


最简单的解决方案是用Java6重新编译类。或者,如果您正在运行WebSphere 8.5.5,您可以使用WebSphere的bin目录中的“managesdk”脚本将服务器切换为在Java 8上运行(假设您在服务器上安装了Java 8包)。

我认为问题在于服务器运行的Java版本早于您编译的版本。
例如,使用java7编译,而服务器运行在java6上,我认为问题在于服务器运行在您使用的编译版本之前的Java版本上。
例如,使用java7编译,服务器在java6上运行,这不是编译器版本的问题,而是运行时版本的问题。@Kayaman:谢谢你的回复。如何更改运行时版本以及需要查看的文件。问题不在于编译器版本,而在于运行时版本。@Kayaman:谢谢您的回复。如何更改运行时版本以及需要查看的文件。非常感谢您的详细解释。如果您能告诉我如何使用Java 6重新编译类的步骤,那就太好了。如果您对构建环境没有太多了解,这是不可行的。基本上,它是您获取“javac”命令的任何Java版本-有时来自Java_HOME环境变量,有时在IDE的配置中声明,有时在属性文件中声明。嗨,Jarid,非常感谢您的回复。看起来我正在使用的应用程序最初是用1.6编译的,RAD 9.6与1.6不再兼容。有没有其他方法可以在rad之外构建ear文件。我正在对旧版本的代码执行struts更新。非常感谢您的帮助。非常感谢您的详细解释。如果您能告诉我如何使用Java 6重新编译类的步骤,那就太好了。如果您对构建环境没有太多了解,这是不可行的。基本上,它是您获取“javac”命令的任何Java版本-有时来自Java_HOME环境变量,有时在IDE的配置中声明,有时在属性文件中声明。嗨,Jarid,非常感谢您的回复。看起来我正在使用的应用程序最初是用1.6编译的,RAD 9.6与1.6不再兼容。有没有其他方法可以在rad之外构建ear文件。我正在对旧版本的代码执行struts更新。非常感谢您的帮助。