3 Replies Latest reply on May 26, 2006 8:17 AM by j2ee_junkie

    servlet context problem.

      Hi All,
      I want to know is there are any errors in keeping my servlet class files inside the WEB-INF/classes folder or keeping it
      outside , say in another .jar file in the same application (i.e. ear file).
      Will the servlet context of the jsp page will be affected by this?

      Please suggest.

        • 1. Re: servlet context problem.

          Not sure what you mean by a servlet context. If you are referring to Tomcat's notion of an application Context, then I do not think it matters. You may have classloading issues if you put your jar in the ear. I think in that case you would need to add a manifest 'class-path' element to your war's MANIFEST.MF file.


          • 2. Re: servlet context problem.

            Hi Griffith,
            yes I was talking in terms of Tomcat servlet container.

            Any suggestions on this....

            • 3. Re: servlet context problem.

              I think I already answered your question. AFAIK, if you include your servlets in a jar in WEB-INF/lib then they will be loaded by the War (i.e. the WebAppClassLoader) classloader. If you put your servlets in a jar and put that jar at the ear level, the only way your WebAppClassLoader will use them is if you add a 'Class-Path' entry to your war's MANIFEST.MF file. I am not 100% on the latter as I have never tested it.

              The real questions is why you would want to do this. Servlet classes are only relavant in a war. If there are Servlets that you want to share between war's JBoss does that by default (unless your deployment is isolated.)

              Please let me know if this solves your problem, or if the later works. Later, cgriffith