dev@glassfish.java.net

GlassFish V3 OSGI bundles running inside the Eclipse IDE: javax.servlet conflict

From: Ludovic Champenois <Ludovic.Champenois_at_Sun.COM>
Date: Thu, 21 Aug 2008 09:11:37 -0700

Hi,
I am resuming my work on running a full GF V3 Prelude server embedded
inside the Eclipse IDE.

This IDE already defines a javax.servlet bundle (but it is 2.4 version)
and it uses it.
GF V3 needs servlet 2.5.

I can start a V3 Prelude server inside the Eclipse VM as OSGI, but at
deployment tine of a web app, I see this error:

LifecycleException: java.lang.ClassCastException:
org.apache.jasper.servlet.JspServlet cannot be cast to javax.servlet.Servlet
    at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4926)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:5313)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:381)


telling me that our V3 runtime might be using the servlet jar from
Eclipse and not from V3.

Searching for javax.servlet inside all of our pom files, I can see some
of the pom files not defining the version number for importing
javax.servlet, so these modules would get the jar from eclipse, hence
the wrong version...

So check your manifest files/ pom files and if you see a import package
of javax.servlet without a 2.5 version, it means that the dependency is
not correctly defined.

I see this in the 3 jmx poms (client common server), servlet.jsp,,
jsp.jstl, websecurity, grizzly-optional, and maybe others...

There might be other java ee apis dependencies (servlet.http,
...,....,...) which are not correctly defined.

Thanks for your review,
Ludo