You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gunith Devasurendra <gu...@gmail.com> on 2012/07/15 04:09:57 UTC

What's the best place to keep the libraries of an Axis2 service?

Hi all,

The topic sums it up. My problem is, I don't want to clog the
AXIS2_HOME/lib with my app specific libraries.

Any thoughts are appreciated.

Thanks!

Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර

gunith.com *|* linkedin <http://linkedin.com/in/gunith> *|*
facebook<http://facebook.com/gunith>
*|* google+ <http://gplus.to/gunith> *|* twitter <http://twitter.com/gunith>
*|* flickr <http://flickr.com/people/gunith> *|* foss.lk
*Everything eventually becomes a past...*

Re: What's the best place to keep the libraries of an Axis2 service?

Posted by Gunith Devasurendra <gu...@gmail.com>.
Thanks Martin for your quick reply.

I use Spring NoClassDefFoundError. So I added both spring-context and also
spring-context-
sources (Although I am not sure why I should add the sources jar). But
unfortunately I get a different 3.2.0.M1 for a different class,

java.lang.NoClassDefFoundError:
org/springframework/core/env/EnvironmentCapable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1960)
    at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:933)
....

Seems the core problem I have is loading Spring and Hibernate at the app
startup. What is the cleanest way of doing this?

Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර

gunith.com *|* linkedin <http://linkedin.com/in/gunith> *|*
facebook<http://facebook.com/gunith>
*|* google+ <http://gplus.to/gunith> *|* twitter <http://twitter.com/gunith>
*|* flickr <http://flickr.com/people/gunith> *|* foss.lk
*Everything eventually becomes a past...*



On Tue, Jul 17, 2012 at 7:50 AM, Martin Gainty <mg...@hotmail.com> wrote:

> spring-context-2.5.6.jar

RE: What's the best place to keep the libraries of an Axis2 service?

Posted by Martin Gainty <mg...@hotmail.com>.
if your Implementing Container is CATALINA 
with Spring Version 2.5.6 make sure spring-context-2.5.6.jar is in WEB-INF\lib
with Spring Version 3.0.0.M4 make sure org.springframework.context-sources-3.0.0.M4.jar is in WEB-INF\lib  

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: gunith@gmail.com
Date: Tue, 17 Jul 2012 07:38:44 +0530
Subject: Re: What's the best place to keep the libraries of an Axis2 service?
To: java-user@axis.apache.org

Thanks Deepal for your quick response! 

But I'm trying to use Spring with Hibernate and its giving issues. (I use an edit of the Spring POJO example from the Axis2 samples.) 



When tomcat starts it gives the following in catalina.out.

[INFO] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@11e831: startup date [Tue Jul 17 06:40:23 IST 2012]; root of context hierarchy

[INFO] Loading XML bean definitions from class path resource [applicationContext.xml][INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c794cc: defining beans [applicationContext,weatherSpringService,weatherBean,mysqlDataSource,sessionFactory,employeeDao,employeeBusiness,employeeService]; root of factory hierarchy

[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c794cc: defining beans [applicationContext,weatherSpringService,weatherBean,mysqlDataSource,sessionFactory,employeeDao,employeeBusiness,employeeService]; root of factory hierarchy

org.apache.axis2.deployment.DeploymentException: Error loading class [org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder] for bean with name 'applicationContext' defined in class path resource [applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware

    at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:150)    at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)

    at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)

    at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)    at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)

    at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)    ...............




My expanded AAR looks like this now,
.
├── applicationContext.xml
├── gunith
│   └── hrapp
│       ├── business
│       │   ├── ....
│       └── service
│           ├── Axis2SpringContextHolder.class


│           ├── BasicEmployeeService.class
│           ├── EmployeeService.class
│           └── SpringInit.class
├── lib
│   ├── ...
│   ├── axis2-spring-1.6.2.jar
│   ├── ....
│   ├── hibernate3.jar


