Apache

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Classpath for Axis code running inside an .aar?

    8 answers - 1269 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my own
    code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.
    When I move my applicationContext.xml to the Axis WEB-INF/classes directory,
    then Spring can find it, which is consistent with the behaviour above.
    However, it then can't load any of my application classes - presumably
    because they're not on the classpath available to my application.
    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!
    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?
    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)
    Cheers
    Inigo
  • No.1 | | 1447 bytes | |

    Please log a JIRA bug. Looks serious.

    thanks,
    dims

    1/18/06, Inigo Surguy <inigosurguy (AT) hotmail (DOT) comwrote:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my own
    code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes directory,
    then Spring can find it, which is consistent with the behaviour above.
    However, it then can't load any of my application classes - presumably
    because they're not on the classpath available to my application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    >
    >
    >
  • No.2 | | 2030 bytes | |

    Hi Inigo,

    Can you please try including all the libraries used by your
    application in a 'lib' directory in the .aar file. (Example: spring
    jars). And then all the resource files can be included in the .aar
    file itself.

    foo.aar
    |
    lib/
    | |
    | spring.jar
    | xyz.jar
    |
    META-INF/services.xml
    |
    bar-config.properties
    bar-config1.xml
    |
    **/*.class files of foo service

    This is the way we support packaging a web service and its related
    resources and libraries in a .aar. Please try it out and let us know
    if there's a problem :-)

    Thanks,
    Ruchith

    1/18/06, Inigo Surguy <inigosurguy (AT) hotmail (DOT) comwrote:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my own
    code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes directory,
    then Spring can find it, which is consistent with the behaviour above.
    However, it then can't load any of my application classes - presumably
    because they're not on the classpath available to my application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    >
    >
    >
  • No.3 | | 2193 bytes | |

    Hi Inigo,

    I also use Spring with Axis2, but in general I haven't trusted the aar
    classloader due to some early problems around the .92 frame.

    So I use a bare bones aar structure:

    /META-INF
    /META-INF/MANIFEST.MF

    /META-INF/services.xml
    /com
    /com/siemens
    /com/siemens/swa
    /com/siemens/swa/webservices

    And put the rest of the classes - several hundred or so as its a big web app
    and web services are only one part - into WEB-INF/classes . All the spring
    etc jars go into WEB-INF/lib .

    As far as spring goes, any bean dependencies in the skeleton are resolved with
    an object factory. The rest of the beans, transactions for hibernate etc, get
    loaded via web.xml, applicationContext.xml, serviceContext.xml etc as one
    normally would do with Spring.

    HTH,
    iksrazal

    Em Quarta 18 Janeiro 2006 12:55, o Inigo Surguy escreveu:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my
    own code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes
    directory, then Spring can find it, which is consistent with the behaviour
    above. However, it then can't load any of my application classes -
    presumably because they're not on the classpath available to my
    application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    --
  • No.4 | | 2456 bytes | |

    I don't mean to sound negative, but what is the purpose of the aar archive
    format? Why not just use the simple deployment model like axis 1.x?

    1/18/06, iksrazal <iksrazal (AT) gmail (DOT) comwrote:

    Hi Inigo,

    I also use Spring with Axis2, but in general I haven't trusted the aar
    classloader due to some early problems around the .92 frame.

    So I use a bare bones aar structure:

    ./META-INF
    ./META-INF/MANIFEST.MF

    ./META-INF/services.xml
    ./com
    ./com/siemens
    ./com/siemens/swa
    ./com/siemens/swa/webservices

    And put the rest of the classes - several hundred or so as its a big web
    app
    and web services are only one part - into WEB-INF/classes . All the
    spring
    etc jars go into WEB-INF/lib .

    As far as spring goes, any bean dependencies in the skeleton are resolved
    with
    an object factory. The rest of the beans, transactions for hibernate etc,
    get
    loaded via web.xml, applicationContext.xml, serviceContext.xml etc as one
    normally would do with Spring.

    HTH,
    iksrazal

    Em Quarta 18 Janeiro 2006 12:55, o Inigo Surguy escreveu:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file
    from
    the classpath, it doesn't work. When I try to access the classpath in my
    own code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't
    find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes
    directory, then Spring can find it, which is consistent with the
    behaviour
    above. However, it then can't load any of my application classes -
    presumably because they're not on the classpath available to my
    application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar
    onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo

    --
  • No.5 | | 2366 bytes | |

    Hi;

    first its not bug in Axis2 , that is because we have concept call Service
    isolation , there each service get its own classloder and which is created
    using the archive file. So if you want to get some resources in archive file
    you need to get the class loader from corresponding service and then load
    your resources.

    But in Spring case as I know you can not give that guy a class loader , what
    it does is it gets the context class loader and try to load resources from
    that. Since service has its own class loader you can not get service
    resources from context class loader.

    In that scenario the best way is put your those resources in WEB-INF/lib in
    that case CCL will have access to those.

    Thanks,
    Deepal

    ~Future is ~

    Message
    From: "Inigo Surguy" <inigosurguy (AT) hotmail (DOT) com>
    To: <axis-user (AT) ws (DOT) apache.org>
    Sent: Wednesday, January 18, 2006 8:55 PM
    Subject: [Axis2-0.94] Classpath for Axis code running inside an .aar?

    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my
    own code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes
    directory, then Spring can find it, which is consistent with the behaviour
    above. However, it then can't load any of my application classes -
    presumably because they're not on the classpath available to my
    application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    >
    >
    >
  • No.6 | | 1898 bytes | |

    hi dims;

    that s not a bug in Axis2 , to be fix , he is getting that error due to
    service isolation that's an Axis2 feature.

    Thanks,
    Deepal

    ~Future is ~

    Message
    From: "Davanum Srinivas" <davanum (AT) gmail (DOT) com>
    To: <axis-user (AT) ws (DOT) apache.org>
    Sent: Wednesday, January 18, 2006 9:40 PM
    Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?

    Please log a JIRA bug. Looks serious.

    thanks,
    dims

    1/18/06, Inigo Surguy <inigosurguy (AT) hotmail (DOT) comwrote:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my
    own
    code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes
    directory,
    then Spring can find it, which is consistent with the behaviour above.
    However, it then can't load any of my application classes - presumably
    because they're not on the classpath available to my application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    >
    >
    >
  • No.7 | | 1589 bytes | |

    Inigo,

    clearly we need to fix this so that there are no surprises like u had.
    So please log a bug so that we can debate on axis-dev@

    thanks,
    dims

    1/19/06, Inigo Surguy <inigosurguy (AT) hotmail (DOT) comwrote:

    Hi Deepal,
    >
    >But in Spring case as I know you can not give that guy a class loader ,
    >what it does is it gets the context class loader and try to load resources
    >from that. Since service has its own class loader you can not get service
    >resources from context class loader.
    >

    Yes, that's right. Isn't the bug then that the contextClassLoader for
    a service is the WebappClassLoader rather than the DeploymentClassLoader?
    The context of the service should be the deployed .AAR, so code
    within the .AAR that loads classes and resources from the classpath will
    try to get it first from the .AAR.
    >
    >In that scenario the best way is put your those resources in WEB-INF/lib in
    >that case CCL will have access to those.
    >

    Yes - that would work - but it would amount to putting almost my entire
    service in the WEB-INF/lib directory, which defeats the point of having an
    .AAR in the first place.

    Another workaround, which is what I'm using at the moment and seems
    to work, is to explicitly set the context classloader to be the class
    classloader with:

    Thread.currentThread().setContextClassLoader(());

    Cheers

    Inigo
    >
    >
    >
  • No.8 | | 2205 bytes | |

    Deepal,

    Service isolation does not mean that resources present in aar should
    not be available to the services themselves. there is a hole, we need
    to figure out how to fix it.

    thanks,
    dims

    1/18/06, Deepal Jayasinghe <deepal (AT) opensource (DOT) lkwrote:
    hi dims;

    that s not a bug in Axis2 , to be fix , he is getting that error due to
    service isolation that's an Axis2 feature.

    Thanks,
    Deepal

    ~Future is ~

    Message
    From: "Davanum Srinivas" <davanum (AT) gmail (DOT) com>
    To: <axis-user (AT) ws (DOT) apache.org>
    Sent: Wednesday, January 18, 2006 9:40 PM
    Subject: Re: [Axis2-0.94] Classpath for Axis code running inside an .aar?
    --
    Please log a JIRA bug. Looks serious.

    thanks,
    dims

    1/18/06, Inigo Surguy <inigosurguy (AT) hotmail (DOT) comwrote:
    Hi,

    I've deployed a .aar to Axis 2, and I'm trying to use Spring within it.
    However, when Spring tries to access it's applicationContext.xml file from
    the classpath, it doesn't work. When I try to access the classpath in my
    own
    code, using MResource() or
    Thread.currentThread().getContextClassLoader().get Resource(), I can't find
    the file either; and when I check the classloader roots of the current
    context classloader, it only shows Tomcat
    5.5\webapps\axis2_094\WEB-INF\classes - and not the .aar itself.

    When I move my applicationContext.xml to the Axis WEB-INF/classes
    directory,
    then Spring can find it, which is consistent with the behaviour above.
    However, it then can't load any of my application classes - presumably
    because they're not on the classpath available to my application.

    I can presumably solve this by moving all of my code into the Axis
    WEB-INF/lib directory - but this defeats the point of having an .aar!

    What am I doing wrong, please? How can I get the contents of the .aar onto
    the classpath of classes within that .aar?

    (I'm running Axis 0.94 inside Tomcat 5.5.12 on Windows XP with JDK 1.5)

    Cheers

    Inigo
    >
    >
    >
    >
    >

Re: Classpath for Axis code running inside an .aar?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Apache"

EMSDN.COM