-
1. Re: Extending JBoss AS 7
nickarls Jan 13, 2013 6:18 AM (in response to andi-g)Not sure if you can inject it directly but if you make the Messaging subsys a dependecy, at least it should be available for normal lookup, one would think.
-
2. Re: Extending JBoss AS 7
andi-g Jan 13, 2013 9:04 AM (in response to nickarls)Hi Nicklas,
Thank you for your answer. I did as you told and added Messaging dependency:
<module xmlns="urn:jboss:module:1.0" name="pl.pazp.jboss.aftn">
<resources>
<resource-root path="aftn.jar" />
<resource-root path="jboss-jms-api_1.1_spec-1.0.0.Final.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="org.jboss.staxmapper" />
<module name="org.jboss.as.controller" />
<module name="org.jboss.as.server" />
<module name="org.jboss.modules" />
<module name="org.jboss.msc" />
<module name="org.jboss.logging" />
<module name="org.jboss.vfs" />
<module name="org.jboss.as.messaging" />
</dependencies>
</module>
but after that when I tried to lookup for particular queue:
InitialContext ctx = new InitialContext();
Queue queue = (Queue)ctx.lookup("java:jboss/exported/jms/queue/test");
I received an error:
java.lang.ClassNotFoundException: javax.jms.Queue
I added jar with JMS API to resources but after that I got:
javax.jms.Queue can't cast to javax.jms.Queue
I think that is because these two classes have been loaded by diffrent ClassLoaders.
Any idea how to solve it?
-
3. Re: Extending JBoss AS 7
nickarls Jan 13, 2013 12:46 PM (in response to andi-g)1 of 1 people found this helpfulThat's a module dep, I was talking about a subsystem dep
-
4. Re: Extending JBoss AS 7
andi-g Jan 13, 2013 2:03 PM (in response to nickarls)Thanks very much for your help!
You're right, I' ve mixed subsystem with module.
Unfortunately, I'm not experienced enough in creating subsystems so I have to improve my knowledge in this field. Could you recommend me any source where I can read about defining dependencies between subsystems?
Best regards!
Andi
-
5. Re: Extending JBoss AS 7
nickarls Jan 13, 2013 3:09 PM (in response to andi-g)Not sure but looking at the web subsystem https://github.com/jbossas/jboss-as/blob/master/web/src/main/java/org/jboss/as/web/WebSubsystemAdd.java there is talk like
newControllers.add(target.addService(WebSubsystemServices.JBOSS_WEB, service)
.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, service.getPathManagerInjector())
.addDependency(DependencyType.OPTIONAL, ServiceName.JBOSS.append("mbean", "server"), MBeanServer.class, service.getMbeanServer())
.setInitialMode(Mode.ON_DEMAND)
.install());
in the performBoottime
-
6. Re: Extending JBoss AS 7
ctomc Jan 13, 2013 3:41 PM (in response to nickarls)1 of 1 people found this helpfulAndrezj,
it is similar to what Nicklas sugessted.
When you are working from inside the app server aka extension JNDI is not avalibale to be used.
What you have is MSC which handles all the services and is backed by ServiceRegistry.
If you are building a service that needs some other service to be injected then the way to do it is what Nicklas posted.
You can also do lookup in ServiceRegistery where you can find all service components of app server.
Every object that is bound to jndi is backed up by MSC service so it can be injected/lookedup by MSC
--
tomaz
-
7. Re: Extending JBoss AS 7
andi-g Jan 17, 2013 3:41 AM (in response to ctomc)Thank You very much for your help and suggestions.
Andi