│   ├── hibernate-annotations.jar
│   ├── hibernate-commons-annotations.jar
│   ├── hibernate-entitymanager.jar
│   ├── ...
│   ├── spring-asm-3.2.0.M1.jar
│   ├── spring-beans-3.2.0.M1.jar
│   ├── spring-context-3.2.0.M1.jar


│   ├── spring-context-support-3.2.0.M1.jar
│   ├── spring-core-3.2.0.M1.jar
│   ├── spring-expression-3.2.0.M1.jar
│   ├── spring-jdbc-3.2.0.M1.jar
│   ├── spring-orm-3.2.0.M1.jar
│   ├── spring-tx-3.2.0.M1.jar


│   ├── ....
├── META-INF
│   ├── MANIFEST.MF
│   └── services.xml

I also tried having my lib in the services folder, still with no luck.

I Googled up this issue and read that it could be a class loader issue. So I tried the solution in http://old.nabble.com/RE%3A-Problem-with-Using-Spring-and-Hibernate-with-Axis2-p14038959.html . But unfortunately I'm still getting the same issue. I attached my SpringInit and my services.xml. Any suggestions on what I'm doing wrong?



Also in the same thread (http://old.nabble.com/RE%3A-Problem-with-Using-Spring-and-Hibernate-with-Axis2-p14094348.html) they recommend having a non-AAR approach for deployment. Appreciate if you can direct me to a place with proper instructions.



Thanks a lot! Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර

gunith.com | linkedin | facebook | google+ | twitter | flickr | foss.lk


Everything eventually becomes a past...



On Sun, Jul 15, 2012 at 9:16 AM, Deepal jayasinghe <de...@gmail.com> wrote:



  
    
  
  
    You can put all your (service specific) libraries to service archive
    file itself. Have a look at the following:

    

    http://www.ibm.com/developerworks/library/ws-axis2soap/index.html

    

    Deepal 

    Hi all,

            

            The topic sums it up. My problem is, I don't want to clog
            the AXIS2_HOME/lib with my app specific libraries.

            

            Any thoughts are appreciated.

            

            Thanks!
           
      Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර
      
      gunith.com | linkedin | facebook | google+ | twitter | flickr
        | foss.lk



        Everything eventually
            becomes a past...
      

    
    

  




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org 		 	   		  

Re: What's the best place to keep the libraries of an Axis2 service?

Posted by Gunith Devasurendra <gu...@gmail.com>.
Thanks Deepal for your quick response!

But I'm trying to use Spring with Hibernate and its giving issues. (I use
an edit of the Spring POJO example from the Axis2 samples.)

When tomcat starts it gives the following in catalina.out.

[INFO] Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@11e831:
startup date [Tue Jul 17 06:40:23 IST 2012]; root of context hierarchy
[INFO] Loading XML bean definitions from class path resource
[applicationContext.xml]
[INFO] *Pre-instantiating singletons* in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1c794cc:
defining beans
[applicationContext,weatherSpringService,weatherBean,mysqlDataSource,sessionFactory,employeeDao,employeeBusiness,employeeService];
root of factory hierarchy
[INFO] *Destroying singletons* in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1c794cc:
defining beans
[applicationContext,weatherSpringService,weatherBean,mysqlDataSource,sessionFactory,employeeDao,employeeBusiness,employeeService];
root of factory hierarchy
org.apache.axis2.deployment.DeploymentException: *Error loading class
*[org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder]
for bean with name 'applicationContext' defined in class path resource
[applicationContext.xml]: problem with class file or dependent class;
nested exception is java.lang.NoClassDefFoundError: *
org/springframework/context/ApplicationContextAware*
    at
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:150)
    at
org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
    at
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
    at
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
    at
org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
    at
org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
    at
org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
    ...............


