Skip to Content
Former Member
May 27, 2009 at 12:15 PM

JCO3.0.1 is not supported with multiple class loader


Hi experts,

appreciate if any one could suggest few work around here.

With new version of JCO3.0.1 , now Java stand alone applications needs

to register their DesitnationDataProvider and ServerDataProvider with

JCO Environment class.

We have done exactly that. We have created our own

DestinationDataProvide class which stores destinations and its

properties in a HashMap. We also register the Provider with the

Environment class.

Our application deploys in an application Server. It can be deployed

multiple times.

So whenever we deployed and started our application, we try to register

the provider with the JCO Environment class as shown below

Here is static part of DestinationDataProvider class which register its

Singleton instance with the Environment class.



destinationDataProvider_ = new





This static block execute when our application is deployed and started.

But as i said user can also deploy our application multiple times. So,

when user try to deploy the application for second time, the class

loader which loads all our classes, also loads the

DestinationDataProvider class once again. This eventually makes the

class to call register method on to Environment once again. This time

JCO Environment class throws exception that a destination provider is

already registered.

Note - JCO3 jar is only loaded once.

So, with multiple class loader there is no way i cannot restrict my

application to register only once with JCO Environment class.

And also i dont see JCO providing any option/API to get me the already

registered DestinationDataProvider.

I have downloaded latest JCO3.0.2 API and seen following new APIs



These APIs tells me whether a DataProvider is already registered or

not.But, if you go through my problem again - my second application needs

access to already registered data provider if it is there. I cannot

unregister existing DataProvider and register a new one. If i register

new DestinationDataProvider in second application it will break first

application as it is not having all its destinations which it has

registered before.