This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
Hi everyone, I am new to this forum. I come across a problem when I was doing the example from "Head First Servlet and JSP"(page 30-31).
I wrote a Servlet (HelloWorldTest), compiled it (no error) and placed it in :I:\Web\Tomcat 6.0\webapps\ROOT\Test\WEB-INF\classes THe WEB-INF file is placed in: I:\Web\Tomcat 6.0\webapps\ROOT\Test\WEB-INF
Thanks for your reply, first, can you please tell me why should I move it to webapp directory? isn't the ROOT directory supposed to be the default directory for WWW access??
I use both apache and Tomcat for WWW accessing on my machine, where Apache is for rendering static html, Tomcat is for JSP and servlets.
Every application server has dedicated ports for various kinds of services. In your case 8080 is the default port which is used to access www application.
The default port for non-secure HTTP is 80. If you don't specify a port the browser will automatically use port 80.
For a couple reasons, Tomcat ships with its default port set to 8080. You can change it by editing your tomcat/conf/server.xml file. Look for the <Connector ... /> entry that its port attribute set to 8080 and change it to 80. Restart Tomcat and you can use the URL that you mentioned.
Hui Zhao, It is better to ask your question in a new thread than to potentially hijack this one with a similar but different question. [ January 20, 2008: Message edited by: Ben Souther ]
Yichuan Wang
Greenhorn
Joined: Jan 17, 2008
Posts: 8
posted
0
Originally posted by Ben Souther:
The default port for non-secure HTTP is 80. If you don't specify a port the browser will automatically use port 80.
For a couple reasons, Tomcat ships with its default port set to 8080. You can change it by editing your tomcat/conf/server.xml file. Look for the <Connector ... /> entry that its port attribute set to 8080 and change it to 80. Restart Tomcat and you can use the URL that you mentioned.
Hi Ben, thanks for your reply, I think now I found out why http://localhost:8080/Test/hello works where http://localhost/Test/hello doesn't. but I still don't know how to fix it yet. The reason for why port 80 doesn't work is because Apache can not handles Servlet properly. It appears that it can properly handles JSP and Do files but not Servlets, there could be something wrong with the configuration of the helper program(Jakarta Tomcat connector). I have both Tomcat and Apache installed on my desktop, an additional helper software(Jakarta Tomcat connecter) is also installed which connects Apache with Tomcat. When there is a static html page, apache handles it, and when there is a JSP page apache passes it over to Tomcat.
When I use port 80(Apache): It works perfectly when it processes JSP pages, but it just can not process servlets.
This is the configuration I added to Apache httpd.conf
anybody could possibly tell me why? or should I change line:JkMount /servlet/* ajp13 to something else? [ January 20, 2008: Message edited by: Yichuan Wang ]
If you're using something more than just Tomcat, it's a good idea to mention that upfront. I didn't know that you were connecting Tomcat to the Apache Web Server till now.
These days, I use Tomcat as a standalone so I'm out of practice when it comes to connecting it to other web servers.
Maybe someone else can assist you in getting the two to cooperate.
Yichuan Wang
Greenhorn
Joined: Jan 17, 2008
Posts: 8
posted
0
Originally posted by Ben Souther: If you're using something more than just Tomcat, it's a good idea to mention that upfront. I didn't know that you were connecting Tomcat to the Apache Web Server till now.
These days, I use Tomcat as a standalone so I'm out of practice when it comes to connecting it to other web servers.
Maybe someone else can assist you in getting the two to cooperate.
Sorry about the confusion, I should have mentioned that at the very beginning, but I did not know this was the cause of the problem.
hope somebody else could know more about the problem.