Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Wednesday, June 9, 2010

Cpanel: Apache + Tomcat + simple web application



Since 2 days i was struggling to deploy a spring based webapplication on a shared hosting server.
I had access using cPanel but was struggling somehow to get it work even though JSP/mod_jk was enabled on my servlet. After 2 days of research it was just two simple things which fixes the issue.

Without adding too-much of prologue, let me put it straight.

Following are the two things which needs to be done to make your spring-web-app work on shared hosting server.

1) Created a .war file of my application and put it into the /public_html directory.
2) Also added the following lines to the .htaccess file inside /public_html

###########################
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
###########################

The above settings will be enough if anyone wants to deploy a web-application with spring-framework on cPanel :)

Provided, mod_jk is enabled on your server so that apache understand these requests.

*Your application should be accessible using the foll url:
http://server_name/app_name/blah.jsp

*Depending on the directory structure of ur application.

Special thanks to the person who posted this

and this pdf from cPanel



Happy coding... :)

Wednesday, June 4, 2008

Apache + Tomcat + mod_jk.. how does it work...

In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Load the servlet container adapter library and initialize it (prior to serving requests). When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it. The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. Things are even more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs.