ClassNotFoundException: SanitizerLogWrapper while starting WebSphere Application server with Liferay - java

I've deployed Liferay 6.1 on WAS 8.5.5. While trying to start the server via Eclipse Juno, I'm getting a ClassNotFoundException which points to com.liferay.portal.kernel.log.SanitizerLogWrapper. Does someone know what the cause might be?
Here are the logs:
[8/6/15 9:09:39:152 EDT] 0000005a webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NoClassDefFoundError: com.liferay.portal.kernel.log.SanitizerLogWrapper
at com.liferay.portal.util.InitUtil.init(InitUtil.java:115)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:169)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1678)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
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:1175)
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:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
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:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.kernel.log.SanitizerLogWrapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:599)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:743)
at java.lang.ClassLoader.loadClass(ClassLoader.java:720)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
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:690)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
... 23 more

It seems you are missing portal-kernel.jar or portal-service.jar
More here

Liferay requires some classes on the global classpath. You can download them as so called "dependencies". Among them is portal-service.jar
If you deployed Liferay according to the Administration Guide for Websphere 8.5, everything should run (I'm linking the 6.2 version of the docs, but I expect no big changes. If you're on CE, you should update anyways, because 6.1 CE is discontinued for quite a while now)

Related

OperatingSystemMXBean is not a valid MXBean interface error when deploying on WebSphere Application Server

When deploying and executing my aplication in WebSphere Application server the following error message is presented.
[6/1/21 17:44:24:958 CDT] 0000004e webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:278)
at com.transform.cartridge.volpayreferencedatautil.VolPayReferenceDataUtilFunctions.addTimeLog(VolPayReferenceDataUtilFunctions.java:204)
at com.transform.flow.logaudit.LogAudit.Custom3Activity(LogAudit.java:100)
at com.transform.flow.logaudit.LogAudit.executeInternal(LogAudit.java:152)
at com.transform.flow.logaudit.LogAudit.run0(LogAudit.java:115)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.Invoke1Activity(LogAudit_Sys_Debug_Instr.java:41)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.executeInternal(LogAudit_Sys_Debug_Instr.java:82)
at com.transform.flow.logaudit_sys_debug_instr.LogAudit_Sys_Debug_Instr.run0(LogAudit_Sys_Debug_Instr.java:53)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.Invoke4Activity(VolantePaymentEngineStartOfProcess.java:77)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.executeInternal(VolantePaymentEngineStartOfProcess.java:325)
at com.transform.flow.volantepaymentenginestartofprocess.VolantePaymentEngineStartOfProcess.run0(VolantePaymentEngineStartOfProcess.java:300)
at com.tplus.transform.runtime.AbstractMessageFlow.run(AbstractMessageFlow.java:157)
at com.tplus.transform.runtime.volante.MessageFlowVolante$1.run(MessageFlowVolante.java:75)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start0(DeclarativeTransactionalExecutor.java:137)
at com.tplus.transform.runtime.volante.DeclarativeTransactionalExecutor.start(DeclarativeTransactionalExecutor.java:113)
at com.tplus.transform.runtime.volante.MessageFlowVolante.run(MessageFlowVolante.java:73)
at com.tplus.transform.runtime.proxy.MessageFlowProxy.run(MessageFlowProxy.java:32)
at com.volantetech.volante.services.StartOfProcess.process(StartOfProcess.java:45)
at com.volantetech.volante.services.ApplicationStartupListener.contextInitialized(ApplicationStartupListener.java:218)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1837)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:443)
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:1249)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1591)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:708)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:1162)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:801)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2325)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5536)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5662)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2330)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:436)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:379)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:127)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:985)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:524)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)
Caused by: java.lang.IllegalArgumentException: com.sun.management.OperatingSystemMXBean is not a valid MXBean interface.
at java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:469)
at com.volantetech.volante.services.performance.log.LogTime.<init>(LogTime.java:23)
at com.volantetech.volante.services.performance.log.LogTime.<clinit>(LogTime.java:20)
... 57 more
The server is a RHEL with WebSphere 9.0.5.5 and java openjdk version "1.8.0_292"
The application is developed so it takes a message from a message queue and processes them. The message queue being used is IBM MQ 9.1.1.0. The application is taking the messages but not processing them correctly. The error is presenting on startup and also on execution.
Any guidance would be much valued.
It looks like the AppServer is using OpenJ9 while your application is being compiled with openjdk 1.8. Perhaps you are getting mismatch in the WAS ManagementFactory. Try "ps -fea" and check the jvm being used.
It was resolved by installing and configuring java JRE version 1.8 at Websphere execution level.

