pb : having a jboss service depending on jms or NamingContex
je.a.le Dec 3, 2008 9:39 AMhi,
I have an entreprise application build like this :
- an ejb module, with a jboss service (@service @management annotation), and a mdb
- a war module with a servlet and a webservice
Only use annotation ; jboss 4.2.1.GA, jdk 1.6.0.10 x64, linux, netbeans 6.1
At startup, the start method of my jboss service trigger a mdb to do some loading process in the background.
When hot deploying, no problems, everything fine.
On cold start up (of jboss...), I'm getting a javax.naming.NameNotFoundException. Because my service start before the jms queue, the context cannot create my queue. Look simple, well... not :-)
My problem is I'm cannot get @Depend annotation working. Actually, i cannot find doc on the subject. The closer is this one :
http://www.jboss.org/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/ch12s03.html
I looked at the xml config files, the jmx console, the jndi view...
1) is this annotation working in this case ???
2) what is the name of the bean responsible of creating "queue/jms" !?!!?
Some part of my code :
@Service(name = "FilterServiceBean", objectName = "org.filter.ejb:name=FilterServiceBean,type=ManagementInterface") @Local(FilterServiceBeanLocal.class) @Remote(FilterServiceBeanRemote.class) @Management(FilterServiceBeanManagement.class) @Depends("jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider") //@Depends("jboss.jms:alias=QueueConnectionFactory") //@Depends("jboss:service=Naming") public class FilterServiceBean implements FillterServiceBeanRemote, FilterServiceBeanLocal, FilterServiceBeanManagement { //... public static final String BUILDMESSAGEQUEUE = "queue/jms/MyFilter"; private Queue queue = null; private QueueConnectionFactory factory = null; //... public void start() throws Exception { // *** call an mdb InitialContext ctx = new InitialContext(); queue = (Queue) ctx.lookup(BUILDMESSAGEQUEUE); factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); //... connection = factory.createQueueConnection(); session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(queue); //... } //... }
the exception : (I'm using a singleton - RebuildPostman -, pushed his code into the start method below to make thinks simple :-) )
14:14:12,439 ERROR [STDERR] javax.naming.NameNotFoundException: jms not bound 14:14:12,439 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529) 14:14:12,439 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537) 14:14:12,439 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543) 14:14:12,439 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267) 14:14:12,439 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:270) 14:14:12,440 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627) 14:14:12,440 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589) 14:14:12,440 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392) 14:14:12,440 ERROR [STDERR] at org.filter.mdb.RebuildPostman.<init>(RebuildPostman.java:35) 14:14:12,440 ERROR [STDERR] at org.filter.mdb.RebuildPostman.getInstance(RebuildPostman.java:45) 14:14:12,440 ERROR [STDERR] at org.filter.ejb.FilterServiceBean.start(FilterServiceBean.java:136)
Thks.