10 Replies Latest reply on May 1, 2007 3:17 PM by mpelzsherman

    java 5.0 features in JSP problem

    mathias

      Hello,

      I am running 4.0.4RC1 on Fedora with java 1.5.0_06, and the EJB3 install.

      I have an EJB-method that returns a List and a JSP that does
      ist users= feed.getLastLogins();

      I can compile and build fine, but when i deploy and try to call the JSP, i get the following trace:


      org.apache.jasper.JasperException: Unable to compile class for JSP

      An error occurred at line: 19 in the jsp file: /testejb.jsp
      Generated servlet error:
      The type List is not generic; it cannot be parameterized with arguments

      An error occurred at line: 19 in the jsp file: /testejb.jsp
      Generated servlet error:
      Syntax error, parameterized types are only available if source level is 5.0


      org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
      org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)



      I can't see why this is the case, to me it should work... Do i need to configure something differently, or is this a bug?

      As always grateful for pointers. Thanks,

      /Mathias af Jochick

        • 1. Re: java 5.0 features in JSP problem
          mathias

          sorry the text got mashed up a bit due to special characters...

          The EJB-method returns a

          List and the JSP tries to do this:

          List users= feed.getLastLogins();

          • 2. Re: java 5.0 features in JSP problem
            mathias

            I think you get the problem, it's the 5.0-feature parameterized types i can't get to work in my JSp page.... :)

            List users= feed.getLastLogins();

            Sorry for the escape-char messup, still hope someone can help!

            • 3. Re: java 5.0 features in JSP problem
              mathias

              Hmmm, noone has any insights to share?? How depressing...

              • 4. Re: java 5.0 features in JSP problem
                j2ee_junkie

                Mathias,

                What is the signature of the EJB interface method getLastLogins()?

                cgriffith

                • 5. Re: java 5.0 features in JSP problem

                  The errors above says that the your JSP is compiled with a JDK version older than 5.0. it is a known Tomcat5.5 problem.

                  to solve it you need to:
                  1. delete ${jboss.root}/server/default/deploy/jbossweb-tomcat55.sar/jasper-compiler-jdt.jar

                  2. copy ant.jar (from the latest ant release or any ant later than 1.5) to the jbossweb-tomcat55.sar directory

                  3. edit jbossweb-tomcat55.sar/conf/web.xml and add the following to the JspServlet entry:

                  <init-param>
                   <param-name>compilerSourceVM</param-name>
                   <param-value>1.5</param-value>
                  </init-param>
                  <init-param>
                   <param-name>compilerTargetVM</param-name>
                   <param-value>1.5</param-value>
                  </init-param>


                  • 6. Re: java 5.0 features in JSP problem
                    starksm64

                    Or use the 4.0.4.CR2+ release and enable jdk5 support by uncommenting the jbossweb-tomcat55.sar/conf/web.xml compilerSourceVM param:

                     <servlet>
                     <servlet-name>jsp</servlet-name>
                     <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
                     <init-param>
                     <param-name>fork</param-name>
                     <param-value>false</param-value>
                     </init-param>
                     <init-param>
                     <param-name>xpoweredBy</param-name>
                     <param-value>false</param-value>
                     </init-param>
                     <!-- Uncomment to use jdk1.5 features in jsp pages
                     -->
                     <init-param>
                     <param-name>compilerSourceVM</param-name>
                     <param-value>1.5</param-value>
                     </init-param>
                     <!-- Use a custom options class to allow the shared tag lib descriptors
                     to be loaded from jars in the tomcat sar conf/tlds directory. The
                     standard options implementation can only find taglibs based on the
                     class loader classpath.
                     -->
                     <init-param>
                     <param-name>engineOptionsClass</param-name>
                     <param-value>org.jboss.web.tomcat.tc5.jasper.JspServletOptions</param-value>
                     </init-param>
                     <!-- Specify the jars relative to the jbossweb-tomcat55.sar that should
                     be scanned for common tag lib descriptors to include in every war
                     deployment.
                     -->
                     <init-param>
                     <description>MyFaces tlds</description>
                     <param-name>tagLibJar0</param-name>
                     <param-value>jsf-libs/myfaces-impl.jar</param-value>
                     </init-param>
                    
                     <load-on-startup>3</load-on-startup>
                     </servlet>
                    



                    • 7. Re: java 5.0 features in JSP problem
                      mpelzsherman

                      Is this an issue in any of the later releases of jboss?

                      • 8. Re: java 5.0 features in JSP problem
                        dparrilla

                        I had the same issue in JBOSS 404GA. And setting the compilerSourceVM parameter did work.

                        • 9. Re: java 5.0 features in JSP problem
                          jfclere

                          try to add compiler = javac in the JspServlet parameters.

                          • 10. Re: java 5.0 features in JSP problem
                            mpelzsherman

                            FWIW: in 4.0.5, it's necessary to both uncomment the compilerSourceVM setting AND ADD the following:

                            <init-param>
                            <param-name>compilerTargetVM</param-name>
                            <param-value>1.5</param-value>
                            </init-param>