grails 1.1.1 will support java 1.7

Currently my application is running on grails 1.1.1 with java 1.6 on web sphere server. My application is working in old server with java 1.6.Recently server team upgrade the websphere server 8.5.5 and they asked us to deploy an ear with java 1.7. I have deployed the ear with java 1.7. now I am getting below error:
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: javax.servlet.ServletException: Filter [charEncodingFilter]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.security.AccessController.doPrivileged(AccessController.java:426)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1704)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:411)
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:1177)
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:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1379)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2189)
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:5477)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5603)
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:1269)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1261)
at java.security.AccessController.doPrivileged(AccessController.java:426)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:92)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814)
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$QueuedWork.run(SSLReadServiceContext.java:1981)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
... 43 more
Caused by: java.lang.reflect.InvocationTargetException
... 43 more
Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [customer.CustomerController]!
... 43 more
Caused by: java.lang.TypeNotPresentException: Type CustomerSegment not present
at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:399)
at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:126)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:84)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:68)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1164)
at java.beans.Introspector.getBeanInfo(Introspector.java:428)
at java.beans.Introspector.getBeanInfo(Introspector.java:175)
at java.security.AccessController.doPrivileged(AccessController.java:456)
at customer.CustomerController.$getStaticMetaClass(CustomerController.groovy)
at base.BdwBaseController.<init>(BdwBaseController.groovy)
at customer.CustomerController.<init>(CustomerController.groovy)
... 43 more
Caused by: java.lang.ClassNotFoundException: CustomerSegment
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:302)
... 54 more
I have a few questions:
Grails 1.1.1 will support java 1.7?
if not do I need to upgrade grails?
What are all the steps to upgrade grails?
web sphere 8.5.5 will not support java 1.6?
to resolve this error what I need to check?
Do I need to update jars?
please find below jars which I am using in my application:
jar files
Going to try to answer as much as I can, but it's a best-effort since you're asking way too many questions in one post!
1 - Probably not. Grails 1.1.1 came out in 2009, and Java 1.7 came out in 2011, and was a major change over 1.6. You might be able to force them to work together, but you're going to struggle to find good information six (plus) years later.
2 - Yes.
3 - You can start here: http://docs.grails.org/1.2.0/ and go from there.
4 - See comment below. (Originally I said, but was wrong: IBM recommends Java 8 with WebSphere 8.)
5 - Probably not important, if you're upgrading everything anyway.
6 - Yes.

Deploying my web application in IBM WebSphere Application Server Liberty 17.0.0.2 raising error

I deployed my web application in IBM WebSphere Application Server Liberty 17.0.0.2 and when I am trying to access it getting following error:
Error Message: javax.servlet.ServletException:
java.lang.NoClassDefFoundError: Could not initialize class
com.x.y.z
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack: java.lang.NoClassDefFoundError: Could not initialize class com.x.y.z at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1021)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4983)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:528)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:315)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1025)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:66)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
If the com.x.y.z is a 3rd party package, you'll need to set visibility of the third-party API packages in the Liberty server.xml to allow the application to access them.
Hopefully this documentation should help: https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_classloader_3p_apis.html

