geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <xhh...@gmail.com>
Subject Re: shared lib classloader XStream Jettison issue
Date Fri, 08 Jul 2011 00:45:36 GMT
Did not see your deployment plan, so I guess the shared lib artifact is
added as a dependency, and use the hidden-classes configurations there,
right ?
If it does, the hidden-classes is taken action for your application. which
means if the classes in the hidden list is required to load, it won't check
the parents of the application, including the shared lib dependency. It
should work if those jars are put in the WEB-INF/lib folder, I saw you
mentioned it as WEB-INF/libs, is it a typo error or the incorrect name is
used ?

There is another way to make it work, in this case, the jar files configured
in the shared lib gbean will be added in your application classloader, and
with hidden-classes configured, those classes will always be loaded from the
application classloader.
a. remove the shared lib dependency
b. add a shared lib gbean in your deployment plan

IIRC, placing jar files in the lib folder will not be loaded by the system
classloader, as those jar file list is hard coded in the start-up jar files.
For the endorsed folder, you might double chcek with java doc for its using
scenario.
Hope it helps.

2011/7/8 Kevan Miller <kevan.miller@gmail.com>

> The following was posted to the Geronimo forum on Nabble, but, AFAICT,
> never made it to a mailing list or moderation. Reposting, now...
>
> See
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tt3144897.html
>
> >
> > Hi,
> >    I am using Geronimo Little G 2.2.1 and  have a  deployment plan which
> utilizes the shared lib and it seems to work for the most part. But when my
> app (a web application) tries to use XStream for serializing JSON (xstream
> uses Jettison Internally) I get ClassNotFoundException. Please note that all
> the jars the application uses are from the shared library and it has a copy
> of XStream and Jettison.
> >
> > I can see that the XStream is getting loaded from
> $GERONIMO_HOME/lib/xstream.jar and is loaded by the system classloader.  In
> my application deployment plan I have given "hidden-classes" to exclude
> XStream and Jettion but its not getting picked up from the shared lib.  The
> only way I can get the app to work is if I put the Jettison.jar into the
> JVMs ext directory, it does not work even if I put the jettion.jar into
> $GERONIMO_HOME/lib where it is loading xstream.jar.
> >
> > I am suspecting that since my application uses shared lib , shared lib's
> classloader gets to load everything first and the policy there probably is
> to load everything from its parent and is why my application plan's
> "hidden-classes" is not working. I tried placing the jar in all spots where
> one would expect the classes to be picked up (WEB-INF/libs,
> repository/org/.../jettison.jar, $GERONIMO/lib/endorsed).
> >
> > Is there a way I can specify the "hidden-classes" for the shared lib
> module? Or am I doing something totally wrong?
>



-- 
Ivan

Mime
View raw message