You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Kevan Miller <ke...@gmail.com> on 2011/07/08 02:22:37 UTC

shared lib classloader XStream Jettison issue

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?

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
You are a superman!!!!!! It worked... awesome!!!. Thanks a ton, now I have to
see how I can put this into our deployment process, but this is great!!!. 
Thanks once again. 

BTW,  we have all our dependencies in shared lib only , there is nothing in
the war files, so this solution would work fine I guess. 

--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3173900.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
Yes, a dependency is required, I just tried it on a 2.2 build, the plan
below works for me :
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
   <environment>
       <moduleId>
           <groupId>aswin</groupId>
           <artifactId>sharedlib</artifactId>
           <version>1.0</version>
       </moduleId>
       <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.framework</groupId>
            <artifactId>rmi-naming</artifactId>
        </dependency>
       </dependencies>
       <hidden-classes>
           <filter>com.thoughtworks.xstream</filter>
       </hidden-classes>
   </environment>
   <gbean name="SharedLib"
class="org.apache.geronimo.system.sharedlib.SharedLib">
       <attribute name="libDirs">myshare/lib</attribute>
       <reference name="ServerInfo">
           <name>ServerInfo</name>
       </reference>
   </gbean>
</module>

2011/7/14 ashwin nair <ma...@gmail.com>

> When I tried deploying the jar I am getting
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.geronimo.system.sharedlib.SharedLib in classloader
> aswin/sharedlib/1.0/car
> INFO   | jvm 1    | 2011/07/13 20:21:44 |       at
> java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:77)
>
>
> Do I have to have any other dependency specified?  This is my
> geronimo-service.xml
>
> <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
>    <environment>
>        <moduleId>
>             <groupId>aswin</groupId>
>            <artifactId>sharedlib</artifactId>
>             <version>1.0</version>
>        </moduleId>
>        <hidden-classes>
>            <filter>com.thoughtworks.xstream</filter>
>        </hidden-classes>
>    </environment>
>    <gbean name="SharedLib"
> class="org.apache.geronimo.system.sharedlib.SharedLib">
>        <attribute name="libDirs">myshare/lib</attribute>
>         <reference name="ServerInfo">
>            <name>ServerInfo</name>
>        </reference>
>    </gbean>
> </module>
>
>
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3167951.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
When I tried deploying the jar I am getting 

Caused by: java.lang.ClassNotFoundException:
org.apache.geronimo.system.sharedlib.SharedLib in classloader
aswin/sharedlib/1.0/car
INFO   | jvm 1    | 2011/07/13 20:21:44 |       at
java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:77)


Do I have to have any other dependency specified?  This is my
geronimo-service.xml

<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <environment>
        <moduleId>
            <groupId>aswin</groupId>
            <artifactId>sharedlib</artifactId>
            <version>1.0</version>
        </moduleId>
        <hidden-classes>
            <filter>com.thoughtworks.xstream</filter>
        </hidden-classes>
    </environment>
    <gbean name="SharedLib"
class="org.apache.geronimo.system.sharedlib.SharedLib">
        <attribute name="libDirs">myshare/lib</attribute>
        <reference name="ServerInfo">
            <name>ServerInfo</name>
        </reference>
    </gbean>
</module>



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3167951.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
You might need to deploy the jar file as those common java ee applications
:-)

2011/7/14 ashwin nair <ma...@gmail.com>

> Hi,
>    I created as jar file as you suggested under
> GERONIMO_HOME/repository/aswin/sharedlib/1.0/sharedlib-1.0.jar which has a
> META-INF folder in it with the content you mentioned and changed the
> dependency as follows.
>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0
> "
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>   <dep:environment>
>      <dep:moduleId>
>          <dep:groupId>Test</dep:groupId>
>         <dep:artifactId>test-CORE-ear</dep:artifactId>
>          <dep:version>1.0</dep:version>
>      </dep:moduleId>
>      <dep:dependencies>
>         <dep:dependency>
>             <dep:groupId>aswin</dep:groupId>
>             <dep:artifactId>sharedlib</dep:artifactId>
>             <dep:version>1.0</dep:version>
>             <dep:type>jar</dep:type>
>         </dep:dependency>
>         <dep:dependency>
>            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>            <dep:artifactId>tomcat6</dep:artifactId>
>            <dep:type>car</dep:type>
>         </dep:dependency>
>
>
> But I am getting Classnotfound exceptions for my servlets and such are not
> getting loaded.  I put a breakpoint in the
> org.apache.geronimo.system.sharedlib.SharedLib and am not seeing the
> configured path showing up, so I am guessing that my changes are not
> getting
> picked up.
>
> How do I configure the module, do I need to do anything in config.xml
> (GERONIMO_HOME/var/config/config.xml) but am getting errors saying it
> cannot
> find the path?
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3167853.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
Hi,
    I created as jar file as you suggested under
