This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes My *.jsp files will not execute unless in /servlet path. 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 » Products » Tomcat
Bookmark "My *.jsp files will not execute unless in /servlet path." Watch "My *.jsp files will not execute unless in /servlet path." New topic
Author

My *.jsp files will not execute unless in /servlet path.

John Semler
Greenhorn

Joined: Dec 11, 2010
Posts: 13
On the hosting service, the path http://jsemler.net/jws/Calculator.jsp invokes my Java webstart Calculator application.

But Apache2.2 web server can't pass "http://localhost/jws/Calculator.jsp" for processing to the Tomcat 6 server on my local test machine.

My httpd.conf file has the following lines:



This is what the hosting service has to say about mount directives:

Under the shared Apache/Tomcat implementation as we have here (per Apache’s specifications and industry-standard for a shared platform), all requests go through Apache first, and as such, specific mount directives have to be defined in Apache to pass the JSP/Servlet/Mapping from Apache to Tomcat (otherwise Apache will assume it should try processing the request). By default, the directives we pass are:

We pass the three standard mount directives:

*.jsp
/servlet/*
/servlets/*


How do I configure the my local Apache/Tomcat system to behave more like the hosting service?

(I struggled for far to long with this, I'm not an expert with Apache/Tomcat configuration and may be looking at the wrong things)

Thanks!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Probably the reason "http://localhost/jws/Calculator.jsp" does not execute is that your local Tomcat does not think that "jws" is a legal web application.

Study the way the applications that Tomcat comes with are configured.

Bill
John Semler
Greenhorn

Joined: Dec 11, 2010
Posts: 13
William Brogden wrote:Probably the reason "http://localhost/jws/Calculator.jsp" does not execute is that your local Tomcat does not think that "jws" is a legal web application.

Study the way the applications that Tomcat comes with are configured.

Bill


You got me thinking what was really happening at the hosting service implementation. The clue was that the WEB-INF directory appears inside my "httpdocs" directory. They do not allow users to upload war files for a reason:


Support Center » Knowledgebase » Tomcat (JSPs/Servlets) » Are .war files supported on your servers?

Solution In our shared Apache/Tomcat implementation, .war files are not supported (noted on our main website). You must unarchive your .war into your httpdocs directory. The container-standard /WEB-INF directory structure is preprovided.
...


My "jws" directory along with all the web files are loaded into the httpdocs directory.

On my localhost, I made junctions back into my WebContent development directories.

First, I shutdown the Apache and Tomcat service. Then renamed the Tomcat directories "webapp/ROOT" to "webapp/ROOT.bu' and "webapp/servlet" to "webapp/servlet.bu" to get them out of the way.

These are the commands I used to establish links back to my WebContent development directory:



Then I copy the files from the renamed servlet.bu into D:\home\jsemler.net\WebContent and restart the Apache and Tomcat installation.

http://localhost/jws/Calculator.jsp now works under my system.

Not an elegant solution but it works. I would also lose my Tomcat Manager Web page and the ability to use war files (because I took over "ROOT"). I only possess rudimentary knowledge of how to configure Apache/Tomcat/Windows 7 system so my chances are low in finding a better solution without investing a lot of time.

Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: My *.jsp files will not execute unless in /servlet path.
 
Similar Threads
Help please ;-( Apache2 - Tomcat5 integration on FeeBSD
[Tomcat6/mod_jk/Apache2.2] JkMount and Url patterns
Apache don't send to Tomcat (mod_jk)
Connecting Apache 2.2 and Tomcat 5.5
How to configure tomcat handle jsp files from apache DocumentRoot