Dan Sirbu [
http://community.jboss.org/people/lmcdasi] created the discussion
"Re: META-INF/services for module extensions - question/issue"
To view the discussion, visit:
http://community.jboss.org/message/626976#626976
--------------------------------------------------------------
Brian,
Unfortunately it looks like I have to come back:
(a) When I do remote debugging on the TCCL Service load I start to have the following
exception. I recall being able to debug that until I am getting this behaviour. If I
disable the remote debugging the startup is ok.
16:22:50,138 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-10) MSC00001: Failed
to start service jboss.as.test.singleton: org.jboss.msc.service.StartException in service
jboss.as.test.singleton: Failed to start service
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.util.NoSuchElementException
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:340) [:1.6.0_26]
at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [:1.6.0_26]
at
com.moduleext.jboss.extension.services.TCCLSingletonService.start(TCCLSingletonService.java:91)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
(b) Beside M1, I do have M2. Both implement the same interface for the ServiceLoader. The
first kickstarts ok but the second fails with CastException tough I am sure I did not mess
around with the class type definition.
16:28:42,273 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC00001: Failed
to start service jboss.as.modext.singleton: org.jboss.msc.service.StartException in
service jboss.as.modext.singleton: Failed to start service
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.util.ServiceConfigurationError: com.test.jboss.module.ifc.TestModuleIfc:
Provider com.test.jboss.test.impl.TestModuleTwoImpl could not be instantiated:
java.lang.ClassCastException
at java.util.ServiceLoader.fail(ServiceLoader.java:207) [:1.6.0_26]
at java.util.ServiceLoader.access$100(ServiceLoader.java:164) [:1.6.0_26]
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353) [:1.6.0_26]
at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [:1.6.0_26]
at
com.ericsson.modext.jboss.extension.services.TCCLSingletonService.start(TCCLSingletonService.java:91)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
Caused by: java.lang.ClassCastException
at java.lang.Class.cast(Class.java:2990) [:1.6.0_26]
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345) [:1.6.0_26]
... 7 more
The code snipet:
List<MyModule> myList = this.getModules();
Iterator<MyModule> myIter = myList.iterator();
while(myIter.hasNext()) {
MyModule mmodule = myIter.next();
ModuleIdentifier moduleIdentifier = mmodule.getIdentifier();
log.info("TCCLSingletonService -- > starting module: " +
moduleIdentifier.getName());
try {
Module module =
Module.getCallerModuleLoader().loadModule(moduleIdentifier);
ServiceLoader<?> serviceLoader =
module.loadService(TestModuleIfc.class);
Iterator<?> serviceIter = serviceLoader.iterator();
while(serviceIter.hasNext()) {
((TestModuleIfc) serviceIter.next()).start(context);
}
} catch () {
...................
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/626976#626976]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]