GERONIMO_HOME/repository/aswin/sharedlib/1.0/sharedlib-1.0.jar which has a
META-INF folder in it with the content you mentioned and changed the
dependency as follows. 

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" 
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
   <dep:environment>
      <dep:moduleId>
         <dep:groupId>Test</dep:groupId>
         <dep:artifactId>test-CORE-ear</dep:artifactId>
         <dep:version>1.0</dep:version>
      </dep:moduleId>
      <dep:dependencies>
         <dep:dependency>
            <dep:groupId>aswin</dep:groupId>
            <dep:artifactId>sharedlib</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>jar</dep:type>
         </dep:dependency>
         <dep:dependency>
            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
            <dep:artifactId>tomcat6</dep:artifactId>
            <dep:type>car</dep:type>
         </dep:dependency>


But I am getting Classnotfound exceptions for my servlets and such are not
getting loaded.  I put a breakpoint in the
org.apache.geronimo.system.sharedlib.SharedLib and am not seeing the
configured path showing up, so I am guessing that my changes are not getting
picked up. 

How do I configure the module, do I need to do anything in config.xml
(GERONIMO_HOME/var/config/config.xml) but am getting errors saying it cannot
find the path? 

--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3167853.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
OK, I have some ideas in my mind, but they are somewhat depending on your
scenario,
a. Create a geronimo service module as a customized shared lib component, it
is just a jar file with a META-INF folder, which contains a
geronimo-service.xml file, the content should be something like :
--->
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <environment>
        <moduleId>
            <groupId>org.apache.geronimo</groupId>
            <artifactId>mysharedlib</artifactId>
            <version>1.0</version>
        </moduleId>
        <hidden-classes>
            <filter>com.thoughtworks.xstream</filter>
        </hidden-classes>
    </environment>
    <gbean name="SharedLib"
class="org.apache.geronimo.system.sharedlib.SharedLib">
        <attribute name="classesDirs">var/shared/myclasses</attribute>
        <attribute name="libDirs">var/shared/mylib</attribute>
        <reference name="ServerInfo">
            <name>ServerInfo</name>
        </reference>
    </gbean>
</module>
<---
Then, places those jar files in the new folders, also change the dependency
configuration in your applications. With this solution, I think JasonUtils
should be able to initialize correctly. While the drawbacks are, your web
application could not use the xstream classes from the shared lib either, as
the filter string is configured. Removing the filter string will not make
sure the xstream class is loaded from shared lib, as they are more than one
parent classloader for your application.
b. You might also just configure a shared lib gbean in each your web
application, with that, all the jar files will be added to your web
applications classloaders, and with filter string, those xstream classes
could only be loaded from web applications themselves, while the problems is
that each web application will keep copies of those jar files in their own
classes realm, which means they are not shareable.
Hope it helps :-)

2011/7/13 ashwin nair <ma...@gmail.com>

> Yes, that's what I was theorizing in my original post. The question is how
> do
> I configure sharedlib to not load from its parent for those classes which
> is
> already under its scope. Is there a GBEAN configuration I can apply to it?
> If so I would be extremely thankful as I have spent enough time with this
> already. :)
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3164614.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
Yes, that's what I was theorizing in my original post. The question is how do
I configure sharedlib to not load from its parent for those classes which is
already under its scope. Is there a GBEAN configuration I can apply to it?
If so I would be extremely thankful as I have spent enough time with this
already. :)

--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3164614.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
2011/7/13 ashwin nair <ma...@gmail.com>

> I ran the following from a remote debug session
>
> System.out.printf("this.classloader = %s, this.parentClassloader = %s,
> xstream.classloader = %s, xstream.jar.location = %s \n",
>                JSONUtil.class.getClassLoader(),
>                JSONUtil.class.getClassLoader().getParent(),
>                com.thoughtworks.xstream.XStream.class.getClassLoader(),
>
> com.thoughtworks.xstream.XStream.class.getProtectionDomain().getCodeSource().getLocation());
>
>
   Where are the codes above and JASONUtils from ?  I guess that they are in
