File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes unable to execute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "unable to execute" Watch "unable to execute" New topic
Author

unable to execute

Chitra Jay
Ranch Hand

Joined: May 02, 2002
Posts: 76
Hi,
This is my first program, i have problems in viewing the output.
I am able to run tomcat
http://localhost:8080 works fine.
But,When i try to see my output
http://localhost:8080/chapter01/servlet/HelloWorldServlet , it doesnt work.
I copied the class file and placed in
E:\jakarta-tomcat-4.0.1\webapps\chapter01\WEB-INF\classes
and created web.xml in the directory
E:\jakarta-tomcat-4.0.1\webappas\chapter01\WEB-INF
my classpath is
E:\jdk131\bin;.;E:\jakarta-tomcat-4.0.1\common\lib\servlet.jar
CATALINA_HOME:
E:\jakarta-tomcat-4.0.1
JAVA_HOME:
E:\jdk131
Please tell me if i am missing something

Thanks
Chitra
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
I placed my classes in the path webapps/examples/WEB-INF/classes, and that worked. I guess this is the default path in tomcat. I did not create my own directory in place of "examples". But I too want to know what all changes have to be done in case I want to keep my servlet classes in some user-specific path, like webapps/chapter1/WEB-INF/classes. Do I have to modify the server.xml file or some other file, and if so, what all changed are required.
Any help will be appreciated.
Thanks, Sudd


SCJP 1.4, SCWCD, SCBCD 1.3
Don Bosco
Ranch Hand

Joined: Oct 31, 2002
Posts: 108
Ok Guys, here is what u need to do.
Create a copy of the examples directory in the webapps directory. Rename it to chapter01.
Now remove all the unnecessary files and directories in chapter01 and put your class files in the classes dir.
clean up the web.xml and add the tags u needed.
Thats it. For more info check this thread

Check this


SCJP 1.4<p>Wingardium Leviosa!!
Madan, Gopal
Ranch Hand

Joined: Aug 13, 2001
Posts: 86
Chitra:
Assuming everything is installed fine, there are couple of things you can do for HelloWorldServlet under chapter01 webapp to work.
1. You can enable the default "invoker" servlet to kick-in ( which is what you tried to use ).
or
2. Create a servlet-mapping element in your chapter01\WEB-INF\web.xml file.
For the first option, uncomment the servlet-mapping element for the "invoker" servlet, in the file $CATALINA_HOME\conf\web.xml. This is commented out, by default in tomcat 4.1.12, which i assume is the case with your version, too. Then the URL you used should work.
For the second option, add the following servlet-mapping to your chapter01\WEB-INF\web.xml file.

Then your HelloWorldServlet can be access via HelloWorldServlet
Change the url-pattern and the port #, as you wish.
Hope this helps
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
Don's suggestion worked. Thanks Don. It was not as complicated as I imagined.
Thanks, Sudd
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to execute