users@glassfish.java.net

Re: JAXBContext ClassCastException from osgi bundle with full gl

From: <forums_at_java.net>
Date: Fri, 21 Oct 2011 09:26:58 -0500 (CDT)

 Hello Sahoo and thanks for you reply,

After more investigations I am quite sure now the issue is not related to
glassfish but the application itself. The application I tried to deploy is
OSGI, but packaged as a legacy war file using equinox servlet bridge, so
there is some side effects with the servlet briges that cause this issue.

If you are interested, I can provide some explainations.

Equinox Servlet Bridges allow to package osgi application as a legacy WAR
file so it allows to run osgi application in non osgi application server like
Tomcat or Weblogic Server, by starting equinox inside a legacy web
application.

I manage to reproduce the issue with a simpler application (I will attach
here). After deploying the war you can access to
http://localhost:8080/hellojaxb/hello/jaxb so you can see the exception.

By updating equinox configuration, I manage to have the issue gone.

In provided sample in *WEB-INF/launch.ini
*replacing *osgi.contextClassLoaderParent* from *ccl* to *app*, then sample
application works.

This parameter manage parent classloader type of the context classloader
used by the Equinox Framework. When *ccl*  the original context classloader
that was set when the framework launched is used, *app* the application
class loader is used. With ccl jaxb classes are seen twice. 

Unfortunately for me *app* works for the simple application, but for the
original application I had the issue with it has to be *ccl*, so in
conclusion, the best way for me to have this issue solve is to be able to
re-package the application as a true *Web Application Bundle.*

Regards,

Arnaud


--
[Message sent by forum member 'amergey']
View Post: http://forums.java.net/node/855100