Thursday, October 1, 2009

Axis2 Hierarchical Service Deployment

Axis2 has a concept of a service archive (.aar). After introducing the custom deployers even users can deploy different types of files as services. (eg. .class and .jar for jaxws services).
But until recently all those service files had to kept in the services folder or respective other service folders. This may not efficient in managing a lot of services. With the introduction of hierarchical service deployment it is possible to keep the directory structure under the services folder and the folder structure is reflect in the service epr as well.

eg. one can have services like this.




Epr for the PingService is

As seen in the last two lines this feature can be used for version management as well. Different version of the same service can be deployed and Epr is generated accordingly.



Anonymous said...

Hi Amila!

Thanx for your blog, it is really helpful.

However I cannot solve a problem with the help of it. I am new to Axis2 and I want to deploy my webservice in glassfish. My problem is that from my webservice I would like to call an EJB class, so if I uderstood it right, I should deploy my webservice with this jar file somehow (or in it?). The whole application (consists of more war files) is in an ear file.

Could you, please, explain, how I can deploy my .aar in/with a .jar? (I did not find any help on the matter)

Thank you really much in advance!


Amila Suriarachchi said...

EJB is deployed as a .jar file. But EJB client which invokes ejb can be deployed any where.
So you can put the ejb invoking code inside the .aar file and put the .aar file under services folder with the directory structure you need.


Anonymous said...

Hi Amila!

Thank you very much for your reply!

I have to admit, I have already tried your suggestion before and it worked. The only problem is, that I need the ejb .jar in the .ear file, where the other .war files are. It is, because another call needs the ejb as well, so either I use the ejb .jar two times (once in my .aar archive and once in the .ear separately, which is bad because of a singleton) or I cannot use the other parts of the program.

We tried to copy the jar file into the glassfish/domain/lib in order to make it available for the whole application. My webservice could see the .jar file, but the other .war files - either as separate .war files or as a packed .ear file - could not because of a JNDI call. We get a namingException. It does not know somehow - as far as I understand - which ejb it should look for.

I searched on Google but no solution found. This is why I ask you, maybe you have any idea, what we forgot to do, or a tip or something what can help, I would raelly appreciate it!

Thanks again for your reply an your help!