Hi Lubaki,

This is really weird: I have just done a couple of tests and I have not been able to reproduce your problem. Basically, in an EJB I have this code:

       XStream stream = new XStream();
       stream.toXML("test");

In the OpenEJB DD, I have this:

<openejb-jar
   xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0";
   configId="clusteredSFSB"
   parentId="ejbCluster"
   inverseClassloading="true">

   <dependency>
       <groupId>xstream</groupId>
       <type>jar</type>
       <artifactId>xstream</artifactId>
       <version>1.0.2</version>
   </dependency>
<hidden-classes>
       <filter>com.thoughtworks.xstream.XStream</filter>
   </hidden-classes>

I call this EJB from an EJB client like this:
       Properties p = new Properties();
p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
       p.put("java.naming.provider.url", "127.0.0.1:4201");
       p.put("java.naming.security.principal", "myuser");
       p.put("java.naming.security.credentials", "mypass");
InitialContext ctx = new InitialContext(p); BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("client/clustertest/BasicStatefulHome");
       BasicStatefulObject object = home.create();
       object.setState("my state");

The CL of Xtream is the CL of the EJB module. I have remove the <dependency> from the OpenEJB DD, a ClassNotFoundError is thrown as expected.

Also, note that as inverseClassloading is set to "true", classloading is inversed. As a consequence, you do not really need to define a hidden-classes element.

Could you please send me a EJB reproducing this problem such that I can backtrack it?

Thanks,
Gianny

lubaki nsele wrote:

Gianny,

Using Geronimo 1.0, I am still having the same issue. Here an example of the config file. It (Geronimo Classloader) did not filter XStream. Similarly with axis..........

Lubaki

<?xml version="1.0"?>
<openejb-jar
    xmlns="http://www.openejb.org/xml/ns/openejb-jar";
    configId="com/nsele/atl/odonEJB"
    parentId="geronimo/j2ee-server/1.0/car"
    inverseClassloading="true">
<hidden-classes>
          <filter>com.thoughtworks.xstream.XStream</filter>
     </hidden-classes>
    <enterprise-beans>
        <session>
            <ejb-name>Odon</ejb-name>
<local-jndi-name>
                 ejb/OdonHome
</local-jndi-name> <resource-ref>
             <ref-name>jdbc/dbDS</ref-name>
             <resource-link>dbDS</resource-link>
         </resource-ref>
         </session>
         <session>

    ------------------------------------------------------------------------
    From:  /Gianny Damour <[EMAIL PROTECTED]>/
    Reply-To:  /user@geronimo.apache.org/
    To:  /user@geronimo.apache.org/
    Subject:  /Re: Geronimo ClassLoader Architecture/
    Date:  /Tue, 13 Dec 2005 22:53:59 +1100/
    >Thanks for this test.
    >
    >Could you please confirm that the Axis jar is defined as a
    >dependency or include? If yes, then I'm afraid I will need a sample
    >EJB module that I could use to track the problem.
    >
    >BTW, there is also a "hidden-classes" element which can be used to
    >declare classes hidden from this configuration:
    >
    ><openejb-jar
    >    xmlns="http://www.openejb.org/xml/ns/openejb-jar";
    >    configId="com/nsele/atl/odonEJB"
    >    inverseClassloading="true">
    >   <hidden-classes>
    >      <filter>org.apache.axis</filter>
    >   </hidden-classes>
    >
    >Could you please give it a give try?
    >
    >Thanks,
    >Gianny
    >
    >lubaki nsele wrote:
    >
    >>Gianny, This did not work; it is still loading the parent
    >>classloader before the child.
    >>
    >>1) Tried first the ejb plan   It did not work
    >>
    >>2) Tried geronimo-application in the EAR where the ejb is one of
    >>the modules; It did not work
    >>
    >>openejb file
    >>
    >>  <?xml version="1.0"?>
    >><openejb-jar
    >>     xmlns="http://www.openejb.org/xml/ns/openejb-jar";
    >>     configId="com/nsele/atl/odonEJB"
    >>     inverseClassloading="true">
    >>
    >>
    >>  Here is my configuration in geronimo-application.xml in EAR;
    >>
    >><?xml version="1.0" encoding="UTF-8"?>
    >><application
    >>     xmlns="http://geronimo.apache.org/xml/ns/j2ee/application";
    >>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0";
    >>         configId="com/nsele/atl/odon"
    >>         inverseClassloading="true">
    >>
>> >>------------------------------------------------------------------------
    >>     From:  /Gianny Damour <[EMAIL PROTECTED]>/
    >>     Reply-To:  /user@geronimo.apache.org/
    >>     To:  /user@geronimo.apache.org/
    >>     Subject:  /Re: Geronimo ClassLoader Architecture/
    >>     Date:  /Tue, 13 Dec 2005 09:02:06 +1100/
    >>     >Hi Lubaki,
    >>     >
    >>     >You can use the optional attribute "inverseClassloading" at
    >>the
    >>     >configuration level to force a child first class loading:
    >>     >
    >>     ><openejb-jar
    >>xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0";
    >>     >  configId="your id"
    >>     >  inverseClassloading="true">
    >>     >
    >>     >When set to true, classes defined by this configuraton take
    >>     >precedence over the classes defined by the parent
    >>configurations.
    >>     >
    >>     >Thanks,
    >>     >Gianny
    >>     >
    >>     >
    >>     >lubaki nsele wrote:
    >>     >
    >>     >>Geronimo classloader makes available all classes loaded by
    >>     >>org/apache/geronimo/Server to his children. This is a huge
    >>issue
    >>     >>because Geronimo uses a different library that I am using
    >>with EJB      >>application. For example, I am usiing axis1.0 and
    >>Geronimo server
    >>     >>is using axis-1.3GerXXXX.  This discussion had been
    >>discussed in
    >>     >>the following threads
>> >> >>
    >>http://mail-archives.apache.org/mod_mbox/geronimo-dev/200506.mbox/[EMAIL 
PROTECTED]
    >>     >>
>> >> >>http://blog.gmane.org/gmane.comp.java.geronimo.devel/day=20050617
    >>     >>   IS anyone knows the fix to this or how to overcome this
    >>issue?
    >>     >>  Lubaki
    >>     >
    >>     >
    >>     >
    >>
    >
    >



Reply via email to