You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jason Palmatier <co...@yahoo.com> on 2004/06/02 23:31:44 UTC

404 Error when accessing pre-compiled JSPs

Hello everyone,

I am attempting to deploy pre-compiled jsps in Tomcat
4.1.18 (I can't upgrade, I'm stuck with 4.1.18).  I've
searched the archive extensively and found that I am
doing all the things suggested, but I still cannot
seem to find any of my web pages.  I'm wondering if
any of my steps are wrong and I'm just missing
something.  This is what I've accomplished so far:

1. Used JSPC to precompile all my jsp's and include
their subdirectory in their package statements (i.e.
if a jsp exist in myApp/myDir I create a package
statement of "package com.mycompany.myApp.myDir;" for
that jsp.

2. I compile the generated .java file into a class
file.  I make the output directory for the compile my
WEB-INF/classes directory so the javac command takes
care of creating all the subdirectories based on the
package statement of each .java file.

3. I copy the contents of the generated web.xml
fragments, merge them into one file (with proper
ordering, servlet declarations first, servlet mapping
after them, etc.) and then merge this into my existing
web.xml file.

4. I then remove all my .jsp files, wipe out
everything under my work/Standalone/localhost
directory, and restart Tomcat.

When I try to access my first page
(http://myserver:8080/pt/logon.jsp) I get a 404:
Requested resource is not available.

Here are a few things I've noticed and have questions
about:

1. In my servlet declaration statement can I name my
servlet the same as the class name?  i.e. if my jsp
compiles to
com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
can my servlet declaration look like this:

<servlet>
<servlet-name>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
</servlet-name>
<servlet-class>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
</servlet-class>
</servlet>

2. Just to make sure (since I know all the examples
show this already), you DO NOT want to include your
applications name in the url-pattern of a servlet
mapping, correct?  In other words, if my application
is under webapps/myApp then I want my servlet map to
say:

<servlet-mapping>
<servlet-name>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
</servlet-name>
<url-pattern>/subDir/anotherSubDir/myclass.jsp</url-pattern>
</servlet-mapping>

NOT

<servlet-mapping>
<servlet-name>com.mycompany.subDir.anotherSubDir.myclass_jsp
</servlet-name>
<url-pattern>/myApp/subDir/anotherSubDir/myclass.jsp</url-pattern>
</servlet-mapping>

I feel like I'm really close to getting this running,
so this last stuff is very frustrating.  Any help
would be greatly appreciated.

Thanks,
Jason


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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


Re: 404 Error when accessing pre-compiled JSPs

Posted by Jason Palmatier <co...@yahoo.com>.
Ah ha!

As it turns out, the </web-app> end tag in my web.xml
file got chopped off during the merge of web.xml
fragments.  I put this back on and everything seems to
work... except one thing:

We have some JSP files that get autogenerated by a
development tool we're using.  Most of these JSPs
compile fine, but there are a number that end up as
zero length .java files after compiling them with
jspc.  Is there any reason why jspc might create 
empty .java files for what look to be relatively
simple, but correct, .jsp files?


--- Jason Palmatier <co...@yahoo.com> wrote:
> Hello everyone,
> 
> I am attempting to deploy pre-compiled jsps in
> Tomcat
> 4.1.18 (I can't upgrade, I'm stuck with 4.1.18). 
> I've
> searched the archive extensively and found that I am
> doing all the things suggested, but I still cannot
> seem to find any of my web pages.  I'm wondering if
> any of my steps are wrong and I'm just missing
> something.  This is what I've accomplished so far:
> 
> 1. Used JSPC to precompile all my jsp's and include
> their subdirectory in their package statements (i.e.
> if a jsp exist in myApp/myDir I create a package
> statement of "package com.mycompany.myApp.myDir;"
> for
> that jsp.
> 
> 2. I compile the generated .java file into a class
> file.  I make the output directory for the compile
> my
> WEB-INF/classes directory so the javac command takes
> care of creating all the subdirectories based on the
> package statement of each .java file.
> 
> 3. I copy the contents of the generated web.xml
> fragments, merge them into one file (with proper
> ordering, servlet declarations first, servlet
> mapping
> after them, etc.) and then merge this into my
> existing
> web.xml file.
> 
> 4. I then remove all my .jsp files, wipe out
> everything under my work/Standalone/localhost
> directory, and restart Tomcat.
> 
> When I try to access my first page
> (http://myserver:8080/pt/logon.jsp) I get a 404:
> Requested resource is not available.
> 
> Here are a few things I've noticed and have
> questions
> about:
> 
> 1. In my servlet declaration statement can I name my
> servlet the same as the class name?  i.e. if my jsp
> compiles to
> com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
> can my servlet declaration look like this:
> 
> <servlet>
>
<servlet-name>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
> </servlet-name>
>
<servlet-class>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
> </servlet-class>
> </servlet>
> 
> 2. Just to make sure (since I know all the examples
> show this already), you DO NOT want to include your
> applications name in the url-pattern of a servlet
> mapping, correct?  In other words, if my application
> is under webapps/myApp then I want my servlet map to
> say:
> 
> <servlet-mapping>
>
<servlet-name>com.mycompany.myApp.subDir.anotherSubDir.myclass_jsp
> </servlet-name>
>
<url-pattern>/subDir/anotherSubDir/myclass.jsp</url-pattern>
> </servlet-mapping>
> 
> NOT
> 
> <servlet-mapping>
>
<servlet-name>com.mycompany.subDir.anotherSubDir.myclass_jsp
> </servlet-name>
>
<url-pattern>/myApp/subDir/anotherSubDir/myclass.jsp</url-pattern>
> </servlet-mapping>
> 
> I feel like I'm really close to getting this
> running,
> so this last stuff is very frustrating.  Any help
> would be greatly appreciated.
> 
> Thanks,
> Jason
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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