You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thibaut Nicolas <th...@yahoo.fr> on 2006/02/20 15:32:30 UTC

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(JspServletWrapper.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(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:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JSP compilation error in Tomcat 5.5 using type Vector

Posted by Glen Mazza <gr...@verizon.net>.
Thibaut Nicolas wrote:

>>> 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


>>>
>>> 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 ?
>>>

http://tinyurl.com/n9k75?  For the Vector object you're using, it is 
possible that the JDT compiler is not 1.5-compliant; so you may need to 
use javac instead, or consider using other data structures to accomplish 
what you want.

Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JSP compilation error in Tomcat 5.5 using type Vector

Posted by Thibaut Nicolas <th...@yahoo.fr>.
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:thibaut_nicolas_pro@yahoo.fr] 
>>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: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: JSP compilation error in Tomcat 5.5 using type Vector

Posted by Michael Andreas Omerou <ma...@simplexsoftware.com>.
 Can we have the code that causes this error?

>-----Original Message-----
>From: Thibaut Nicolas [mailto:thibaut_nicolas_pro@yahoo.fr] 
>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: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org