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/625780#625780
--------------------------------------------------------------
Sorry Brian, but it does not look to me that is working. I did not go too far: ME-->M1
does not work so ....
ME: module.xml has dependencies:
<module name="com.module.first"/> M1
<module name="com.module.second"/> M2
<module name="com.module.third"/> M3
Then in the TCCL class:
**import com.module.first.services.TestServicesIfc;
**
**import com.module.first.services.TestServicesImpl;
**
.....
module = Module.+getCallerModuleLoader+().loadModule(myModule.getIdentifier());
ServiceLoader<?> serviceLoader = module.loadService(TestServicesIfc.
**class**); <--- SUCCESS since it is using the jboss-modules api
Iterator<?> serviceIter = serviceLoader.iterator();
*if
(serviceIter.hasNext()) {
+log.info("TestServicesIfc -------> Found services class");
......
ServiceLoader<TestServicesIfc> myService =
ServiceLoader.+load+(TestServicesIfc.**class**); <--
FAILSIterator<TestServicesIfc> iter = myService.iterator();
}
**else** {
++log++.info("TestServicesIfc -------> NOT Second Found services class");}
10:44:57,216 INFO [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-2)
Starting remote JMX connector
10:44:57,217 INFO [org.jboss.as.remoting] (MSC service thread 1-3) Listening on
/127.0.0.1:9999
10:44:59,268 INFO [org.jboss.as.connector] (MSC service thread 1-3) Starting JCA
Subsystem (JBoss IronJacamar 1.0.3.Fin
al)
10:44:59,705 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread
1-2) Bound data source [java:jbos
s/datasources/ExampleDS]
10:45:36,561 INFO [com.modext.dans.services.TCCLSingletonService] (MSC service thread
1-4) TestServicesIfc -------> Fou
nd services class
10:45:38,274 INFO [com.module.first.services.TestServicesImpl] (MSC service thread 1-4)
HELLO
10:45:50,258 INFO [com.modext.dans.services.TCCLSingletonService] (MSC service thread
1-4) TestServicesIfc -------> NOT
Second Found services class
10:45:55,941 INFO [org.jboss.as.deployment] (MSC service thread 1-3) Started
FileSystemDeploymentService for directory
c:\jboss-as-7.1.0.Alpha1-SNAPSHOT\standalone\deployments
10:45:55,979 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.1.0.Alpha1-SNAPSHOT
"Lightning" started in 69825ms
- Started 94 of 149 services (55 services are passive or on-demand)
10:45:58,719 INFO [org.jboss.as.osgi] (MSC service thread 1-3) Stopping OSGi Framework
10:45:58,737 INFO [org.jboss.as.logging] Restored bootstrap log handlers
10:45:58,792 INFO [com.arjuna.ats.jbossatx] ARJUNA32018: Destroying
TransactionManagerService
10:45:58,794 INFO [com.arjuna.ats.jbossatx] ARJUNA32014: Stopping transaction recovery
manager
10:45:58,799 INFO [org.jboss.as] +*JBoss AS 7.1.0.Alpha1-SNAPSHOT*+ "Lightning"
stopped in 96ms
**if** (iter.hasNext()) {
++log++.info("TestServicesIfc -------> Second trial: Found services class");
+*
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/625780#625780]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]