websphereclassloaderlinkageerror

WAS 8.5 server startup error


I am getting the following error while trying to deploy an EAR on WAS 8.5 in MyEclipseBlue.Can anybody please help? I have tried changing the class loader order from parent last to first, setting metadata-complete="true" in web.xml , creating a new profile and reinstalling WAS . Nothing seems to work. Please find the console logs below.

[9/17/16 16:03:06:548 IST] 00000001 ContainerHelp E   WSVR0501E: Error creating component com.ibm.ws.runtime.component.CompositionUnitMgrImpl@acf57ca5
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: loading constraint violation: loader &quot&#59;com/ibm/ws/classloader/CompoundClassLoader@a74d2eab&quot&#59; previously initiated loading for a different type with name &quot&#59;javax/servlet/ServletContext&quot&#59; defined by loader &quot&#59;org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@d19a0410&quot&#59;
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1170)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:638)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:769)
    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$CUInitializer.run(CompositionUnitMgrImpl.java:994)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: loading constraint violation: loader &quot&#59;com/ibm/ws/classloader/CompoundClassLoader@a74d2eab&quot&#59; previously initiated loading for a different type with name &quot&#59;javax/servlet/ServletContext&quot&#59; defined by loader &quot&#59;org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@d19a0410&quot&#59;
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    ... 14 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@a74d2eab" previously initiated loading for a different type with name "javax/servlet/ServletContext" defined by loader "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@d19a0410"
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    ... 16 more
Caused by: java.lang.LinkageError: loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@a74d2eab" previously initiated loading for a different type with name "javax/servlet/ServletContext" defined by loader "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@d19a0410"
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:262)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
    at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:852)
    at com.ibm.ws.classloader.CompoundClassLoader.localFindClass(CompoundClassLoader.java:762)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:603)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
    at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:61)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:613)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    ... 17 more

Solution

  • You have presumably packaged the servlet API in your application, so you should remove that. FWIW, it's basically impossible to get a LinkageError like this unless either your application or module class loader is set to "parent last". If you did change from parent last to parent first and still see some error, I suspect it's not the same as the error you've included here.