You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Iltchenko, Andrei" <An...@nl.compuware.com> on 2005/01/25 17:37:30 UTC

RE: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' fi les not found when packaged in an ejb-jar file.

Dims,

That's correct, changing it as follows (for example) will be sufficient to
address this bug. It's just that I think this fix might have more side
effects as the utility method is used for more purposes than finding client
configuration files.

    public static InputStream getResourceAsStream(Class clazz, String
resource) {
        InputStream myInputStream = null;

        if (Thread.currentThread().getContextClassLoader() != null) {
            // try the context class loader.
            myInputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)
;
        }
        if (myInputStream == null) {
            if (clazz.getClassLoader() != null) {
                // Try the class loader that loaded this class.
                myInputStream =
clazz.getClassLoader().getResourceAsStream(resource);
            } else {
                // Try the system class loader.
                myInputStream =
ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
            }
            if (myInputStream == null) {
                // if not found in classpath fall back to default
                myInputStream = clazz.getResourceAsStream(resource);
            }
        }
        return myInputStream;
    }

Regards,
Andrei.

-----Original Message-----
From: Davanum Srinivas [mailto:davanum@gmail.com] 
Sent: Tuesday, January 25, 2005 17:27
To: axis-dev@ws.apache.org
Subject: Re: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' fi
les not found when packaged in an ejb-jar file.

Andrei,

so that would work as well. right?

thanks,
dims


