开发者

Tomcat 6 conversion to Glassfish v3: servlet-api, el-api jars

开发者 https://www.devze.com 2023-01-19 11:50 出处:网络
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 rele开发者_JAVA技巧ase tree rather than pulling them in to my

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 rele开发者_JAVA技巧ase 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消