Struts 2.5 ClassNotFoundException Issue

I have a Struts problem. I'm upgrading an application from Struts 1.2.x to 2.5.8. I have a single war and multiple EJBs in a single EAR file deploying to WebSphere 8.5. Every time I try to access a simple hello world jsp via a Struts action, I get this stack trace in my browser:
Error Message: javax.servlet.ServletException: Filter [struts2]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
Unable to load configuration. - bean - wsjar:file:/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:499)
at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:75)
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:63)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:607)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:514)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:319)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:392)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3928)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
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:1881)
Caused by: Unable to load configuration. - bean - wsjar:file/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:906)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:486)
... 28 more
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - wsjar:file:/WEB-INF/lib/struts2-core-2.5.8.jar!/struts-default.xml:92:181
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:271)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:98)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileUploadException
at java.lang.J9VMInternals.prepareClassImpl(Native Method)
at java.lang.J9VMInternals.prepare(J9VMInternals.java:283)
at java.lang.Class.getDeclaredConstructors(Class.java:721)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:263)
... 34 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at java.net.URLClassLoader.findClass(URLClassLoader.java:600)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:786)
at java.lang.ClassLoader.loadClass(ClassLoader.java:764)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
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:585)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
... 38 more
I've verified that the required commons-fileupload jar is in the war and it's not in a shared library location that would cause namespace conflicts. Classloader setting is set to parent first, and due to the complexity of the project, I can't safely change it.
What do I need to do to get past this?
TIA
Alex
Looks like I spoke too soon. For some reason, my first search failed to turn up an older version of commons-fileupload in the AppServer/plugins folder. It appears this jar is being used by the app server, and with the parent first classloading in use, there's a class collision taking place. So now I have to figure out how to get around that, but the original problem has been solved.
As long as the classes in your commons-fileupload jar have no dependencies on your application or WAR classes, you can deploy this jar as an isolated shared library and associate it to your application or WAR, whichever has the dependency on the jar. The classloading semantics for isolated shared libraries are described in topic "Isolating open source packages" in the WebSphere Application Server Knowledge Center for versions 8.5.5 and 9.0.
Isolating open source packages:
https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/welc6tech_opensource_isolate.html
If you are using a recent version of 8.5.5, you might also try always-protected packages, which is also described in "Isolating open source packages". Note that always-protected packages can impact every application running on the application server.

Solr on Websphere 8.5.5 : Linkage Error with org.slf4j.LoggerFactory

I am installing solr ( 4.10.2 ) on WAS 8.5.5 with IBM jdk 7. <br>
I deployed the `solr` as a `war` and added `solr.data.dir` and `solr.solr.home` to the application custom properties.
<br>
Upon accessing the url: http://localhost:9080/solr, <br>
I see the 'Linkage Error' in the logs.
4/03/15 06:50:58:277 GMT] 000000ae webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.NoClassDefFoundError: org.apache.solr.servlet.SolrDispatchFilter (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:176)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1600)
..........................<br>
...........................<br>
used by: **java.lang.LinkageError: org.slf4j.LoggerFactory**
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
I modified the lib of the downloaded solr.war. On the top of the jars already present in the solr.war/WEB-INF/lib, I added an additional set of jars from the downloaded solr package
All the jars from \solr-4.10.2\solr-4.10.2\dist
All the jars from \solr-4.10.2\solr-4.10.2\dist\solrj-lib
All the jars from \solr-4.10.2\solr-4.10.2\example\lib\ext
Modified the application Class Loading to 'PARENT_LAST'.
Have been scratching my head for over 16 hours.
Even tried removing the all the slf4j*.jars from the solr.war\WEB-INF\lib but the same error persists.
Some help is highly solicited.
Finally was able to make SOLR up and running on Websphere 8.5.5
I have enumerated the different steps on my blog.
Solr 4.10.2 Deployment on WebSphere855

Categories

Resources