Problem with ServiceLoader in WebLogic12c

I am trying to reorganize our Activiti implementation to use CDI, but have encountered a number of problems. I spent too much time trying to solve it already, but I just can’t let it go ... I think that now I posed the problem by creating a clean structured war without Activiti and was able to reproduce what, in my opinion, is the main problem.

Mostly I have jar1 and jar2, both CDIs are included, including META-INF / beans.xml. Both jars define a class in META-INF / services / test.TheTest, indicating local implementations in the corresponding bank. jar1 depends on jar2. In addition, both banks point to the implementation of javax.enterprise.inject.spi.Extension by running the script. In each extension implementation, I have a method like:

public void afterDeploymentValidation( @Observes AfterDeploymentValidation event, BeanManager beanManager) { System.out.println("In jar1 extension"); ServiceLoader<TheTest> loader = ServiceLoader.load(TheTest.class); Iterator<TheTest> serviceIterator = loader.iterator(); List<TheTest> discoveredLookups = new ArrayList<TheTest>(); while (serviceIterator.hasNext()) { TheTest serviceInstance = (TheTest) serviceIterator.next(); discoveredLookups.add(serviceInstance); System.out.println(serviceInstance.getClass().getName()); } } 

Now my problem is that ServiceLoader does not see any implementations anyway when working with WebLogic12c. The same code works fine in both Jboss 7.1.1 and Glassfish, listing both versions of the test.TheTest interface.

Can it be assumed that this is really a problem in WebLogic 12c, or am I doing something wrong? Please keep in mind that I'm just trying to emulate the installation we use when we activate Activiti.

Regards, / Petter

+8
cdi weblogic serviceloader
source share
1 answer

There is a class loader analysis tool provided with WLS, you have seen if this helps in diagnosing your problem.

You can access this tool by going to ip: port / wls-cat / index.jsp Where the port will be the port of the managed server on which your application is deployed.

0
source share

All Articles