2 Replies Latest reply on Sep 17, 2009 3:49 AM by peter koebele

    JSP pre compilation vs. JBoss 5

    peter koebele Newbie

      Currently I try to run/deploy a war file in JBoss AS 5.0.0.GA that contains pre-compiled JSPs. Unfortunately I get some strange errors, I don't get rid off. Below you can find some details about my activities. If anyone has an idea of the problem cause - I am very interested in the solution.

      Best regards
      pkx

      1.) JSP pre compilation with jspc-maven-plugin:2.0.-alpha3 using tomcat6 compiler as described on http://mojo.codehaus.org/jspc/jspc-maven-plugin/usage.html.
      --> resulting war file looks fine, JSP's and web.xml are all available
      2.) JBoss AS deploys this war file successfully
      3.) When the web application is accessed, a ClassNotFoundException is thrown:
      java.lang.ClassNotFoundException: org.apache.jasper.runtime.AnnotationHelper from BaseClassLoader@35b4548f{VFSClassLoaderPolicy@521b93d4{name=vfszip:/Applications/jboss/jboss-5.0.0.GA/server/default/deploy/mywar-1.5-SNAPSHOT.war
      4.) If I add the missing classes to war file, the deployment of the web application fails.

        • 1. Re: JSP pre compilation vs. JBoss 5
          Jean-Frederic Clere Master

          The annotations are processed a different way in JBoss Web you can't use the tomcat6 plugin.
          I don't think that there is a plugin for JBoss Web, you should use JspC and ant.
          See http://labs.jboss.com/file-access/default/members/jbossweb/freezone/docs/latest/jasper-howto.html for more details.

          • 2. Re: JSP pre compilation vs. JBoss 5
            peter koebele Newbie

            Thanks for your reply.
            I could solve the problem when I use the Jsp compiler embedded in the jbossweb.jar instead of using the jasper.jar used by the jsp-compiler-tomcat.jar. Below you can find a snippet of pom.xml, to compile the JSPs successfully with the jspc-maven-plugin:


            <plugin>
             <groupId>org.codehaus.mojo.jspc</groupId>
             <artifactId>jspc-maven-plugin</artifactId>
             <version>2.0-alpha-3</version>
             <executions>
             <execution>
             <id>jsp-compile</id>
             <goals> <goal>compile</goal></goals>
             </execution>
             </executions>
             <configuration>
            <!-- jspc configuration -->
            
             </configuration>
             <dependencies>
             <dependency>
             <groupId>org.codehaus.mojo.jspc</groupId>
             <artifactId>jspc-compiler-tomcat6</artifactId>
             <version>2.0-alpha-3</version>
             <scope>runtime</scope>
             <!-- exclude tomcat6 jsp compiler-->
             <exclusions>
             <exclusion>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>jasper</artifactId>
             </exclusion>
             <exclusion>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>jasper-jdt</artifactId>
             </exclusion>
             </exclusions>
             </dependency>
            <!-- Add jboss jsp compiler dependencies-->
             <dependency>
             <groupId>jboss.web</groupId>
             <artifactId>jbossweb</artifactId>
             <version>2.1.4.GA</version>
             <scope>provided</scope>
             </dependency>
             <dependency>
             <groupId>org.jboss.logging</groupId>
             <artifactId>jboss-logging-spi</artifactId>
             <version>2.1.0.GA</version>
             <scope>provided</scope>
             </dependency>
             <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
             <version>2.5</version>
             <scope>provided</scope>
             </dependency>
             <dependency>
             <groupId>javax.servlet.jsp</groupId>
             <artifactId>jsp-api</artifactId>
             <version>2.1</version>
             <scope>provided</scope>
             </dependency>
             </dependencies>
            </plugin>