You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by 文宝殷 <su...@gmail.com> on 2011/04/06 09:28:40 UTC

jsp compile error(The primitive type int of does not have a field javax)

Hi,

Is there anyone met this kind of error.  please see the error stack below.

very tricky,it doesn't always happen, we met it seldom after our server run
for a period.
and the red section is not confused, i don't know what's the meaning
exactly.
i've looked into the generated java file, the lines error stack mentioned
are just writing "\r\n".

tomcat version:6.0.26, JVM version:1.6.

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

An error occurred at line: 114 in the generated java file
The primitive type int of  does not have a field javax

An error occurred at line: 133 in the generated java file
The primitive type int of  does not have a field javax

An error occurred at line: 152 in the generated java file
The primitive type int of  does not have a field javax

An error occurred at line: 171 in the generated java file
The primitive type int of  does not have a field javax

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:296)

org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:161)

org.apache.jsp.master_jsp._jspx_meth_c_005fimport_005f0(master_jsp.java:1382)
    org.apache.jsp.master_jsp._jspService(master_jsp.java:256)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)*

Re: jsp compile error(The primitive type int of does not have a field javax)

Posted by Mark Thomas <ma...@apache.org>.
On 06/04/2011 10:47, André Warnier wrote:
> Hello 文宝殷,
> 
> As I failed to mention before, I am not really a java or JSP expert, so I was just guessing.
> The error messages which you are getting seem to suggest that the generated Java code
> (before compilation) contains some line breaks or other confusing characters where the
> compiler is not expecting them, and it is taking one of the "import" statements (like
> "import javax.servlet.http.HttpServletRequest;") as an attribute of a variable named "".
> It is all quite bizarre, and made me think that the problem may be linked to a character
> set issue or a wrong line-ending.
> 
> Maybe there is an option to the JSP interpreter where you can actually ask to see the
> generated java code before compilation ?

Tomcat makes the java file available by default in the work directory.

Mark

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


Re: jsp compile error(The primitive type int of does not have a field javax)

Posted by André Warnier <aw...@ice-sa.com>.
Hello 文宝殷,

As I failed to mention before, I am not really a java or JSP expert, so I was just guessing.
The error messages which you are getting seem to suggest that the generated Java code
(before compilation) contains some line breaks or other confusing characters where the
compiler is not expecting them, and it is taking one of the "import" statements (like
"import javax.servlet.http.HttpServletRequest;") as an attribute of a variable named "".
It is all quite bizarre, and made me think that the problem may be linked to a character
set issue or a wrong line-ending.

Maybe there is an option to the JSP interpreter where you can actually ask to see the
generated java code before compilation ?

But let's see what the experts have to say..



文宝殷 wrote:
> Hi André Warnier,
> 
> thanks for your reply.
> it's a runtime error, jsp compiler generate the java file then compile it to
> class.
> i didn't the copy the java file between different systems.my system is
> linux.
> 
> could the jsp compiler cause this error? the default one is the JDT.
> 
> Best Regards
> Bryan
> 
> 
> 2011/4/6 André Warnier <aw...@ice-sa.com>
> 
>> Hi,
>>
>> Honestly, I don't really know, and this is just a vague suspicion.
>> But if the original JSP pages are on a Windows PC, and then you are copying
>> them to a Unix/Linux server to run them, can the problem not be due to wrong
>> line endings ?
>> (Windows uses CR/LF, but Unix/Linux only LF).
>>
>>
>>
>> 文宝殷 wrote:
>>
>>> Hi,
>>>
>>> Is there anyone met this kind of error.  please see the error stack below.
>>>
>>> very tricky,it doesn't always happen, we met it seldom after our server
>>> run
>>> for a period.
>>> and the red section is not confused, i don't know what's the meaning
>>> exactly.
>>> i've looked into the generated java file, the lines error stack mentioned
>>> are just writing "\r\n".
>>>
>>> tomcat version:6.0.26, JVM version:1.6.
>>>
>>> *org.apache.jasper.JasperException: Unable to compile class for JSP:
>>>
>>> An error occurred at line: 114 in the generated java file
>>> The primitive type int of  does not have a field javax
>>>
>>> An error occurred at line: 133 in the generated java file
>>> The primitive type int of  does not have a field javax
>>>
>>> An error occurred at line: 152 in the generated java file
>>> The primitive type int of  does not have a field javax
>>>
>>> An error occurred at line: 171 in the generated java file
>>> The primitive type int of  does not have a field javax
>>>
>>> Stacktrace:
>>>
>>>
>>> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
>>>
>>>
>>> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
>>>
>>> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
>>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
>>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
>>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
>>>
>>>
>>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
>>>
>>>
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>>>
>>>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>
>>>
>>> org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:296)
>>>
>>>
>>> org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:161)
>>>
>>>
>>> org.apache.jsp.master_jsp._jspx_meth_c_005fimport_005f0(master_jsp.java:1382)
>>>    org.apache.jsp.master_jsp._jspService(master_jsp.java:256)
>>>    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>
>>>
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>>
>>>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)*
>>>
>>>
>> ---------------------------------------------------------------------
>> 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 compile error(The primitive type int of does not have a field javax)

