2
votes

I've tried to upgrade Spring version from 3.1.2 to 3.2.8 on the WebSphere 8.5, but I've got the error:

CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.DispatcherServlet class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext

The jar spring-web-3.2.8.RELEASE.jar is present in the WAR/WEB-INF/lib directory. The archive is not damaged, the WebApplicationContext class is present there. Everything looks like before, only the spring version is higher.

Everything is working with Spring 3.1.2 with the same maven build configuration and EAR descriptors! But after changing Spring version (and nothing more), the mentioned error occurs.

Is there anything special that must be done when upgrading Spring version on Websphere? Or it's just a kind of incompatibility?

That call comes somewhere from JmxMBeanServer. It comes in the web application initialization phase, when the EAR is deployed/updated from IBM RAD. Full stack trace included:

[5/8/14 10:12:42:866 CEST] 0000004b InjectionProc W CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.DispatcherServlet class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:93) at java.lang.J9VMInternals.verify(J9VMInternals.java:91) at java.lang.J9VMInternals.prepare(J9VMInternals.java:490) at java.lang.Class.getDeclaredFields(Class.java:605) at com.ibm.wsspi.injectionengine.InjectionProcessor.getAllDeclaredFields(InjectionProcessor.java:554) at com.ibm.wsspi.injectionengine.InjectionProcessor.processAllAnnotations(InjectionProcessor.java:722) at com.ibm.wsspi.injectionengine.InjectionProcessorContextImpl.processAllAnnotations(InjectionProcessorContextImpl.java:50) at com.ibm.ws.injectionengine.AbstractInjectionEngine.processAnnotations(AbstractInjectionEngine.java:750) at com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMetaData(AbstractInjectionEngine.java:559) at com.ibm.ws.injectionengine.SharedInjectionEngineImpl.processInjectionMetaData(SharedInjectionEngineImpl.java:208) at com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceContextImpl.java:838) at com.ibm.ws.webcontainer.webapp.WebAppImpl.populateJavaNameSpace(WebAppImpl.java:1112) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:328) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663) at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5459) at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5585) at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259) 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:49) 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.MethodUtil.invoke(MethodUtil.java:256) at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148) at java.security.AccessController.doPrivileged(AccessController.java:252) 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:1142) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) 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:1784) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815) Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext at java.net.URLClassLoader.findClass(URLClassLoader.java:434) at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204) at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688) at java.lang.ClassLoader.loadClass(ClassLoader.java:667) at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119) at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584) at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584) at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584) at java.lang.ClassLoader.loadClass(ClassLoader.java:650) ... 72 more

1

1 Answers

0
votes

As the stacktrace says:

The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext

Your spring-web-xyz.jar is not loaded. Make sure it is located in the classpath, i.e. using the admin app. It should be here somewhere: Servers -> ApplicationServers -> Servername -> Process Definition -> Java Virtual Machine.