On Tue, 25 Jan 2005 16:51:45 +0100, Iltchenko, Andrei
<An...@nl.compuware.com> wrote:
> Dims,
> 
> If we address the problem in the way you want, we'll have to change the
> search order in 'ClassUtils#getResourceAsStream' so that it searches
through
> the thread context class loader first and only then tries the defining
class
> loader of 'clazz' (AxisEngine in our context). This might be a more
> intrusive and subtle change than adding 'EngineConfigurationFactoryEJB'
> given the number of users of the helper, but you know far better of
> course...
> 
> The current declaration:
>      public static InputStream getResourceAsStream(Class clazz, String
> resource) {
>         InputStream myInputStream = null;
> 
>         if(clazz.getClassLoader()!=null) {
>             // Try the class loader that loaded this class.
>             myInputStream =
> clazz.getClassLoader().getResourceAsStream(resource);
>         } else {
>             // Try the system class loader.
>             myInputStream =
> ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
>         }
>         if (myInputStream == null &&
> Thread.currentThread().getContextClassLoader() != null) {
>             // try the context class loader.
>             myInputStream =
>
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)
> ;
>         }
>         if (myInputStream == null) {
>             // if not found in classpath fall back to default
>             myInputStream = clazz.getResourceAsStream(resource);
>         }
>         return myInputStream;
>     }
> 
> Regards,
> Andrei.
> 
> -----Original Message-----
> From: Davanum Srinivas (JIRA) [mailto:axis-dev@ws.apache.org] 
> Sent: Tuesday, January 25, 2005 16:45
> To: andrei.iltchenko@nl.compuware.com
> Subject: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' files
> not found when packaged in an ejb-jar file.
> 
>      [
> http://issues.apache.org/jira/browse/AXIS-1776?page=comments#action_58043
]
> 
> Davanum Srinivas commented on AXIS-1776:
> ----------------------------------------
> 
> Andrei,
> 
> is it not enough to just change the order of how we look for the wsdd in
the
> classpath (see ClassUtils#getResourceAsStream). I'd like to keep the
> EngineConfigurationFactoryDefault as-is, get rid of the extra
> EngineConfigurationFactoryEJB and change already existing code.
> 
> thanks,
> dims
> 
> > Client configuration '.wsdd' files not found when packaged in an ejb-jar
> file.
> >
>
----------------------------------------------------------------------------
> --
> >
> >          Key: AXIS-1776
> >          URL: http://issues.apache.org/jira/browse/AXIS-1776
> >      Project: Axis
> >         Type: Bug
> >   Components: Deployment / Registries
> >     Versions: current (nightly)
> >  Environment: An EJB 2.0 compliant EJB container.
> >     Reporter: Andrei Iltchenko
> >  Attachments: 1776.jar, 1776.txt, 1776.txt
> >
> > When run from within an EJB container, Axis cannot find a client
> configuration '.wsdd' file when the latter is packaged as part of an
ejb-jar
> file and the Application server uses distinct class loaders per ejb-jar of
a
> J2EE application. As a result the default client configuration file from
> 'org/apache/axis/client/client-config.wsdd' gets picked up, which doesn't
> necessarily contain the configuration needed.
> > The problem is essentially caused by us not having an
> 'EngineConfigurationFactory' that is capable of finding resources through
> the context class loader. The patch that I am going to supply addresses
the
> problem and has been tested on WebLogic 8.x and Jboss 3.x.x.
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> If you want more information on JIRA, or have a bug to report see:
>    http://www.atlassian.com/software/jira
> 
> --
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
> 
> 


-- 
Davanum Srinivas - http://webservices.apache.org/~dims/


-- 
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


Re: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' fi les not found when packaged in an ejb-jar file.

Posted by Davanum Srinivas <da...@gmail.com>.
Andrei,

yep. iknow.  that's why am adding a new method where the thread
context class loader is checked first....and this method will be used
only in FileProvider. am running the tests now. and will check in the
fix after that.

thanks,
dims


On Tue, 25 Jan 2005 17:37:30 +0100, Iltchenko, Andrei
<An...@nl.compuware.com> wrote:
> Dims,
> 
> That's correct, changing it as follows (for example) will be sufficient to
> address this bug. It's just that I think this fix might have more side
> effects as the utility method is used for more purposes than finding client
> configuration files.
> 
>     public static InputStream getResourceAsStream(Class clazz, String
> resource) {
>         InputStream myInputStream = null;
> 
>         if (Thread.currentThread().getContextClassLoader() != null) {
>             // try the context class loader.
>             myInputStream =
> Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)
> ;
>         }
>         if (myInputStream == null) {
>             if (clazz.getClassLoader() != null) {
>                 // Try the class loader that loaded this class.
>                 myInputStream =
> clazz.getClassLoader().getResourceAsStream(resource);
>             } else {
>                 // Try the system class loader.
>                 myInputStream =
> ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
>             }
>             if (myInputStream == null) {
>                 // if not found in classpath fall back to default
>                 myInputStream = clazz.getResourceAsStream(resource);
>             }
>         }
>         return myInputStream;
>     }
> 
> Regards,
> Andrei.
> 
> -----Original Message-----
> 
> From: Davanum Srinivas [mailto:davanum@gmail.com]
> Sent: Tuesday, January 25, 2005 17:27
> To: axis-dev@ws.apache.org
> Subject: Re: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' fi
> les not found when packaged in an ejb-jar file.
> 
> Andrei,
> 
> so that would work as well. right?
> 
> thanks,
> dims
> 
> On Tue, 25 Jan 2005 16:51:45 +0100, Iltchenko, Andrei
> <An...@nl.compuware.com> wrote:
> > Dims,
> >
> > If we address the problem in the way you want, we'll have to change the
> > search order in 'ClassUtils#getResourceAsStream' so that it searches
> through
> > the thread context class loader first and only then tries the defining
> class
> > loader of 'clazz' (AxisEngine in our context). This might be a more
> > intrusive and subtle change than adding 'EngineConfigurationFactoryEJB'
> > given the number of users of the helper, but you know far better of
> > course...
> >
> > The current declaration:
> >      public static InputStream getResourceAsStream(Class clazz, String
> > resource) {
> >         InputStream myInputStream = null;
> >
> >         if(clazz.getClassLoader()!=null) {
> >             // Try the class loader that loaded this class.
> >             myInputStream =
> > clazz.getClassLoader().getResourceAsStream(resource);
> >         } else {
> >             // Try the system class loader.
> >             myInputStream =
> > ClassLoader.getSystemClassLoader().getResourceAsStream(resource);
> >         }
> >         if (myInputStream == null &&
> > Thread.currentThread().getContextClassLoader() != null) {
> >             // try the context class loader.
> >             myInputStream =
> >
> Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)
> > ;
> >         }
> >         if (myInputStream == null) {
> >             // if not found in classpath fall back to default
> >             myInputStream = clazz.getResourceAsStream(resource);
> >         }
> >         return myInputStream;
> >     }
> >
> > Regards,
> > Andrei.
> >
> > -----Original Message-----
> > From: Davanum Srinivas (JIRA) [mailto:axis-dev@ws.apache.org]
> > Sent: Tuesday, January 25, 2005 16:45
> > To: andrei.iltchenko@nl.compuware.com
> > Subject: [jira] Commented: (AXIS-1776) Client configuration '.wsdd' files
> > not found when packaged in an ejb-jar file.
> >
> >      [
> > http://issues.apache.org/jira/browse/AXIS-1776?page=comments#action_58043
> ]
> >
> > Davanum Srinivas commented on AXIS-1776:
> > ----------------------------------------
> >
> > Andrei,
> >
> > is it not enough to just change the order of how we look for the wsdd in
> the
> > classpath (see ClassUtils#getResourceAsStream). I'd like to keep the
> > EngineConfigurationFactoryDefault as-is, get rid of the extra
> > EngineConfigurationFactoryEJB and change already existing code.
> >
> > thanks,
> > dims
> >
> > > Client configuration '.wsdd' files not found when packaged in an ejb-jar
> > file.
> > >
> >
> ----------------------------------------------------------------------------
> > --
> > >
> > >          Key: AXIS-1776
> > >          URL: http://issues.apache.org/jira/browse/AXIS-1776
> > >      Project: Axis
> > >         Type: Bug
> > >   Components: Deployment / Registries
> > >     Versions: current (nightly)
> > >  Environment: An EJB 2.0 compliant EJB container.
> > >     Reporter: Andrei Iltchenko
> > >  Attachments: 1776.jar, 1776.txt, 1776.txt
> > >
> > > When run from within an EJB container, Axis cannot find a client
> > configuration '.wsdd' file when the latter is packaged as part of an
> ejb-jar
> > file and the Application server uses distinct class loaders per ejb-jar of
> a
> > J2EE application. As a result the default client configuration file from
> > 'org/apache/axis/client/client-config.wsdd' gets picked up, which doesn't
> > necessarily contain the configuration needed.
> > > The problem is essentially caused by us not having an
> > 'EngineConfigurationFactory' that is capable of finding resources through
> > the context class loader. The patch that I am going to supply addresses
> the
> > problem and has been tested on WebLogic 8.x and Jboss 3.x.x.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> >    http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > If you want more information on JIRA, or have a bug to report see:
> >    http://www.atlassian.com/software/jira
> >
> > --
> > The contents of this e-mail are intended for the named addressee only. It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> 
> --
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> 
> --
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or disclose
> it to anyone else. If you received it in error please notify us immediately
> and then destroy it.
> 
> 


-- 
Davanum Srinivas - http://webservices.apache.org/~dims/