one of the jar files in the shared lib folder, right ?
   If it does, the result would make sense to me. As no filter rules is
configured on the shared lib, so it could load the xstream class from its
parent, system classloader. And, it seems that in the initialization
of JettisonMappedXmlDriver, it requires to load MappedXMLOutputFactory by
the system classloader, then Bang !


>
> and the output is
>
> this.classloader =
> [org.apache.geronimo.kernel.config.MultiParentClassLoader
> id=org.apache.geronimo.configs/sharedlib/2.2.1/car], this.parentClassloader
> = sun.misc.Launcher$AppClassLoader@7ff27ff2,  xstream.classloader =
> sun.misc.Launcher$AppClassLoader@7ff27ff2, xstream.jar.location =
> file:/ebay/v3app/CORE/lib/xstream-1.3.jar
>
>
> /ebay/v3app/CORE is the GERONIMO_HOME
>
> JSONUtil is the utility class where we have the following line
>
> XStream xstream = new XStream(new JettisonMappedXmlDriver());
>
> that fails with exception
> java.lang.NoClassDefFoundError:
> org/codehaus/jettison/mapped/MappedXMLOutputFactory
>        at
>
> com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.<init>(JettisonMappedXmlDriver.java:46)
>        at com.ebay.eskernel.util.JSONUtil.ObjToJSON(JSONUtil.java:132)
>
>
> I checked the config.ser, it has the filter definitions in it, I must have
> been sleeping when I first checked it.
>
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3163389.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
I ran the following from a remote debug session

System.out.printf("this.classloader = %s, this.parentClassloader = %s, 
xstream.classloader = %s, xstream.jar.location = %s \n", 
		JSONUtil.class.getClassLoader(),
		JSONUtil.class.getClassLoader().getParent(),
		com.thoughtworks.xstream.XStream.class.getClassLoader(),
com.thoughtworks.xstream.XStream.class.getProtectionDomain().getCodeSource().getLocation());


and the output is 

this.classloader = [org.apache.geronimo.kernel.config.MultiParentClassLoader
id=org.apache.geronimo.configs/sharedlib/2.2.1/car], this.parentClassloader
= sun.misc.Launcher$AppClassLoader@7ff27ff2,  xstream.classloader =
sun.misc.Launcher$AppClassLoader@7ff27ff2, xstream.jar.location =
file:/ebay/v3app/CORE/lib/xstream-1.3.jar


/ebay/v3app/CORE is the GERONIMO_HOME

JSONUtil is the utility class where we have the following line 

XStream xstream = new XStream(new JettisonMappedXmlDriver());

that fails with exception 
java.lang.NoClassDefFoundError:
org/codehaus/jettison/mapped/MappedXMLOutputFactory
        at
com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.<init>(JettisonMappedXmlDriver.java:46)
        at com.ebay.eskernel.util.JSONUtil.ObjToJSON(JSONUtil.java:132)


I checked the config.ser, it has the filter definitions in it, I must have
been sleeping when I first checked it. 


--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3163389.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
2011/7/12 ashwin nair <ma...@gmail.com>

> Thanks for checking this for me, but the I meant WEB-INF/lib only. The
> classloader that loads xstream.jar (on my remote debugging section) tells
> me
> its a   "system classloader", I will post the details of the exact string
> for the classloader I see when I am at my work computer later.
>
>
   That output does help to find the real problem.


> But something I figured out today is that I have a config.ser file in the
> path
>
> $GERONIMO_HOME/repository/xxx/path/to/package/version/package/META-INF/config.ser.
> This I understand is that serialized Gbean configuration, but i couldn't
> find any reference to hidden classes in this file, so I am suspecting that
> the configuration I mentioned earlier is not really being used. But it is
> getting parsed for sure, as any invalid changes I make up gets reported and
> Geronimo does not start. Is there a way to force configuration from getting
> picked up from the xml file or any way of confirming where it is picking it
> up from?
>
>
   Hmm, the filter string should be included in the serialized config.ser
file, so do you mean that the string could not be found while opening that
file in the text editor ?


> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3161489.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
Thanks for checking this for me, but the I meant WEB-INF/lib only. The
classloader that loads xstream.jar (on my remote debugging section) tells me
its a   "system classloader", I will post the details of the exact string
for the classloader I see when I am at my work computer later.

