You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kris Gemborys <ma...@comcast.net> on 2003/11/20 22:08:21 UTC

How jasper determines when to use default package org.apache.jsp when translating jsps to servlets?

Tomcat 4.1/Windows XP

I am working on the ant script that should precompile all jsp pages
for a given web application. I used build.xml from Tomcat documentation 
as starting point. After running ant I found that some of the translated 
and compiled jsp pages are not working.

For some reason when the jsp pages are translated/compiled by 
tomcat/jasper runtime the generated servlets sometimes contain package 
statement set to the default package like:
package org.apache.jsp;

and sometimes the generated servlet's package statement is determined 
based on the physical location of the jsp page in the web application tree.

The build.xml I created always updates generated servlets with the
package statement based on the jsp location in the web application 
directory tree.

Ex.

For the jsp located in <webapp>/agentHome the build.xml outputs package 
statement

package agentHome;

which causes exception

javax.servlet.ServletException: org/apache/jsp/nbpDefault_jsp (wrong
name: layouts/nbpDefault_jsp)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher=
.java:684)
……



If the package statement is replaced with

package org.apache.java;

Everything works.

Any suggestions?


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


Re: How jasper determines when to use default package org.apache.jsp when translating jsps to servlets?

Posted by Kris Gemborys <ma...@comcast.net>.
Christopher Schultz wrote:

> Kris,
>
>> After running ant I found that some of the translated and compiled 
>> jsp pages are not working.
>
>
>> The build.xml I created always updates generated servlets with the
>> package statement based on the jsp location in the web application 
>> directory tree.
>
>
> Why are you fiddling with the package statements in generated servlets 
> from JSPs?
>
> -chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
I want  to create the script that precompiles jsp pages after they are 
deployed to the Tomcat server so there is no first time hit penalty. I 
want to accomplish similar behavior as with Websphere deployment where 
you can select option to compile all jsp pages at the time of EAR/WAR 
deployment.


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


Re: How jasper determines when to use default package org.apache.jsp when translating jsps to servlets?

Posted by Christopher Schultz <ch...@comcast.net>.
Kris,
> After running ant I found that some of the translated 
> and compiled jsp pages are not working.

> The build.xml I created always updates generated servlets with the
> package statement based on the jsp location in the web application 
> directory tree.

Why are you fiddling with the package statements in generated servlets 
from JSPs?

-chris


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


Re: How jasper determines when to use default package org.apache.jsp when translating jsps to servlets?

Posted by Kris Gemborys <ma...@comcast.net>.
thanks, that solved the problem.


Justin Ruthenbeck wrote:

>
> Filip Hanik has posted a build script that does a deployment-time 
> compilation of all JSP files in an app -- sounds like what you're 
> looking for. I haven't used it, but it's a pretty common request on 
> the list and it seems his solution has worked well for people.
>
> You can check it out here:
> http://cvs.apache.org/~fhanik/precompile.html
>
> justin
>
>
> At 01:08 PM 11/20/2003, you wrote:
>
>> Tomcat 4.1/Windows XP
>>
>> I am working on the ant script that should precompile all jsp pages
>> for a given web application. I used build.xml from Tomcat 
>> documentation as starting point. After running ant I found that some 
>> of the translated and compiled jsp pages are not working.
>>
>> For some reason when the jsp pages are translated/compiled by 
>> tomcat/jasper runtime the generated servlets sometimes contain 
>> package statement set to the default package like:
>> package org.apache.jsp;
>>
>> and sometimes the generated servlet's package statement is determined 
>> based on the physical location of the jsp page in the web application 
>> tree.
>>
>> The build.xml I created always updates generated servlets with the
>> package statement based on the jsp location in the web application 
>> directory tree.
>>
>> Ex.
>>
>> For the jsp located in <webapp>/agentHome the build.xml outputs 
>> package statement
>>
>> package agentHome;
>>
>> which causes exception
>>
>> javax.servlet.ServletException: org/apache/jsp/nbpDefault_jsp (wrong
>> name: layouts/nbpDefault_jsp)
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher=
>> .java:684)
>> ……
>>
>>
>>
>> If the package statement is replaced with
>>
>> package org.apache.java;
>>
>> Everything works.
>>
>> Any suggestions?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
> ______________________________________________
> Justin Ruthenbeck
> Software Engineer, NextEngine Inc.
> justinr - AT - nextengine DOT com
> Confidential. See:
> http://www.nextengine.com/confidentiality.php
> ______________________________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



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


Re: How jasper determines when to use default package org.apache.jsp when translating jsps to servlets?

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
Filip Hanik has posted a build script that does a deployment-time 
compilation of all JSP files in an app -- sounds like what you're looking 
for.  I haven't used it, but it's a pretty common request on the list and 
it seems his solution has worked well for people.

You can check it out here:
http://cvs.apache.org/~fhanik/precompile.html

justin


At 01:08 PM 11/20/2003, you wrote:
>Tomcat 4.1/Windows XP
>
>I am working on the ant script that should precompile all jsp pages
>for a given web application. I used build.xml from Tomcat documentation 
>as starting point. After running ant I found that some of the translated 
>and compiled jsp pages are not working.
>
>For some reason when the jsp pages are translated/compiled by 
>tomcat/jasper runtime the generated servlets sometimes contain package 
>statement set to the default package like:
>package org.apache.jsp;
>
>and sometimes the generated servlet's package statement is determined 
>based on the physical location of the jsp page in the web application tree.
>
>The build.xml I created always updates generated servlets with the
>package statement based on the jsp location in the web application 
>directory tree.
>
>Ex.
>
>For the jsp located in <webapp>/agentHome the build.xml outputs package 
>statement
>
>package agentHome;
>
>which causes exception
>
>javax.servlet.ServletException: org/apache/jsp/nbpDefault_jsp (wrong
>name: layouts/nbpDefault_jsp)
>at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>at
>org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher=
>.java:684)
>……
>
>
>
>If the package statement is replaced with
>
>package org.apache.java;
>
>Everything works.
>
>Any suggestions?
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


______________________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
justinr - AT - nextengine DOT com
Confidential. See:
http://www.nextengine.com/confidentiality.php
______________________________________________


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