2 Replies Latest reply on Jun 29, 2010 4:02 AM by Mister Face

    Setting up JSFUnit with Maven, Spring Security, Tomcat --- ClassNotFound: ProjectStage

    Mister Face Newbie

      Hey folks!

       

      I currently try to set up my environment with JSFUnit and it seems not to be that difficult. But when I wanted to start my first Test I get the following exception:

      tomcat console:

       

      SCHWERWIEGEND: Servlet.service() for servlet jsp threw exception
      java.lang.ClassNotFoundException: javax.faces.application.ProjectStage
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
          at java.lang.Class.getDeclaredMethods0(Native Method)
          at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
          at java.lang.Class.getDeclaredMethods(Class.java:1791)
          at java.beans.Introspector$1.run(Introspector.java:1287)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1285)
          at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1151)
          at java.beans.Introspector.getBeanInfo(Introspector.java:402)
          at java.beans.Introspector.getBeanInfo(Introspector.java:168)
          at javax.el.BeanELResolver$BeanProperties.<init>(BeanELResolver.java:179)
          at javax.el.BeanELResolver.property(BeanELResolver.java:275)
          at javax.el.BeanELResolver.getValue(BeanELResolver.java:60)
          at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
          at org.apache.el.parser.AstValue.getValue(AstValue.java:123)
          at org.apache.el.parser.AstDynamicExpression.getValue(AstDynamicExpression.java:42)
          at org.apache.el.parser.AstCompositeExpression.getValue(AstCompositeExpression.java:47)
          at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
          at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
          at org.apache.jsp.faces.login_jspx._jspx_meth_f_005fview_005f0(login_jspx.java:142)
          at org.apache.jsp.faces.login_jspx._jspService(login_jspx.java:108)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:169)
          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
          at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
          at org.jboss.jsfunit.context.JSFUnitDelegatingExternalContext.dispatch(JSFUnitDelegatingExternalContext.java:258)
          at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:468)
          at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
          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:245)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:169)
          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
          at java.lang.Thread.run(Thread.java:619)

       

       

      error shown in JSFUnit result page:


      500 Internal Server Error for  http://localhost:8080/UrkundenAbfrageWebApp/faces/login.jsf

      com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException:  500 Internal Server Error for  http://localhost:8080/UrkundenAbfrageWebApp/faces/login.jsf
      at  com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:530)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:386)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:371)
      at  org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)
      at  org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
      at  org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)
      at  org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:58)
      at  at.gv.brz.urkundenabfrage.jsf.util.JSFUnitTest.testInitialPage(JSFUnitTest.java:33)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at  org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
      at  org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
      at  org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
      at  org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
      at  org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
      at  org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
      at  org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
      at  org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
      at  org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46)
      at  org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
      at  org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
      at  org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      at  org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at  org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
      at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:169)
      at  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
      at  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
      at  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
      at  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:619)

       

       

       

       

       

      I get the cactus xsl formated result page in my browser, so I guess JSFUnit itself is set up correctly.

      I looked for ProjectStage class and found it in javaee-api-6.0 jar, which is listed in my maven dependencies correctly as well. As I mentioned in the title I use Maven and I even set all dependency scopes to compile level. I still get this error...

       

       

      My test does not do anything at the moment:

       

      public class JSFUnitTest extends org.apache.cactus.ServletTestCase {
          public static Test suite() {
              return new TestSuite(JSFUnitTest.class);
          }

       

          public void testInitialPage() throws IOException {

       

              JSFSession jsfSession = new JSFSession("/faces/login.jsf");

              JSFClientSession client = jsfSession.getJSFClientSession();

              JSFServerSession server = jsfSession.getJSFServerSession();
              assertEquals("/faces/login.jsf", server.getCurrentViewID());

          }
      }

       

      Any ideas?

       

      Thank u

       

      MrFace