Of course,
Here is the very simple JSP that have written to isolate the error

<%@ page language="java" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Iterator" %>
<%
Vector v = new Vector();
v.add("Hello");
v.add("World");
%>
<html>
<body>
<%
Iterator it = v.iterator();
while (it.hasNext()) {
        %>
        <%=it.next() %>
        <%
}
%>
</body>
</html>


Thibaut



Michael Andreas Omerou a écrit :
 Can we have the code that causes this error?


-----Original Message-----
From: Thibaut Nicolas [mailto:[EMAIL PROTECTED] Sent: 20 February 2006 16:33
To: users@tomcat.apache.org
Subject: JSP compilation error in Tomcat 5.5 using type Vector

Hi all,

I have a problem while trying to migrate an application from Tomcat 4.1 to Tomcat 5.5.
I get a JasperException when tomcat try to compile a JSP :
The method add(String) is undefined for the type Vector The method iterator() is undefined for the type Vector I've put the complete trace at the end of the message.

I'm using tomcat 5.5.15. I've tried with 2 version of Java (JAVA_HOME set to 1.5.0_06 or 1.4.2_04 (with compat package)).
I've also tried on 2 different platforms : solaris and linux.
The problem is always the same. It seems that the compiler is trying to compile the generated java file with a java 1.1 compatibility.
I've read in the documentation that the JDT compiler should work with a
1.4 compatibility by default (I've tried to set the servlet init parameters compilerSourceVM and compilerTargetVM without success).

I've found a workaround that consist in using javac compiler instead of JDT compiler but I'd prefer using JDT compiler.

Can someone help me and tell me what I'm doing wrong ?

Thanks in advance

Thibaut




exception

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

An error occurred at line: 4 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method add(String) is undefined for the type Vector

An error occurred at line: 4 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method add(String) is undefined for the type Vector

An error occurred at line: 11 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method iterator() is undefined for the type Vector


org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletW
rapper.java:375)
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:802)


root cause

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

An error occurred at line: 4 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method add(String) is undefined for the type Vector

An error occurred at line: 4 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method add(String) is undefined for the type Vector

An error occurred at line: 11 in the jsp file: /jsp/Test.jsp Generated servlet error:
The method iterator() is undefined for the type Vector


org.apache.jasper.compiler.DefaultErrorHandler.javacError(Defau
ltErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDisp
atcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompile
r.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationC
ontext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletW
rapper.java:303)
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:802)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to