0 Replies Latest reply on Nov 30, 2016 9:58 PM by imben1109

    Cannot start Arquillian with JSFUnit in Embedded Tomcat

    imben1109

      I am testing JSFUnit with Arquillian. Once I run the test case, it repeatedly throws the below exception. My maven dependency is attached in the below.

       

      INFO: <html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException

        com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading(ELFlash.java:792)

        com.sun.faces.context.flash.ELFlash.getPhaseMapForReading(ELFlash.java:825)

        com.sun.faces.context.flash.ELFlash.isEmpty(ELFlash.java:484)

        com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:324)

        com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:214)

        com.sun.faces.facelets.util.DevTools.debugHtml(DevTools.java:129)

        com.sun.faces.renderkit.RenderKitUtils.renderHtmlErrorPage(RenderKitUtils.java:1206)

        com.sun.faces.context.ExceptionHandlerImpl.throwIt(ExceptionHandlerImpl.java:269)

        com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:139)

        com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)

        com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

        javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

      </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.53 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>

       

       

       

        <dependencyManagement>

        <dependencies>

        <!-- Arquillian -->

        <dependency>

        <groupId>org.jboss.arquillian</groupId>

        <artifactId>arquillian-bom</artifactId>

        <version>1.1.10.Final</version>

        <type>pom</type>

        <scope>import</scope>

        </dependency>

        </dependencies>

        </dependencyManagement>

       

       

        <dependencies>

       

        <!-- shrinkwrap -->

        <dependency>

        <groupId>org.jboss.shrinkwrap</groupId>

        <artifactId>shrinkwrap-depchain</artifactId>

        <type>pom</type>

        <scope>test</scope>

        </dependency>

       

       

        <!-- JUnit -->

        <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>4.8.1</version>

        <scope>test</scope>

        </dependency>

        <dependency>

        <groupId>org.jboss.arquillian.junit</groupId>

        <artifactId>arquillian-junit-container</artifactId>

        <scope>test</scope>

        </dependency>

       

       

        <!-- Embedded Tomcat -->

        <dependency>

        <groupId>org.jboss.arquillian.container</groupId>

        <artifactId>arquillian-tomcat-embedded-7</artifactId>

        <version>1.0.0.CR8</version>

        <scope>test</scope>

        </dependency>

        <dependency>

        <groupId>javax.servlet.jsp</groupId>

        <artifactId>jsp-api</artifactId>

        <version>2.2</version>

        <scope>test</scope>

        </dependency>

        <dependency>

        <groupId>com.sun.faces</groupId>

        <artifactId>jsf-api</artifactId>

        <version>2.1.14</version>

        </dependency>

        <dependency>

        <groupId>com.sun.faces</groupId>

        <artifactId>jsf-impl</artifactId>

        <version>2.1.14</version>

        </dependency>

        <dependency>

        <groupId>org.apache.tomcat.embed</groupId>

        <artifactId>tomcat-embed-core</artifactId>

        <version>7.0.53</version>

        <scope>provided</scope>

        </dependency>

        <dependency>

        <groupId>org.apache.tomcat.embed</groupId>

        <artifactId>tomcat-embed-jasper</artifactId>

        <version>7.0.53</version>

        <scope>provided</scope>

        </dependency>

        <dependency>

        <groupId>org.apache.tomcat.embed</groupId>

        <artifactId>tomcat-embed-logging-juli</artifactId>

        <version>7.0.53</version>

        <scope>provided</scope>

        </dependency>

        <dependency>

        <groupId>javax.servlet</groupId>

        <artifactId>jstl</artifactId>

        <version>1.2</version>

        </dependency>

       

        <dependency>

        <groupId>org.eclipse.jdt.core.compiler</groupId>

        <artifactId>ecj</artifactId>

        <version>3.7</version>

        <scope>test</scope>

        </dependency>

       

       

        <!-- JsfUnit -->

        <dependency>

        <groupId>org.jboss.jsfunit</groupId>

        <artifactId>jsfunit-arquillian</artifactId>

        <version>2.0.0.Beta2</version>

        </dependency>

       

        </dependencies>

       

       

      My Test Case Source Code:

       

      @RunWith(Arquillian.class)

      public class SimpleTest {

       

          @Deployment

          public static WebArchive createDeployment() {

          WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");

        

          File[] files = Maven.configureResolver().loadPomFromFile("pom.xml")

          .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();

        

              for(File file : files){

              war.addAsLibrary(file);

              }      

             

          war.addClass(TestBean.class);

          war.addAsWebResource(new File("src/test/resources/faces/hello.xhtml"), "hello.xhtml");

          war.addAsWebResource(new File("src/test/resources/faces/welcome.xhtml"), "welcome.xhtml");

          war.setWebXML(new File("src/test/resources/web.xml"));

       

       

              return war;

          }

         

          @Test

          @InitialPage("/hello.xhtml")

          public void test(JSFClientSession client, JSFServerSession server) throws Exception{

          }

      }