I have set up a virtual host in Apache, which is intended to host and execute all Servlets and JSPs which are located in this vhost directory.
(A snippet of my config-files is on to bottom of this post, because attachments doesn't work yet.)
This setup works fine, BUT the Servlets / JSPs are processed ONLY when they are stored and executed in Tomcat's "webapps" folder. (When I move the Servlets and/or JSPs to the vhost-directory, I get an error; produced by Tomcat.)
So - WHAT CAN I do that my Servlets and JSPs are stored AND executed in my vhost directory?
Kind regards, Chris
P.S.: I've read a lot of documentations and tried out many different setups before I posted this thread!
# I've deleted all uncommented tags (#) AND those which seem to be unnecessary (for my setup)
First you need to understand how Enterprise Java webapps are architected.
You cannot simply dump a bunch of files somewhere and expect them to run in Tomcat or for that matter, any other J2EE webapp server. A J2EE webapp is - according to the standard, a bundle of files with specific meanings and relationships, all zipped together in a JAR called a WAR file. Tomcat can deal with unzipped versions of this JAR format as well (called "exploded WARs"), but the actual j2EE standard only specifies them in zipped form.
As part of this standard, a web application context is defined. Since a J2EE can host many apps - even without virtual hosting - each webapp has a context path that's part of the URLS that get routed to that particular webapp. In fact, it's the context path that determines which app the URL is routed to.
Furthermore, to execute servlets, you have to map the servlet to a URL pattern as well, which is something you do by coding the mapping in the WEB-INF/web.xml file of the WAY. Very, very old Tomcat releases didn't require this, but it was a horrible security feature and J2EE is big on security.
You don't need to define your WAR - or its directories - to Apache httpd at all, however. Just set up an Apache virtual host and code the appropriate mod_jk or mod_proxy directives in that virtual host definition. Apache will then forward all the matching URLs to Tomcat and Tomcat can take care of the rest. As long as you've deployed your webapp correctly inside Tomcat.
An IDE is no substitute for an Intelligent Developer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com