But something I figured out today is that I have a config.ser file in the
path
$GERONIMO_HOME/repository/xxx/path/to/package/version/package/META-INF/config.ser. 
This I understand is that serialized Gbean configuration, but i couldn't
find any reference to hidden classes in this file, so I am suspecting that
the configuration I mentioned earlier is not really being used. But it is
getting parsed for sure, as any invalid changes I make up gets reported and
Geronimo does not start. Is there a way to force configuration from getting
picked up from the xml file or any way of confirming where it is picking it
up from?  

--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3161489.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
The plan looks fine to me, so could you double check whether WEB-INF/libs is
a typo error or not ?
The simple way to verify it is, just print the classLoader of a class
belongs to the filtered list.

2011/7/12 ashwin nair <ma...@gmail.com>

> The following is the deployment plan I am using.  I am guessing that
> somehow
> this is not being honored, may be because of the config.ser for this module
> in the GERONIMO_REPOSITORY/path/to/ear/META-INF/config.ser.  Is there a way
> to ensure that the values are not getting picked up from there?
>
> <application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0
> "
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>   <dep:environment>
>      <dep:moduleId>
>         <dep:groupId>Ebay</dep:groupId>
>         <dep:artifactId>XXXXX</dep:artifactId>
>         <dep:version>1.0</dep:version>
>      </dep:moduleId>
>      <dep:dependencies>
>         <dep:dependency>
>            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>            <dep:artifactId>tomcat6</dep:artifactId>
>            <dep:type>car</dep:type>
>         </dep:dependency>
>         <dep:dependency>
>            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>            <dep:artifactId>sharedlib</dep:artifactId>
>            <dep:type>car</dep:type>
>         </dep:dependency>
>      </dep:dependencies>
>      <dep:hidden-classes>
>          <dep:filter>com.thoughtworks.xstream</dep:filter>
>          <dep:filter>org.codehaus.jettison</dep:filter>
>      </dep:hidden-classes>
>   </dep:environment>
>   <module>
>      <web>cmosprovsvc</web>
>      <web-app
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
>          <dep:environment>
>             <dep:hidden-classes>
>                <dep:filter>com.thoughtworks.xstream</dep:filter>
>                <dep:filter>org.codehaus.jettison</dep:filter>
>             </dep:hidden-classes>
>         </dep:environment>
>      </web-app>
>   </module>
>
>
> --
> View this message in context:
> http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3160476.html
> Sent from the Users mailing list archive at Nabble.com.
>



-- 
Ivan

Re: shared lib classloader XStream Jettison issue

Posted by ashwin nair <ma...@gmail.com>.
The following is the deployment plan I am using.  I am guessing that somehow
this is not being honored, may be because of the config.ser for this module
in the GERONIMO_REPOSITORY/path/to/ear/META-INF/config.ser.  Is there a way
to ensure that the values are not getting picked up from there?

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" 
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
   <dep:environment>
      <dep:moduleId>
         <dep:groupId>Ebay</dep:groupId>
         <dep:artifactId>XXXXX</dep:artifactId>
         <dep:version>1.0</dep:version>
      </dep:moduleId>
      <dep:dependencies>
         <dep:dependency>
            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
            <dep:artifactId>tomcat6</dep:artifactId>
            <dep:type>car</dep:type>
         </dep:dependency>
         <dep:dependency>
            <dep:groupId>org.apache.geronimo.configs</dep:groupId>
            <dep:artifactId>sharedlib</dep:artifactId>
            <dep:type>car</dep:type>
         </dep:dependency>     
      </dep:dependencies>
      <dep:hidden-classes>
          <dep:filter>com.thoughtworks.xstream</dep:filter>
          <dep:filter>org.codehaus.jettison</dep:filter>
      </dep:hidden-classes>
   </dep:environment>
   <module>
      <web>cmosprovsvc</web>
      <web-app
xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
          <dep:environment>
             <dep:hidden-classes>
                <dep:filter>com.thoughtworks.xstream</dep:filter>
                <dep:filter>org.codehaus.jettison</dep:filter>
             </dep:hidden-classes>
         </dep:environment>
      </web-app>
   </module>


--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/shared-lib-classloader-XStream-Jettison-issue-tp3150142p3160476.html
Sent from the Users mailing list archive at Nabble.com.

Re: shared lib classloader XStream Jettison issue

Posted by Ivan <xh...@gmail.com>.
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 <ke...@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