• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I am looking for a little help setting up Tomcat for Ant build/deploy

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am an experienced Java programmer, but very new to Servlets/JSP. I am reading so much that my head is spinning. There isn't anyone here where I work that can really help me out since we're not a Java shop; I am leaning for my own sake. Enough about background I should think.

I have gone through the Servlet tutorial here at the Ranch and found it very good. But it uses Orion as the Web Server and I wish to use Tomcat.

I have Tomcat set up and I can manually compile, using javac, and move the resulting class files to: %CATALINA%\webapps\ROOT\WEB-INF\classes to run them, but I'd like to do it in a similar manor as the above mentioned tutorial does using Orion - with an Ant build/deploy.

I am reading through the 'Deployment' section of the documentation that comes with Tomcat, and it's somewhat confusing to me. It appears that I need to get me a "Tomcat Client Deployer (TCD)", and/or a "Tomcat Manager".

1. Am I right?
2. Do I need one or both?
3. From there is it smooth sailing?

I would very much appreciate it if someone - or more than one perhaps - could help streamline the set up instructions for me. Thanks in advance. Regards,
 
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill,
We have a forum just for Apache/Tomcat questions lower down. I'll move this for you.
 
Jeanne Boyarsky
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill,
The deployment manager is an option. I haven't used it though as it isn't necessary and the Ant deploy is so simple without it. See this script for an example of how to deploy to the web apps directory of Tomcat.
 
Bill Johnston
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne,

Sorry I missed the right forum - there are an awful lot of them here ;) - thanks for moving this for me. I will have a look at that script and post back later on. Regards,

 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That particular Ant script, once finished, will basically just copy the application War file to the servlet container's deployment directory. Is that what you're looking for?

I got the impression that you wanted an Ant script that would actually take all of your application components (.class files, .jsp scripts, etc.) and construct the War file, then deploy it.

Can you please clarify?

 
Bill Johnston
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Mark, quite right. I have been busy plodding along in the "Applications Developer's Guide" that accompanies the Tomcat download in the 'webapps/docs' folder, and in the meantime doing my job; and that is why I haven't posted back sooner.

I am just not quite getting it. It seems so simple with Orion, but although the folder setup seems similar, it does not seem identical, and there are so many options it seems that I really just don't know what I need and what I don't need.

Using Orion, I set up my directory structure like this:



The Ant build used to create the build and dist sub-directories, also then moves over the application (classes and lib folders, above) to C:\ ... \orion\applications\application_name\WEB-INF; the .war file to C:\ ... \orion\applications; and the .jsp file to C:\ ... \orion\applications\application_name.

I am trying to figure out how to do the same thing in Tomcat, and still reading ...
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Ant build script posted earlier won't create the application .war file, as I mentioned.
What you're showing above is the layout of your application development area, which includes the sources, and build locations.
Are you saying that you had something that took all that and created the application .war file? This is all you need to deploy the application - it contains all the application components needed (generally, this is true anyway) and just needs to be placed in the server container's deployment directory.

If you have an Ant script that created the .war file, why can't you continue to use that?

When you say "the folder setup seems similar", what folder setup are you referring to? The location in the servlet container where the application is deployed or the folder layout of the contents of the application .war file?

 
Bill Johnston
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark I am sorry if I am confusing you. What I am trying to say is that I learned how to build and deploy using Orion, not Tomcat - right here on the Servlet Cattle Drive:

http://www.javaranch.com/drive/servlet/index.jsp

I've played around there for a while and NOW I want to develope and deploy using Tomcat instead of Orion. Everything I've mentioned in the above email is as per the Orion dev/depl setup.

I am trying to find out what differences there are between the two web servers that require exactly what changes to my directory structure, my web.xml, my build.xml and my build.properties file. Still reading in between my work. Thanks for your time and help


 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A web application should follow the standard structure, laid out in the Servlet Specification http://java.sun.com/products/servlet/download.html

If you are constructing a compliant War file, you should be able to deploy it in any servlet container - Tomcat, JBoss, WebSphere, etc. Note that the layout of your sources doesn't matter at all, since your build (IDE, Ant, etc.) will take your sources and create a standard War file. The War file is the only thing the servlet container will see.

Your application may require some configuration of the servlet container, like security, data sources, etc. You would have to see the Tomcat docs for that information. Also, some of this may require container-specific deployment descriptor files within your application (not as much as used to be required, but still some) - again, the container documentation should provide this information.

I don't really know much about Tomcat, so I can't go much further here. It's just that your question wasn't clear to me, and I wanted to get a clarification.

Best Regards,
 
Bill Johnston
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:A web application should follow the standard structure, laid out in the Servlet Specification http://java.sun.com/products/servlet/download.html



I am reading about that now in the Tomcat doco.

Mark E Hansen wrote:If you are constructing a compliant War file, you should be able to deploy it in any servlet container - Tomcat, JBoss, WebSphere, etc. Note that the layout of your sources doesn't matter at all, since your build (IDE, Ant, etc.) will take your sources and create a standard War file. The War file is the only thing the servlet container will see.



Yes I realize this.

Mark E Hansen wrote:Your application may require some configuration of the servlet container, like security, data sources, etc. You would have to see the Tomcat docs for that information. Also, some of this may require container-specific deployment descriptor files within your application (not as much as used to be required, but still some) - again, the container documentation should provide this information.



This is the missing stuff for me. I am just doing simple things right now - trying to transfer my work from Orion over to Tomcat, but I don't see any present need for security stuff and the like. Then, if I ever get there, I will go back to servlet work I should hope.

Mark E Hansen wrote:I don't really know much about Tomcat, so I can't go much further here. It's just that your question wasn't clear to me, and I wanted to get a clarification.



I didn't realize that you didn't.

Mark E Hansen wrote:Best Regards,

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic