• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Deploying a servlet to a Tomcat server I don't own

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,


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:

http://www.mochahost.com/jsp_hosting.php

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:

http://en.wikipedia.org/wiki/Hosts_file

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:

http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

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:

JSP examples:

http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=430&nav=0,57

Servlet examples:

http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=431&nav=0,57


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: support@mochahost.com – 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:

http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=view&parentcategoryid=57&pcid=0&nav=0

9) Private JVM - if your application requires private JVM instance please review the following page for available upgrade options:

http://www.mochahost.com/java.php



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.

Thanks,

Robert
 
Sheriff
Posts: 28333
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's in this link: http://www.mochahost.com/jsp_hosting.php in the section entitled "Deploying JSPs & Servlets".

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.
 
Robert Stone
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I gave it a shot and here is what I got

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

webapps\TestServlet\META-INF
webapps\TestServlet\META-INF\MANIFEST.MF
webapps\TestServlet\WEB-INF
webapps\TestServlet\WEB-INF\lib
webapps\TestServlet\WEB-INF\lib\activation.jar
webapps\TestServlet\WEB-INF\lib\mail.jar
webapps\TestServlet\WEB-INF\lib\mysql-connectior.jar
webapps\TestServlet\WEB-INF\lib\servlet-api.jar
webapps\TestServlet\WEB-INF\classes
webapps\TestServlet\WEB-INF\classes\Testing.class
webapps\TestServlet\WEB-INF\Sources\
webapps\TestServlet\WEB-INF\Sources\Testing.java
webapps\TestServlet\ServletTesting.html

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?
 
Paul Clapham
Sheriff
Posts: 28333
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've got some jars in there which they specifically said you shouldn't put on their server. Did you put those jars on their server?
 
Robert Stone
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No that is the structure from my personal dev server. I removed the jars they said not to put in when I transfered the folders
 
Robert Stone
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I FIGURED IT OUT AND IT WAS REALLY SIMPLE! I HATE HOW UNNECESSARILY COMPLEX THEY TRIED TO MAKE IT! It was this simple

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!!!

Cheers,

Robert
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Robert,

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
that further?

To execute servlet do you go to www.mydomain.com/servlet/servletName?
And is /servlet/servletName the servlet-mapping in the web.xml file?

Thanks,
Miles
 
I'm thinking about a new battle cry. Maybe "Not in the face! Not in the face!" Any thoughts tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic