Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 545
  • Last Modified:

Tomcat4 404 error: .jsp file "not available" in default webapps and ownWebapp directories but OK in examples directory

Hi

Using: Tomcat 4.1.31, JDK 1.5

I am getting this error:  HTTP Status 404: the requested resource (/cal1.jsp) is not available.

I have just set up Tomcat afresh and cannot access my JSP files from:
  a) the webapps directory (URL: http://localhost:9080/cal1.jsp), and
  b) my own webapp directory called peacBudget (URL: http://localhost:9080/peacBudget/cal1.jsp)
Both these directories contain hte simple JSP file cal1.jsp.

I can however access the file using  (URL: http://localhost:9080/examples/cal1.jsp).  which means the java compiler is OK, right?

All html files can be accessed OK in all the above directories.

I have been through Google and now the ExpertExchange queries and cannot find a solution other than checking that the classpath,
java_home(my IDE works OK with java_home) and
catalina_home are correct - I have double and triple checked these.

Please advise

Thanks

Fernando
0
Fernando44
Asked:
Fernando44
  • 10
  • 10
  • 5
1 Solution
 
fargoCommented:
Using: Tomcat 4.1.31, JDK 1.5
>> tomcat 4.x is not compatible with jdk1.5
0
 
fargoCommented:
Using: Tomcat 4.1.31, JDK 1.5
>> tomcat 4.x is not compatible with jdk1.5
>>> my mind is off, ignore my post.
0
 
fargoCommented:
have u defined a context in server.xml or seperately with context file??

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Fernando44Author Commented:
Hi Fargo

Thanks!

I was hoping not to use Tomcat5 but it seems I have not choice.

Cheers

Fernando
0
 
fargoCommented:
No, Please reopen the question. I think, tomcat 4.x should run with jdk1.5.
0
 
Fernando44Author Commented:
I have defined in server.xml (at the bottom just before </Server>) as follows:

<Context path="/peacBudget" docbase="peacBudget" debug="0">
</Context>

and have left the other tags as is.
0
 
rrzCommented:
Yes, your installation should work should work. Please describe your file structure in peacBudget.  Also look in Tomcat's logs for an errror message.
0
 
fargoCommented:
rrz -:)

Fernando, please show your directory structure. And as rrz asked, any exception in tomcat logs?
0
 
rrzCommented:
Also try take what you put into server.xml. You don't need to add anything in there for now. Just try to get it working first.  
fargo, I am just trying to help.
0
 
fargoCommented:
sure rrz. I gave a smile.....

You may define as many Context elements as you wish, nested within a Host element in conf/server.xml
http://tomcat.apache.org/tomcat-4.1-doc/config/context.html

do not just define context anywhere in the server.xml but within the Host
0
 
Fernando44Author Commented:
Tomcat log errors on start up of Tomcat (no logs on failed attempt to open JSP page):

in localhost_log.2006-04-24
a)  LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name

b) 2006-04-24 16:32:13 StandardHost[localhost]: Error deploying application at context path /peacBudget
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name

c) 2006-04-24 16:32:13 HostConfig[localhost] Error deploying web application directory peacBudget
java.io.IOException: java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name

As regards peacBudget structure:
peacBudget\web-INF\web.xml
peacBudget\web-INF\classes\*.class
peacBudget\web-INF\lib\*.jar
peacBudget\*. = other directories containing jsp and source files. The cal1.jsp file is in peacBudget directory.


I can see from hte above that there is a problem with the /peacBudget directory but why can't the default webapps URL work?

Cheers

Fernando



0
 