Posted by 文宝殷 <su...@gmail.com>.
Hi André Warnier,

thanks for your reply.
it's a runtime error, jsp compiler generate the java file then compile it to
class.
i didn't the copy the java file between different systems.my system is
linux.

could the jsp compiler cause this error? the default one is the JDT.

Best Regards
Bryan


2011/4/6 André Warnier <aw...@ice-sa.com>

> Hi,
>
> Honestly, I don't really know, and this is just a vague suspicion.
> But if the original JSP pages are on a Windows PC, and then you are copying
> them to a Unix/Linux server to run them, can the problem not be due to wrong
> line endings ?
> (Windows uses CR/LF, but Unix/Linux only LF).
>
>
>
> 文宝殷 wrote:
>
>> Hi,
>>
>> Is there anyone met this kind of error.  please see the error stack below.
>>
>> very tricky,it doesn't always happen, we met it seldom after our server
>> run
>> for a period.
>> and the red section is not confused, i don't know what's the meaning
>> exactly.
>> i've looked into the generated java file, the lines error stack mentioned
>> are just writing "\r\n".
>>
>> tomcat version:6.0.26, JVM version:1.6.
>>
>> *org.apache.jasper.JasperException: Unable to compile class for JSP:
>>
>> An error occurred at line: 114 in the generated java file
>> The primitive type int of  does not have a field javax
>>
>> An error occurred at line: 133 in the generated java file
>> The primitive type int of  does not have a field javax
>>
>> An error occurred at line: 152 in the generated java file
>> The primitive type int of  does not have a field javax
>>
>> An error occurred at line: 171 in the generated java file
>> The primitive type int of  does not have a field javax
>>
>> Stacktrace:
>>
>>
>> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
>>
>>
>> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
>>
>> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
>>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
>>
>>
>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>>
>>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>
>>
>> org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:296)
>>
>>
>> org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:161)
>>
>>
>> org.apache.jsp.master_jsp._jspx_meth_c_005fimport_005f0(master_jsp.java:1382)
>>    org.apache.jsp.master_jsp._jspService(master_jsp.java:256)
>>    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>
>>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)*
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: jsp compile error(The primitive type int of does not have a field javax)

Posted by André Warnier <aw...@ice-sa.com>.
Hi,

Honestly, I don't really know, and this is just a vague suspicion.
But if the original JSP pages are on a Windows PC, and then you are copying them to a 
Unix/Linux server to run them, can the problem not be due to wrong line endings ?
(Windows uses CR/LF, but Unix/Linux only LF).



文宝殷 wrote:
> Hi,
> 
> Is there anyone met this kind of error.  please see the error stack below.
> 
> very tricky,it doesn't always happen, we met it seldom after our server run
> for a period.
> and the red section is not confused, i don't know what's the meaning
> exactly.
> i've looked into the generated java file, the lines error stack mentioned
> are just writing "\r\n".
> 
> tomcat version:6.0.26, JVM version:1.6.
> 
> *org.apache.jasper.JasperException: Unable to compile class for JSP:
> 
> An error occurred at line: 114 in the generated java file
> The primitive type int of  does not have a field javax
> 
> An error occurred at line: 133 in the generated java file
> The primitive type int of  does not have a field javax
> 
> An error occurred at line: 152 in the generated java file
> The primitive type int of  does not have a field javax
> 
> An error occurred at line: 171 in the generated java file
> The primitive type int of  does not have a field javax
> 
> Stacktrace:
> 
> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
> 
> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
> 
> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
> 
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 
> org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:296)
> 
> org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:161)
> 
> org.apache.jsp.master_jsp._jspx_meth_c_005fimport_005f0(master_jsp.java:1382)
>     org.apache.jsp.master_jsp._jspService(master_jsp.java:256)
>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)*
> 


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