dev@glassfish.java.net

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

From: Sahoo <sahoo_at_sun.com>
Date: Thu, 21 Aug 2008 22:01:27 +0530

Ludo,

Ludovic Champenois wrote:
> 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.
I still don't understand why that should cause a ClassCastException
unless Equinox is not detecting an inconsistent class space.
>
> 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.
>
I am taking care of all the API jars to have proper dependencies. The
changes have been put back, but rest of the build system is not using
it. I am in the process of making the necessary changes in the build
system. That will improve the situation. I will drop you an email once I
am done.

Thanks,
Sahoo