Class not found Exception

Hello,

I have created a portlet-application which uses another class in another project. We have imported that class, and also set it in the classpath.
With a button on a CAF-page, we raise an Ajax-Event, which then calls a procedure in this class. When pressing the button, I receive a “ClassNotFoundException”.

Stack:
java.lang.ClassNotFoundException: events.raiseEvents
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:401)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at com.webmethods.caf.MyEventProvider.raise(MyEventProvider.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.webmethods.caf.faces.application.CAFMethodBinding.invoke(CAFMethodBinding.java:65)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at com.webmethods.caf.faces.component.ViewRoot.broadcastEvents(ViewRoot.java:202)
at com.webmethods.caf.faces.component.ViewRoot.processApplication(ViewRoot.java:116)
at com.webmethods.caf.faces.portlet.PortletLifecycle$InvokeApplicationPhase.execute(PortletLifecycle.java:684)
at com.webmethods.caf.faces.portlet.PortletLifecycle.phase(PortletLifecycle.java:256)
at com.webmethods.caf.faces.portlet.PortletLifecycle.execute(PortletLifecycle.java:146)
at com.webmethods.caf.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:245)
at com.webmethods.portal.framework.portletcontainer.impl.PortletApplicationHandler.process(PortletApplicationHandler.java:480)
at com.webmethods.portal.framework.portletcontainer.servlet.PortletServlet.service(PortletServlet.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.dispatch(PortletContainer.java:219)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.process(PortletContainer.java:130)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.processPortletAction(PortletContainer.java:108)
at com.webmethods.portal.framework.portlet.beans.rest.RestfulPCAHandler.handle(RestfulPCAHandler.java:194)
at com.webmethods.portal.framework.dispatch.DispatchManager.handle(DispatchManager.java:440)
at com.webmethods.portal.framework.dispatch.DispatchManager.handleDispatch(DispatchManager.java:370)
at com.webmethods.portal.framework.impl.PortalServlet.service(PortalServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.webmethods.portal.framework.impl.NTLMFilter.doFilter(NTLMFilter.java:50)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.webmethods.caf.faces.servlet.GZIPFilter.doFilter(GZIPFilter.java:42)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)

How can this problem be solved?

Greetings
Stefan

Hi,
is the class as well inside the deployed war file?
My first guess is that even if the class is set in the classpath, it is not set to be added to the produced war file. This is defined in the project properties, under J2EE Module Dependencies (to activate this panel, open the Java EE perspective once and close it again)

hope this helps,
Javier

Hello Javier,
we tried it, and it, well, worked, but now I receive another errormessage:
java.lang.NoClassDefFoundError: events/raiseEvents
at com.webmethods.caf.MyEventProvider.raise(MyEventProvider.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.webmethods.caf.faces.application.CAFMethodBinding.invoke(CAFMethodBinding.java:65)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at com.webmethods.caf.faces.component.ViewRoot.broadcastEvents(ViewRoot.java:202)
at com.webmethods.caf.faces.component.ViewRoot.processApplication(ViewRoot.java:116)
at com.webmethods.caf.faces.portlet.PortletLifecycle$InvokeApplicationPhase.execute(PortletLifecycle.java:684)
at com.webmethods.caf.faces.portlet.PortletLifecycle.phase(PortletLifecycle.java:256)
at com.webmethods.caf.faces.portlet.PortletLifecycle.execute(PortletLifecycle.java:146)
at com.webmethods.caf.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:245)
at com.webmethods.portal.framework.portletcontainer.impl.PortletApplicationHandler.process(PortletApplicationHandler.java:480)
at com.webmethods.portal.framework.portletcontainer.servlet.PortletServlet.service(PortletServlet.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.dispatch(PortletContainer.java:219)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.process(PortletContainer.java:130)
at com.webmethods.portal.framework.portletcontainer.PortletContainer.processPortletAction(PortletContainer.java:108)
at com.webmethods.portal.framework.portlet.beans.rest.RestfulPCAHandler.handle(RestfulPCAHandler.java:194)
at com.webmethods.portal.framework.dispatch.DispatchManager.handle(DispatchManager.java:440)
at com.webmethods.portal.framework.dispatch.DispatchManager.handleDispatch(DispatchManager.java:370)
at com.webmethods.portal.framework.impl.PortalServlet.service(PortalServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.webmethods.portal.framework.impl.NTLMFilter.doFilter(NTLMFilter.java:50)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.webmethods.caf.faces.servlet.GZIPFilter.doFilter(GZIPFilter.java:42)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)

What could that be?

Greetings

hi
you may be missing the CAF Events project facet. Although you should not need it in your project (at compile time)…
Try adding it and see what happens.

regards
Javier