My expanded AAR looks like this now,
.
├── applicationContext.xml
├── gunith
│   └── hrapp
│       ├── business
│       │   ├── ....
│       └── service
│           ├── Axis2SpringContextHolder.class
│           ├── BasicEmployeeService.class
│           ├── EmployeeService.class
│           └── SpringInit.class
├── lib
│   ├── ...
│   ├── axis2-spring-1.6.2.jar
│   ├── ....
│   ├── hibernate3.jar
│   ├── hibernate-annotations.jar
│   ├── hibernate-commons-annotations.jar
│   ├── hibernate-entitymanager.jar
│   ├── ...
│   ├── spring-asm-3.2.0.M1.jar
│   ├── spring-beans-3.2.0.M1.jar
│   ├── spring-context-3.2.0.M1.jar
│   ├── spring-context-support-3.2.0.M1.jar
│   ├── spring-core-3.2.0.M1.jar
│   ├── spring-expression-3.2.0.M1.jar
│   ├── spring-jdbc-3.2.0.M1.jar
│   ├── spring-orm-3.2.0.M1.jar
│   ├── spring-tx-3.2.0.M1.jar
│   ├── ....
├── META-INF
│   ├── MANIFEST.MF
│   └── services.xml

I also tried having my lib in the services folder, still with no luck.

I Googled up this issue and read that it could be a class loader issue. So
I tried the solution in
http://old.nabble.com/RE%3A-Problem-with-Using-Spring-and-Hibernate-with-Axis2-p14038959.html.
But unfortunately I'm still getting the same issue. I attached my
SpringInit and my services.xml. Any suggestions on what I'm doing wrong?

Also in the same thread (
http://old.nabble.com/RE%3A-Problem-with-Using-Spring-and-Hibernate-with-Axis2-p14094348.html)
they recommend having a non-AAR approach for deployment. Appreciate if you
can direct me to a place with proper instructions.

Thanks a lot!

Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර

gunith.com *|* linkedin <http://linkedin.com/in/gunith> *|*
facebook<http://facebook.com/gunith>
*|* google+ <http://gplus.to/gunith> *|* twitter <http://twitter.com/gunith>
*|* flickr <http://flickr.com/people/gunith> *|* foss.lk
*Everything eventually becomes a past...*



On Sun, Jul 15, 2012 at 9:16 AM, Deepal jayasinghe <de...@gmail.com>wrote:

>  You can put all your (service specific) libraries to service archive file
> itself. Have a look at the following:
>
> http://www.ibm.com/developerworks/library/ws-axis2soap/index.html
>
> Deepal
>
> Hi all,
>
> The topic sums it up. My problem is, I don't want to clog the
> AXIS2_HOME/lib with my app specific libraries.
>
> Any thoughts are appreciated.
>
> Thanks!
>
> Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර
>
> gunith.com *|* linkedin <http://linkedin.com/in/gunith> *|* facebook<http://facebook.com/gunith>
> *|* google+ <http://gplus.to/gunith> *|* twitter<http://twitter.com/gunith>
> *|* flickr <http://flickr.com/people/gunith> *|* foss.lk
> *Everything eventually becomes a past...*
>
>
>

Re: What's the best place to keep the libraries of an Axis2 service?

Posted by Deepal jayasinghe <de...@gmail.com>.
You can put all your (service specific) libraries to service archive
file itself. Have a look at the following:

http://www.ibm.com/developerworks/library/ws-axis2soap/index.html

Deepal
> Hi all,
>
> The topic sums it up. My problem is, I don't want to clog the
> AXIS2_HOME/lib with my app specific libraries.
>
> Any thoughts are appreciated.
>
> Thanks!
>  
> Gunith Devasurendra  - ගුණිත් දේවසුරේන්ද්‍ර
>
> gunith.com <http://gunith.com> *|* linkedin
> <http://linkedin.com/in/gunith> *|*facebook
> <http://facebook.com/gunith> *|*google+ <http://gplus.to/gunith>
> *|*twitter <http://twitter.com/gunith> *|*flickr
> <http://flickr.com/people/gunith> *|*foss.lk <http://foss.lk>
> /*Everything eventually becomes a past...*/
>