6 Replies Latest reply: Mar 10, 2008 9:48 AM by 807581 RSS

    Help for Apache-Tomcat - JSP error

    807581
      I am new for Tomcat. I installed jdk1.5.0_09 and Tomcat5.5.20 on Windows 2003 Server. I would like to connect Tomcat to database. I was able to see the log in page. However, I got an error below when I tried logon.

      Any help would be greatly appreciated!

      org.apache.catalina.authenticator.FormAuthenticator forwardToErrorPage

      WARNING: Unexpected error forwarding to error page

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

      Generated servlet error:

      The type Collection is not generic; it cannot be parameterized with arguments <? extends E>

      at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.apache.catalina.authenticator.FormAuthenticator.forwardToErrorPage(FormAuthenticator.java:336)
      at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:259)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
      at java.lang.Thread.run(Thread.java:595)

      Message was edited by:
      TomDog-1

      Message was edited by:
      TomDog-1
        • 1. Re: Help for Apache-Tomcat - JSP error
          807581
          Hi I am having similar, installed tomcat 5.5.20 with JDK 1.5 and have a similar error ...

          any help appreciated:

          SEVERE: Servlet.service() for servlet jsp threw exception
          org.apache.jasper.JasperException: Unable to compile class for JSP

          An error occurred at line: 179 in the jsp file: /content/articles.jsp
          Generated servlet error:
          The type Comparable is not generic; it cannot be parameterized with arguments <? super T>


          at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
          at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
          at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
          at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          at org.apache.jsp.splash_jsp._jspService(splash_jsp.java:119)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          at org.apache.jsp.index_jsp._jspService(index_jsp.java:348)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
          • 2. Re: Help for Apache-Tomcat - JSP error
            807581
            I am having the same problem as well. I have narrowed it down to the static include directive below:
            <%@ include file="/includes/pages/pageheader.jspf"%>
            This generates the following collection code in the enclosing JSP page:
              private static java.util.List _jspx_dependants;
            
              static {
                _jspx_dependants = new java.util.ArrayList(1);
                _jspx_dependants.add("/includes/pages/pageheader.jspf");
              }
            Now, if I remove the include, I lose my common page heading, but my page compiles. If I cut and paste the code directly into the JSP page, it works. Because the heading requires the request.getContextPath() to locate some image files, I can't use a <jsp:include ... /> command instead.

            Anyone have any thoughts on how to make the included fragment work as an includes?
            • 3. Re: Help for Apache-Tomcat - JSP error
              807581
              Okay, I have a work-around. I am using Java 1.5 with a Tomcat 5.5.20 server. What I need to do is get the JSP compiler to treat the code as Java 1.4, taking the whole question of generics off the table. I could do any of the following:

              * Use Java 1.4 throughout the project
              * Upgrade to Tomcat 5.5.23 or Tomcat 6.0, which may or may not fix the problem -- I am testing this in the future
              * Instruct Tomcat to treat the source to the JSP page as Java 1.4

              I tried the last method by adding the following code to the servlet JSP information in the server's web.xml file.
                  <init-param>
                    <param-name>compilerTargetVM</param-name>
                    <param-value>1.5</param-value>
                  </init-param>
                  <init-param>
                    <param-name>compilerSourceVM</param-name>
                    <param-value>1.4</param-value>
                  </init-param>
              This gives a complete entry of:
                <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>
                  <init-param>
                    <param-name>mappedfile</param-name>
                    <param-value>true</param-value>
                  </init-param>
                  <init-param>
                    <param-name>compilerTargetVM</param-name>
                    <param-value>1.5</param-value>
                  </init-param>
                  <init-param>
                    <param-name>compilerSourceVM</param-name>
                    <param-value>1.4</param-value>
                  </init-param>
                  <load-on-startup>3</load-on-startup>
                </servlet>
              I hope this can help you.
              • 4. Re: Help for Apache-Tomcat - JSP error
                807581
                With Tomcat version 5.5.23, this edit is not necessary. The web.xml will work "right out of the box."
                • 5. Re: Help for Apache-Tomcat - JSP error
                  807581
                  Okay, we are renaming this forum to be Steve just posts to himself.

                  I upgraded my project with Java 1.6 and Tomcat 6.0.14, and I started getting the the JSP error message again. I did some deeper analysis, and I discovered that removing a set of jar files made the message go away.

                  I am working with a project that used the old Criptix.org jars to handle the encryption and decryption of security data. When I pulled the jars, everything was kol beseder. These jars were used by static routines, so the problem appeared as soon as the first web page using the routines loaded. I rewrote the routines using the now standard javax.crypto classes, and my web site is working fine.

                  So, if you get the message similar to the one TomDog-1 received, look for older jars in your application as well as code problems.
                  • 6. Re: Help for Apache-Tomcat - JSP error
                    807581
                    Thanks for finding this solution!!! I spent almost 2 days trying to find a solution before I stumbled on this post.

                    I had the same problem, and your solution worked.

                    I was getting JasperExceptions and the jsp was throwing compiler errors when trying to compile any jsp that used java 1.5 features, particularly generics. Removing the cryptix jars solved the problem.

                    I am building with Maven and the cryptix jars were only included because they were a dependency of another jar. Luckily, I don't require any of cryptix functionality from that jar, so I was able to simply exclude the jar's from my war.
                    <plugin>
                         <artifactId>maven-war-plugin</artifactId>
                              <configuration>               
                                   <warSourceExcludes>WEB-INF/lib/cryptix*.jar</warSourceExcludes>
                              </configuration>
                    </plugin>