File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes 404 errors in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "404 errors in servlets" Watch "404 errors in servlets" New topic
Author

404 errors in servlets

vasu devan
Ranch Hand

Joined: Apr 14, 2005
Posts: 38
Hi

Im new to Tomcat server4.1
i developed simple servlet and deployed in following directory

c:\javaprogram\web-inf\classes

and i did following changes

1.set the classpath in environment variables
c:\javaprogram\web-inf\classes;

2.set my context path to c:\javaprogram in server.xml

and

3.having web.xml is available in c:\javaprogram\web-inf\classes

eventhough its telling the 404 error

im not able to find the solution ..

please dont hesitate to answer...

and also dont point out "THIS IS NOT RIGHT PLACE TO ASK"

OK..

cheers
vasu
Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/deployment.html

read this.
vasu devan
Ranch Hand

Joined: Apr 14, 2005
Posts: 38
hi krishna

i went throught that site..
eventhough im not very clear about that..
i mentioned my query clearly..
give me step by step solution..
most of the things i followd..but
eventhough its coming 404 error..

anywhere to configure ..

please guide me to get solution

regards
vasu
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Im new to Tomcat server4.1
Then is there any reason you are starting out with an old release?
There have been significant changes in the 5x branches.

i developed simple servlet and deployed in following directory
c:\javaprogram\web-inf\classes
It should be javaprogram\WEB-INF\classes (case sensitive)

1.set the classpath in environment variables
c:\javaprogram\web-inf\classes;
Tomcat doesn't use your classpath. It finds classes by looking through
a specific set of directories (which is why you need to get the case right).

2.set my context path to c:\javaprogram in server.xml
For 4.1, that is the correct way to do it. This has changed in 5x so you
will need to change your approach when you upgrade. Again, I would start out with a more recent version.

3.having web.xml is available in c:\javaprogram\web-inf\classes
Your web.xml file should be in c:\javaprogram\WEB-INF\ (not under classes).

eventhough its telling the 404 error
im not able to find the solution ..

I would start by looking at the log files under TOMCAT_HOME/logs.

please dont hesitate to answer...
No hesitation here.

and also dont point out "THIS IS NOT RIGHT PLACE TO ASK"
There is a forum devoted to Apache/Tomcat on this site. If it's appropriate to do so, people will point it out.

cheers
vasu
Cheers

Also, you may want to skip writing an entry in server.xml and just let Tomcat auto-deploy the app for you. You do this by building your web app's directory structure under TOMCAT_HOME/webapps.
If you want a working example, download SimpleServlet.war from http://simple.souther.us to your webapps directory. Tomcat will unpack and deploy it for you. You will have a properly structured web app with all the right entries in the web.xml file to use as a reference.

Good-Luck
[ April 18, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
vasu devan
Ranch Hand

Joined: Apr 14, 2005
Posts: 38
HI Ben
Thnaks for your Reply

i did what are all the steps that you have written

but eventhough im not able to start web server

its setting logs in /logs folder

the contents are pasted here.please help me

2005-04-18 14:29:48 WebappLoader[/javaprogram]: Deploying class repositories to work directory C:\Tomcat-4.1\work\Standalone\localhost\javaprogram
2005-04-18 14:29:48 WebappLoader[/javaprogram]: Deploy class files /WEB-INF/classes to C:\javaprogram\WEB-INF\classes
2005-04-18 14:29:48 ContextConfig[/javaprogram]: WARNING: Security role name tomcat used in an <auth-constraint> without being defined in a <security-role>
2005-04-18 14:29:48 ContextConfig[/javaprogram]: WARNING: Security role name role1 used in an <auth-constraint> without being defined in a <security-role>
2005-04-18 14:29:48 ContextConfig[/javaprogram] Exception processing TLD at resource path /WEB-INF/jsp/debug-taglib.tld
javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/jsp/debug-taglib.tld
at org.apache.catalina.startup.ContextConfig.tldScanTld(ContextConfig.java:963)
at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:811)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:587)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3523)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)
----- Root Cause -----
java.lang.IllegalArgumentException: Invalid TLD resource path /WEB-INF/jsp/debug-taglib.tld
at org.apache.catalina.startup.ContextConfig.tldScanTld(ContextConfig.java:955)
at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:811)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:587)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3523)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)

2005-04-18 14:29:48 ContextConfig[/javaprogram]: Marking this application unavailable due to previous error(s)
2005-04-18 14:29:48 StandardManager[/javaprogram]: Seeding random number generator class java.security.SecureRandom
2005-04-18 14:29:48 StandardManager[/javaprogram]: Seeding of random number generator has been completed
2005-04-18 14:29:48 StandardContext[/javaprogram]: Context startup failed due to previous errors


provide me the solution..

cheers
vasu
vasu devan
Ranch Hand

Joined: Apr 14, 2005
Posts: 38
Hi Ben

Tnx for your Information

i come hear without probelom...
and also the sapecific classnofoundexception caught because the particular class file not found in web-inf/classes.

and its working fine now..

but only one query...may be im doubting...

when i call the servlet

http://localhost:8080/javaprogram/HelloWorld its working fine

but usually we wil call only through

http://localhost:8080/javaprogram/servlet/HelloWorld

but if we call through above statement...
its telling 404..

just clarify my doubt...

Note:
Initially im using Resin web server

cheers
vasu
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Using
http://localhost:8080/javaprogram/servlet/HelloWorld
is an outdated way of calling servlets via the invoker servlet.

The invoker servlet has been disabled in all current versions of Tomcat (and it's equivalent in all the other servers as well) because it was a disaster.

See: http://faq.javaranch.com/view?InvokerServlet for the details.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 404 errors in servlets
 
Similar Threads
Dependencies : Jboss 7
About executing servlet class
compilation error
Extending HttpServlet
Passing Files in Web Services