Help for Apache-Tomcat - JSP error

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(JspServletWrappe r.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(ApplicationFil terChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:173)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.jav a:672)

at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispat cher.java:463)

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher. java:398)

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.ja va:301)

at org.apache.catalina.authenticator.FormAuthenticator.forwardToErrorPage(FormAuth enticator.java:336)

at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthentica tor.java:259)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja va: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:10 7)

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(Http 11AprProtocol.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

[2714 byte] By [TomDog-1] at [2007-11-26 10:59:21]
# 1

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.j ava: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(ApplicationFil terChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:173)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.jav a:672)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher. java:574)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.ja va: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(ApplicationFil terChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:173)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.jav a:672)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher. java:574)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.ja va: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)

kurtWT at 2007-7-7 3:12:57 > top of Java-index,Application & Integration Servers,Application Servers...
# 2

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?

sgelman at 2007-7-7 3:12:57 > top of Java-index,Application & Integration Servers,Application Servers...
# 3

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.

sgelman at 2007-7-7 3:12:57 > top of Java-index,Application & Integration Servers,Application Servers...
# 4
With Tomcat version 5.5.23, this edit is not necessary. The web.xml will work "right out of the box."
sgelman at 2007-7-7 3:12:57 > top of Java-index,Application & Integration Servers,Application Servers...