ServiceLoader issue in WebLogic12c
Asked Answered
F

1

8

I have been trying to refactor our Activiti implementation into using CDI but ran into a number of problems. I've spent way too much time trying to resolve this already, but I just can't let it go...I think I've pinned the problem down now, setting up a clean structured war without involving Activiti and have been able to reproduce what I think is the main problem.

Basically I have jar1 and jar2, both CDI enabled by including META-INF/beans.xml. Both jars specify a class in META-INF/services/test.TheTest pointing to implementations local to respective jar. jar1 depends on jar2. Also, both jars point to an implementation of javax.enterprise.inject.spi.Extension, triggering the scenario. In each implementation of Extension, 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 the ServiceLoader does not see any implementations in either case when running WebLogic12c. The same code works perfectly fine in both Jboss 7.1.1 and Glassfish , listing both implementations of the test.TheTest interface.

Is it fair to assume that this is indeed a problem in WebLogic 12c or am I doing something wrong? Please bare in mind that I am simply trying to emulate the production setup we use when incorporating Activiti.

Regards, /Petter

Fondle answered 30/10, 2012 at 15:43 Comment(2)
do you have any updated on this?Materfamilias
Unfortunately no. Seems to be an issue with the classloading schematics in WebLogic. Eagerly awaiting the next version of WebLogic to see if that fixes the problem.Eijkman
W
0

There is a Classloader Analysis Tool provided with WLS, have you seen if this will help with the diagnosis of your issue.

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

Wellgrounded answered 20/12, 2012 at 11:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.