Deploying a servlet to a Tomcat server I don't own
I am trying to deploy a servlet on a Tomcat server I don't own which is located on a clients webhost. I normally have been in control of the servers that I deploy to and have always used a *.WAR file that Eclipse generates for me to deploy all of my servlets. I looked on the server and there is no webapps directory however there is a WEB-INF directory which is normally in the webapps folder once I have deployed the war file. I asked the web host for an example of how to deploy the servlet without using a *.WAR file on their server and they burried me in a mound of documentation that doesn't seem to answer my question on how to deploy a servlet without a *.war file on their server. The documentation they sent me is below.
Before you proceed with the deployment and testing of your JSP/servlet application, please read the following important notes.
!!! IMPORTANT !!! PLEASE READ THE ENTIRE EMAIL:
1) Please review our JSP/Tomcat support and ensure that your application is compatible with the Tomcat version and JDK, as listed at:
NOTE: The default Tomcat mapping is set so that all /*.jsp /servlet/* or /servlets/* and /*.do requests are passed from Apache to Tomcat through mod_jdk (via JkMount). If you need any additional sevlet or page mappings to be installed or if you want all requests to be passed through Tomcat - please update this ticket and let us know what mapping do you want us to setup for your account
NOTE: If your domain name is NOT pointing to our service yet you will need to either:
* Go to http://previewasite.com/ and use it to test your site
* Add your domain name and your server IP in your local hosts file in order for you to be able to access your JSP pages since otherwise the Tomcat will not render the context for your domain. For more info on how to include your domain/IP in your local computer's hosts file please check:
2) Please test and deploy your applications locally on your computer or local server to ensure that they work properly prior to deploying them on our production server. This will save you and us time in case there are problems with your application related to either your code, or requiring changes in order for your application to run under the specified Tomcat/JDK environment above.
3) If you are deploying JAR files to your WEB-INF/classes, or WEB-INF/lib folders, please make sure that you are NOT deploying any: BOOSTRAP, SYSTEM, or COMMON CLASSES as outlined at:
This is especially important for the classes that are common and listed here:
• commons-el.jar - Jakarta commons el, implementing the expression language used by Jasper.
• jasper-compiler.jar - The JSP 2.0 compiler.
• jasper-compiler-jdt.jar - The Eclipse JDT Java compiler.
• jasper-runtime.jar - The JSP 2.0 runtime.
• jsp-api.jar - The JSP 2.0 API.
• mysql-connector-java – The MySQL connector
• naming-common.jar - The JNDI implementation used by Tomcat 5 to represent in-memory naming contexts.
• naming-factory.jar - The JNDI implementation used by Tomcat 5 to resolve references to enterprise resources (EJB, connection pools).
• naming-factory-dbcp.jar - Jakarta commons DBCP, providing a JDBC connection pool to web applications. The classes have been moved out of their default org.apache.commons package.
• naming-java.jar - Handler for the java: namespace.
• naming-resources.jar - The specialized JNDI naming context implementation used to represent the static resources of a web application. This is not related to the support of the J2EE ENC, and cannot be removed.
• servlet-api.jar - The Servlet 2.4 API.
• tomcat-i18n-**.jar - Optional JARs containing resource bundles for other languages. As default bundles are also included in each individual JAR, they can be safely removed if no internationalization of messages is needed.
Your Tomcat has already been loaded with all the necessary classes that are compatible with the provided JDK and Tomcat version.
NOTE: Failing to comply with the above may result in suspension of your account!
4) !!! IMPORTANT !!! Restarting Tomcat – You are provided with an automated Tomcat restart tool which is part of your cPanel. Please use this tool carefully and respect the other clients using the Tomcat on this server. If you are experiencing problems, please check to make sure that your application is running properly locally as outlined in #1 and #2 above.
Please note that this is NOT a test or a development environment – this is a production server, thus we monitor the activities, and how many times the Tomcat is being restarted.
NOTE: Abusing the use of the restart tool may lead to suspension of your account.
5) JSP and Servlet examples – You can find a collection of JSP and servlet examples at:
6) Support – Troubleshooting and supporting JSP/Tomcat applications in a shared hosting environment can be difficult and time consuming. We do recommend that you send any problems and error output via email to: firstname.lastname@example.org – the email/ticket system provided is the best way to get support from us related to JSP/Tomcat problems.
7) JavaMail - If you are using JavaMail please use port number 125 otherwise your emails will not go through your application.
8) Knowledge base Area - our knowledge base contains useful articles which can save you a lot of time. We are constantly adding new articles based on feedback which we receive from our customers. You can review the JSP/Tomcat related articles at:
9) Private JVM - if your application requires private JVM instance please review the following page for available upgrade options:
Can someone please help me figure out what they are trying to tell me with this pregenerated message. I just need to know how to deploy my servlet on this shared server since I can't use a war file and I have never done it any other way. It seems to be something to do with mod_jdk or JkMount which I am not so sure what that even is.
Just upload everything which has to be in the WEB-INF directory, just like they say. If you don't know what exactly that is because you have been relying on Eclipse to know, then set up a local copy of Tomcat (actually you must already have one for testing, no?) and deploy your application to it. Then upload the contents of its WEB-INF directory to your hosting site's WEB-INF directory.
1. I dropped the *.war file into my local tomcat server.
2. It extracted the war and deployed it in the webapps folder
3. I took a look inside and saw the folder structure it was as follows
It works perfectly on my server and I get the Hello World page just as I should when I submit the form however, I am not quite sure how to recreate this on their server when they are telling me to put everything inside the WEB-INF folder but the war is compiled where everything is in the \TestServlet\WEB-INF\ folder I tried just putting all the stuff that is in the WEB-INF folder on my server in the WEB-INF on their server and it tells me that the resource Testing servlet is unavailable. Can you please help?
1. Compile the servlet class.
2. put the servlet class in the WEB-INF/classes directory
3. put the web.xml in the WEB-INF folder
4. submitting to the servlet use the path /servlet/servletName
I don't understand why people insist on making things more complicated than they need to be it is soooooooooooooo not necessary!!!
I'm a newbie struggling with this problem on mochahost as well. I didn't quite understand
item #"4. submitting to the servlet use the path /servlet/servletName." Could you explain
To execute servlet do you go to www.mydomain.com/servlet/servletName?
And is /servlet/servletName the servlet-mapping in the web.xml file?