jboss service lookup
miska7 Feb 12, 2006 7:08 AMHere's my problem (hope this's the right forum):
I set up a scheduler service to call a schedulable session bean.
Inside the session bean I can lookup successfully others ejb but lookup for Mail service fails.
My code:
InitialContext ic = new InitialContext();
Object ref = ic.lookup("java:/Mail");
Server log:
09:39:37,411 INFO [STDOUT] javax.naming.NameNotFoundException: jboss%3aservice%3dMail not bound 09:39:37,416 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495) 09:39:37,421 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) 09:39:37,425 INFO [STDOUT] at org.jnp.server.NamingServer.getObject(NamingServer.java:509) 09:39:37,429 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:282) 09:39:37,434 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:530) 09:39:37,438 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509) 09:39:37,441 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:361) 09:39:37,444 INFO [STDOUT] at seminari.ejb.SchedulerBean.sendMessage(SchedulerBean.java:233) 09:39:37,447 INFO [STDOUT] at seminari.ejb.SchedulerBean.enrollmentClosed(SchedulerBean.java:197) 09:39:37,450 INFO [STDOUT] at seminari.ejb.SchedulerBean.perform(SchedulerBean.java:134) 09:39:37,454 INFO [STDOUT] at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1263) 09:39:37,458 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) 09:39:37,464 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62) 09:39:37,468 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:391) 09:39:37,473 INFO [STDOUT] at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138) 09:39:37,477 INFO [STDOUT] at $Proxy8.handleNotification(Unknown Source) 09:39:37,481 INFO [STDOUT] at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:98) 09:39:37,486 INFO [STDOUT] at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:83) 09:39:37,491 INFO [STDOUT] at javax.management.timer.Timer.sendNotifications(Timer.java:441) 09:39:37,495 INFO [STDOUT] at javax.management.timer.Timer.access$000(Timer.java:31) 09:39:37,500 INFO [STDOUT] at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612) 09:39:37,503 INFO [STDOUT] at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164) 09:39:37,506 INFO [STDOUT] at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:240)
ejb-jar (insede session element relative to the schedulable bean):
<resource-ref > <res-ref-name>Mail</res-ref-name> <res-type>javax.mail.Session</res-type> <res-auth>Container</res-auth> </resource-ref>
jboss.xml:
<resource-ref> <res-ref-name>Mail</res-ref-name> <jndi-name>java:/Mail</jndi-name> </resource-ref> .... <resource-managers> <res-name>Mail</res-name> <res-jndi-name>java:/Mail</res-jndi-name> </resource-managers>
Mail service is set up properly and it works when accessed from servlets of the same application.
I already tried to lookup for "Mail" and "/Mail" without success.
Thanks for any help,
Mic