fargoCommented:
i hope the web-INF actually is WEB-INF (keep in mind, it's case sensitive)

Moreover, as i said..the context definition should be inside the <Host >.. <Context..></Context> </Host> in server.xml
Please do the mentioned changes and let us know, what are the exceptions then.
0
 
Fernando44Author Commented:
Hi Fargo

I have just dumped a newly created  jsp file into examples and am getting the same error as before. The original file cal1.jsp is pre-existing in the Tomcat distribution which I guess means that the java compiler is working OK but that I have screwed up the directory structures/configs up somehow

Fernando
0
 
fargoCommented:
do one thing. Remove the changes u did for peacBudget. I mean remove your app code from webapps, remove entry for it from server.xml and restart tomcat to see if the tomcat is working properly as default.

If you find no exception, then we will do the application deployment step by step.
0
 
Fernando44Author Commented:
Hi Fargo

Yes it is WEB-INF

I inserted the context tags inside the existing host tags and Tomcat would not start, so I have taken out my new context tags. Tomcat now starts but am still getting same errors on jsp files.

Log errors seem the same as well:
a) LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name

b) 2006-04-24 17:17:37 StandardHost[localhost]: Error deploying application at context path /peacBudget
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name

c) 2006-04-24 17:17:37 HostConfig[localhost] Error deploying web application directory peacBudget
java.io.IOException: java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  start: :  java.lang.IllegalArgumentException: javacc,ant,commons-collections,log4j,junit-Extension-Name


Fernando
0
 
Fernando44Author Commented:
Hi Fargo

Re:Remove the changes u did for peacBudget

I have done it and the newly created file in examples (URL: http://localhost:9080/examples/fdn.jsp) works fine.

However the default webapps url generates hte same 404 serror (URL: http://localhost:9080/fdn.jsp)

Good test but what does it mean?

Fernando
0
 
Fernando44Author Commented:
Hi Fargo

Re:Re:Remove the changes u did for peacBudget

Sorry: no exceptions in the logs

Fernando

0
 
fargoCommented:
However the default webapps url generates hte same 404 serror (URL: http://localhost:9080/fdn.jsp)
>> You will definitely get the page not found exception, because the fdn.jsp is bundled with ROOT directory of tomcat. If you put this fdn.jsp inside the ROOT folder of webapps. Then you will be available to access http://localhost:9080/fdn.jsp
0
 
fargoCommented:
Hi Fernando, i will be off now. Will be available tomorrow. May be rrz or others will help you in this regard.
0
 
rrzCommented:
Please show us your web.xml file for your web app.  
>However the default webapps url generates hte same 404 serror (URL: http://localhost:9080/fdn.jsp)  
That would have Tomcat loking in  the ROOT web app's root directory for fdn.jsp
0
 
Fernando44Author Commented:
Hi Fargo

Yes you are right offcourse - I'm going moggy with all the testing.

Where to now?

Fernando
0
 
rrzCommented:
Let us start over. Are you using Tomcat 4 ?   Revert back back to original state  of  server.xml , you don't need to change that now. Show us your web app's web.xml.
0
 
Fernando44Author Commented:
Hi rrz

the web.xml in webapps/peacBudget/WEB-INF/ is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
      <display-name> Welcome to PEAC Budget Rate </display-name>
      
      <description> PEAC Budget Rate      </description>
 
      <context-param>
        <param-name>default</param-name>
        <param-value>""</param-value>
        <description>
          default context path
        </description>
      </context-param>
 
<!--  
      <listener>
          <listener-class>peacBudget.HibernateListener</listener-class>
      </listener>
-->

<!--
      <servlet>
          <servlet-name>Submit_action</servlet-name>
          <servlet-class>peacBudget.Submit_action</servlet-class>
      </servlet>  

      
      <servlet-mapping>
          <servlet-name>Submit_action</servlet-name>
          <url-pattern>/submit/*</url-pattern>
      </servlet-mapping>
-->
   
</web-app>

Fernando

Cheers Fargo, Thanks for your comments.

0
 
Fernando44Author Commented:
Hi rrz

Have reverted to default server.xml and yes it is Tomcat4.

Fernando
0
 
rrzCommented:
I can't see the problem yet.  The only doubt I have is with  your port. Did you alter server.xml? Did you try the default 8080 ?
http://localhost:8080/peacBudget/cal1.jsp
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 10
  • 10
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now