WebSphere ClassNotFoundException with deployed dyn

2019-02-18 11:57发布

问题:

Problem

I am currently experiencing a ClassNotFoundException with a deployed EAR (with OpenFaces web project) on WebSphere 7.0 application server. The EAR deploys with no problems, but when I go to access a page from the web project (included in the EAR), I get the ClassNotFoundException (below). I have exported the EAR to make sure that everything was there and the WAR file is included. When I looked inside the WAR file, the class that is not being found is included in the WEB-INF/classes folder. The exception is referring to a class that is in the web project and not in a JAR if that helps. I'm guessing I am missing something in my project configuration. Any and all feedback is much appreciated!

Error

[4/3/13 15:42:49:462 EDT] 0000001b Digester      E org.apache.commons.digester.Digester startElement Begin event threw exception
                             java.lang.ClassNotFoundException: org.openfaces.demo.services.MenuItem
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
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:510)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
at org.apache.commons.digester.Rule.begin(Rule.java:175)
at org.apache.commons.digester.Digester.startElement(Digester.java:1453)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1296)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:340)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:307)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:212)
at org.apache.commons.digester.Digester.parse(Digester.java:1765)
at org.openfaces.demo.services.MenuService.loadMenu(MenuService.java:75)
at org.openfaces.demo.services.MenuService.<init>(MenuService.java:215)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1345)
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:190)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:107)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:374)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:222)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:88)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:73)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:100)
at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:860)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at org.openfaces.ajax.AjaxViewRoot.encodeAll(AjaxViewRoot.java:124)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:292)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:223)
at org.openfaces.ajax.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:64)
at org.openfaces.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:413)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:114)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:99)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
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: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:1604)

[4/3/13 15:42:49:587 EDT] 0000001b webapp        I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0296E: [OlympusAetherUIEAR#OlympusAetherUI.war][/OlympusAetherUI][Servlet.LOG]:.Error at line 26 char 12: org.openfaces.demo.services.MenuItem:.java.lang.ClassNotFoundException: org.openfaces.demo.services.MenuItem
at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207)
at org.apache.commons.digester.Digester.startElement(Digester.java:1456)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1296)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:340)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:307)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:212)
at org.apache.commons.digester.Digester.parse(Digester.java:1765)
at org.openfaces.demo.services.MenuService.loadMenu(MenuService.java:75)
at org.openfaces.demo.services.MenuService.<init>(MenuService.java:215)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1345)
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:190)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:107)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:374)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:222)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:88)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:73)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:100)
at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:860)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at org.openfaces.ajax.AjaxViewRoot.encodeAll(AjaxViewRoot.java:124)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:292)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:223)
at org.openfaces.ajax.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:64)
at org.openfaces.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:413)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:114)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.openfaces.util.ResourceFilter.doFilter(ResourceFilter.java:99)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
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: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:1604)

Web project configuration

  • Build path for web project src: OlympusAetherUI/WebContent/WEB-INF/classes
  • Deploy path for src: WEB-INF/classes

EAR deployment assembly

  • Source: OlympusAetherUI Deploy path: OlympusAetherUI.war
  • Source: OlympusCommon Deploy path: lib/OlympusCommon.jar
  • Source: OlympusGenerated Deploy path: lib/OlympusGenerated.jar

回答1:

Found the source of the problem. The commons-digester.jar needed to be in WEB-INF/lib so that it was able to find the MenuItem class since the EAR classpath doesn't have visibility to the web classpath.



回答2:

I think your classpath is wrong.

Under WEB-INF/classes, check these folders >> org/openfaces/demo/services and then check the class MenuItem inside the last directory Services.

Regards,