tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <>
Subject Re: Export Eclipse Web Service to Tomcat
Date Wed, 05 Aug 2009 10:03:57 GMT
Toriacht schrieb:
> The web service runs fine within Eclipse on a Tomcat 6 Server. I
> want to deploy this to an external Tomcat server(not running within
> eclipse) but I am unsure how.

> I know (I think!) I need to File>Export>Web>WAR File. Is this correct?
> There must be more to it!!

Make sure you export it to your target Tomcat's webapps directory and
then start your target Tomcat on a free port. That should be it.

> What do I do with the .jars referenced in Java Build Path and Java EE
> Module dependencies - do these get added to the WAR or do I need to
> manually copy this to tomcat server. If so to what folder?

What's been added using "Add JARs" will be added to the WAR; what's been
added using "Add External JARs" won't. The former must not be provided
by your target Tomcat; the latter has to be provided by your target

When clicking on "Add JARs", I was surprised I didn't have any options
to add JARs, as there weren't any in my project yet. Well, you simply
have to import JARs into your project, straight into WEB-INF/lib, or
whatever your lib folder is. That'll ensure your JAR is part of the
distributatble (the WAR). Then, add it using "Add JARs", so Eclipse
knows about your JAR for *building*.

In fact, for multiple usage of the JAR, references to it are created,
so the JAR doesn't get copied around uselessly.

*Question* of mine here for the more knowledgeable Eclipse users: Is
it customary or reasonable to create a "JARs" pseudo-project in Eclipse
for third-party JARs (like the "Servers" pseudo-project) so all actual
projects reference these JARs?

> The web service references .config files on my c: drive that sets up
> JDBC driver etc. I probably need to change location of these files to
> a folder in Tomcat? What is protocol?

Would configuring a JNDI/JDBC DataSource be an alternative to your
.config files? That's usually the best way. Check out chapters 8 and 9
of this handy user guide:

* 8) JNDI Resources
* 9) JDBC DataSources

> The service also references a log4j properties stored file in the src
> folder. Where should I put this on Tomcat server?

On the same level as src, create a directory called properties and put
your file there. In Project > Properties > Java Build Path > Source, add
this folder so Eclipse knows this is relevant for building.

> The log4j properties file sets up a log file on my c: drive. I probabl
> need to edit location of log file, again what is protocol?

Edit the file before exporting according to your wishes.

> Is there an easy way of testing the deployed .war is running correctly?

Depends on what tests you have set up. For an XML web service, tests
should be rather doable. You could use Schematron or Canoo WebTest.

> Do I need to put the axis2 .jar on the Tomcat?

Don't know. Unless it is special (like a database driver), providing it
with the web app should do the trick.

Michael Ludwig

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message