1 2 3 Previous Next 31 Replies Latest reply on Oct 29, 2012 5:01 AM by Jean-Frederic Clere

    JspC for JBoss 6 M4

    Roqs Almodiel Newbie

      Hi, 

       

      Just want to ask if there is a replacement class for org.apache.jasper.JspC in JBoss 6 M4.   For JBoss 5 it is included in the jbossweb.jar, but for JBoss6 it seems it does not exist in any jar file. 

       

      If anyone has already done a JSP pre-compilation for JBoss 6 using its libraries, hope that you can share some details.

       

      Thanks in advance.

        • 1. Re: JspC for JBoss 6 M4
          Roqs Almodiel Newbie

          I was just experimenting and tried copying jasper.jar from the lib folder of jboss-web-2.1.9.GA into jboss6/server/default/deploy/jbossweb.sar and I can do a precompile without a problem (the jars in the jbossweb.sar is in the classpath when I invoke JspC). 

           

          Problem now is when I deploy a  war file in JBoss6 I'm encountering this exception even if the JSP has been validated correctly by JspC.   I also deployed the exact same war file in JBoss5.1.0.GA and it doesn't have the problem and I can access the context without any error.  I wish I could track the problem during precompilation cause it shows the row and column numbers of where the errors exist compared to the very vague NPE error that is displayed during invocation of the JSP.

           

           

          Exception in JBoss6 (with or without the jasper.jar file from jboss-web):

          2010-09-19 07:23:22,262 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/XXXXXXXX].[action]] (http-0.0.0.0-8380-4) Servlet.service() for servlet action threw exception: java.lang.NullPointerException

                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1598) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Parser.parse(Parser.java:130) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:196) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338) [:6.0.0.20100721-M4]

                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325) [:6.0.0.20100721-M4]

                  at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [:6.0.0.20100721-M4]

                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [:6.0.0.20100721-M4]

                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.20100721-M4]

                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.20100721-M4]

                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Beta2]

                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.20100721-M4]

                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4]

                  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.20100721-M4]

                  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [:6.0.0.20100721-M4]

           

          Any help would be highly appreciated.

          2010-09-19 07:23:22,262 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/LesContent].[action]] (http-0.0.0.0-8380-4) Servlet.service() for servlet action threw exception: java.lang.NullPointerException
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1598) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parse(Parser.java:130) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:196) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325) [:6.0.0.20100721-M4]
                  at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.20100721-M4]
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Beta2]
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [:6.0.0.20100721-M4]2010-09-19 07:23:22,262 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/LesContent].[action]] (http-0.0.0.0-8380-4) Servlet.service() for servlet action threw exception: java.lang.NullPointerException
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1598) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1633) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:976) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1247) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Parser.parse(Parser.java:130) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:196) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338) [:6.0.0.20100721-M4]
                  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325) [:6.0.0.20100721-M4]
                  at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.20100721-M4]
                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.20100721-M4]
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Beta2]
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.20100721-M4]
                  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [:6.0.0.20100721-M4]

          • 2. Re: JspC for JBoss 6 M4
            huggivig Newbie

            I've got the same problem! Did you find the solution?

            • 3. Re: JspC for JBoss 6 M4
              Roqs Almodiel Newbie

              For the JspC problem, I just included the jasper.jar from the lib folder of jboss-web-2.1.9.GA into my classpath.

               

              For the NullPointerException, I still don't have the solution.  We just switched back to JBoss 5 for now.

              • 4. Re: JspC for JBoss 6 M4
                huggivig Newbie

                In class org.apache.jasper.compiler.Parser of jbossweb.jar, in method parseCustomTag, at line 1233, the method getBodyContent of class javax.servlet.jsp.tagext.TagInfo (from javaee-api-6.0.jar) return null for tagClassName org.apache.struts.taglib.html.OptionTag .
                Is it a javaee-api-6.0 bug?

                • 5. Re: JspC for JBoss 6 M4
                  Roqs Almodiel Newbie

                  Seems like the JSP handling of JBoss6M4 still has bugs or at least has some error messages that are not helpful. 

                   

                  I've read somewhere that it is possible to rebuild your own Jboss AS 6.0 and replace jbossweb.sar  using some source from jboss-web-2.1.9.GA.  Just can't find a reference for this though.  If someone could share some link to references that I can follow kindly post them here.   Thanks.

                  • 6. Re: JspC for JBoss 6 M4
                    huggivig Newbie

                    The error is link to struts tld file. I just add <bodycontent>JSP</bodycontent> (default value according to http://download.oracle.com/javaee/6/api/javax/servlet/jsp/tagext/TagInfo.html) for tags which haven't got one, and it's works !

                    • 7. Re: JspC for JBoss 6 M4
                      Aaron Harshbarger Newbie

                      Anyone know if the JspC class is going to be put back into JBoss 6 or if there is a replacment that should be used instead to precompile JSPs?   It looks like JBoss 6.0 CR1 still doesn't have it yet.

                      • 8. Re: JspC for JBoss 6 M4
                        Jean-Frederic Clere Master

                        In J2EE 6 it is _very_ hard to precompile JSP. So there isn't going to be a JspC for AS6+

                        • 9. Re: JspC for JBoss 6 M4
                          Lukas Meier Newbie

                          We are using JBoss AS 6.0.0.Final and maven, and I spent many many hours of searching and experimenting to get the JSPs precompiled. Finally I found a way that seems to work for me, so I thought I would share.

                          The trick is to use jspc-maven-plugin, tell it to use jspc-compiler-tomcat6, but then exclude the Tomcat 6 JSP compiler and JEE5 API dependencies, and add the Tomcat 7 JSP compiler instead.

                          I seem to be lucky, since the generated Java classes reference a few  org.apache.jasper.runtime.* classes as well as org.apache.tomcat.InstanceManager, but these all seem to be compatible between jbossweb-3.0.0-CR1 (which I believe is the version included in JBoss AS 6.0.0.Final) and tomcat-7.0.12:

                           

                            org.apache.jasper.runtime.HttpJspBase
                            org.apache.jasper.runtime.JspSourceDependent
                            org.apache.jasper.runtime.PageContextImpl
                            org.apache.jasper.runtime.ProtectedFunctionMapper
                            org.apache.jasper.runtime.TagHandlerPool
                            org.apache.jasper.runtime.InstanceManagerFactory
                            org.apache.jasper.runtime.JspRuntimeLibrary
                            org.apache.tomcat.InstanceManager
                          

                           

                           

                          Here is an extract of my pom.xml:

                           

                                      <plugin>
                                        <groupId>org.codehaus.mojo.jspc</groupId>
                                        <artifactId>jspc-maven-plugin</artifactId>
                                        <version>2.0-alpha-3</version>
                                        <executions>
                                          <execution>
                                            <goals>
                                              <goal>compile</goal>
                                            </goals>
                                          </execution>
                                        </executions>
                                        <!-- Use the Tomcat 6 JSP compiler plugin 
                                          (no Tomcat 7 or JBoss 6 compiler plugin yet) -->
                                        <dependencies>
                                          <dependency>
                                            <groupId>org.codehaus.mojo.jspc</groupId>
                                            <artifactId>jspc-compiler-tomcat6</artifactId>
                                            <version>2.0-alpha-3</version>
                                            <!-- Exclude Tomcat 6 JSP compiler and JEE5 API -->
                                            <exclusions>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>jasper</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>jasper-el</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>jasper-jdt</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>servlet-api</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>jsp-api</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>el-api</artifactId>
                                              </exclusion>
                                              <exclusion>
                                                <groupId>org.apache.tomcat</groupId>
                                                <artifactId>annotations-api</artifactId>
                                              </exclusion>
                                            </exclusions>
                                          </dependency>
                                          <!-- Add Tomcat 7 JSP compiler -->
                                          <dependency>
                                            <groupId>org.apache.tomcat</groupId>
                                            <artifactId>tomcat-jasper</artifactId>
                                            <version>7.0.12</version>
                                          </dependency>
                                          <!-- Override ecj version, since newer not yet on maven central -->
                                          <dependency>
                                            <groupId>org.eclipse.jdt.core.compiler</groupId>
                                            <artifactId>ecj</artifactId>
                                            <version>3.5.1</version>
                                          </dependency>
                                        </dependencies>
                                      </plugin>
                          

                           

                          @Jean-Frederic Clere: Why do you say "In J2EE 6 it is very hard to precompile JSP"?

                          • 10. Re: JspC for JBoss 6 M4
                            kkumarc Newbie

                            I tried the method described in this thread, but i am not successful.

                             

                            I am trying to port a struts based application from Tomcat 6 to Tomcat 7.

                             

                            I am getting the following error while running the application

                            java.lang.ClassNotFoundException: org.apache.AnnotationProcessor

                            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)

                            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)

                            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                            at java.lang.Class.getDeclaredFields0(Native Method)

                            at java.lang.Class.privateGetDeclaredFields(Class.java:2291)

                            at java.lang.Class.getDeclaredFields(Class.java:1743)

                             

                            regards

                            krishna

                            • 11. Re: JspC for JBoss 6 M4
                              Lukas Meier Newbie

                              Hi Krishna, your problem looks to me more like the "Struts embedded JSP plugin does not work with Tomcat 7" issue, see https://issues.apache.org/jira/browse/WW-3627 and  thread http://struts.1045723.n5.nabble.com/Tomcat-7-org-apache-AnnotationProcessor-tp3542535p3542535.html

                              • 12. Re: JspC for JBoss 6 M4
                                kkumarc Newbie

                                Yeah i have posted there also asking Lee about the compiler used for pre-compiling JSPs.

                                regards

                                krishna

                                • 13. Re: JspC for JBoss 6 M4
                                  Ram J Newbie

                                  Hi Jean,

                                   

                                  Colud provide me some details are a link, that explains more about hardness in J2ee 6 precompilation. I am trying to pre-compile the code in JBOSS as 7.1. But i did get a good article to do that and even i did not find org.apache.jasper.Jspc class in jbossweb-7.0.*.jar.

                                   

                                  Please help me..

                                  • 14. Re: JspC for JBoss 6 M4
                                    Jean-Frederic Clere Master

                                    Jspc is not supported in AS7.

                                    1 2 3 Previous Next