views:

32

answers:

1

Hello

I used ant when building my web app from eclipse to deploy to Tomcat 6 and referred to servlet-api.jar and el-api.jar within the Tomcat 6 release tree rather than pulling them in to my deployed library folder.

I am trying to deploy to Glassfish v3. I've pulled the jars from the www.java2s.com website.

  1. Was this the right place to get them?
  2. Did I need to do it at all? I searched within Glassfish and the jars weren't there
  3. If I didn't need to do it at all, is there another course of action to follow to ensure the same functionality is available?
+3  A: 

Seeing this question and the other questions you posted I have the feeling that you're doing things completely wrong. Here's just an answer which should get it all straight.

  • You should never have separate copies of servletcontainer-specific libraries wandering around in the classpath.

  • You should never put copies of servletcontainer-specific libraries in webapplication's WEB-INF/lib.

  • In an IDE like Eclipse, you should never add servletcontainer-specific libraries separately in project's build path.

  • In a nut: just do not touch servletcontainer-specific libraries at all. Don't even think of downloading them separately. That's plain recipe for trouble. Having separate libraries of different servletcontainer makes will only result in collisions in classpath. The servletcontainer should be downloaded and treated as its whole own.

  • In Eclipse, when integrating a servletcontainer (Tomcat or Glassfish), just add it in the Servers view.

  • To associate a dynamic web project with a specific servletcontainer (server) so that you can compile servlets and so on, you need to select it in the Targeted Rumtimes section of the project properties. Then everything will go well automagically, thanks to Eclipse smartness. That's also the place to change the servletcontainer implementation whenever necessary. When you're creating a brand new dynamic web project, you can just choose the desired servletcontainer implementation from the servers dropdown in the wizard.

When you want to create a WAR, simply rightclick the dynamic web project, choose Export and then WAR file. No need for a separate ant task or so.

BalusC
BalusC, thanks for the points. On your last point though, I'm using ant as I'll be deploying to another machine on the network so the local instance of the container is just to get the app up and running. I had already selected a target runtime hence given what you've said in the other points, these additional libraries are merely superfluous.
Mark Lewis