How do I access resources that I put into my service/module archive file?

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By wso2 wso2
  • 29 May, 2006

A: Axis2 has the notion of service isolation where each service or module gets its own class loader. Using this class loader you can access any resource that you put into your service archive file. You may want to access your resources from different locations.

For example,

1. A third party module wants to access your resources, then the scenario is as follows:

   AxisService myService =
AxisService myService = msgCtx.getAxisService();

Then you can ask for service class loader, using which you can access its resources

   ClassLoader clsLoader = myService.getServiceClassLoader();

2. To initialize service implementation class at the MessageReceiver level the following steps need to be taken

   AxisService service = msgCtx.getAxisService();   ClassLoader clsLoader = service.getServiceClassLoader();

Note : Axis2 default MessageReceiver uses the same technique to initialize service implementations 3. If you want to load your resources at the service implementation class then the scenario is as follows