This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Session bean not bound Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Reply locked New topic
Author

Session bean not bound

Rachil Chandran
Ranch Hand

Joined: Mar 05, 2006
Posts: 67
I am new to both EJBs and JBoss.

I have a simple stateless bean that I want to test.
The code is:


and


There is no problem with deployment, the message in JBoss console is: (SessionListener.ejb3 contains SessionListener.class and SessionListenerBean.class)

INFO [Ejb3Deployment] EJB3 deployment time took: 156
INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=Sessi
onListener.ejb3,name=SessionListenerBean,service=EJB3 with dependencies:
INFO [EJBContainer] STARTED EJB: jee.jboss.session.SessionListenerBean ejbName: SessionListenerBean
INFO [EJB3Deployer] Deployed: file:/C:/Program Files/jboss-4.0.5.G
A/server/default/deploy/SessionListener.ejb3

But when I try to run a remote client,

NameNotFoundException: jee.jboss.session.SessionListener not bound

message is thrown.

Client code is:


I googled this, searched on forums and tried all the remedies given (including adding all the jar files in %JBOSS_HOME/client to classpath). No luck. Appreciate any pointers. Sorry for the lengthy post


SCJP2 96%
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10240
    
168

Whats the name of the ear that you have package the bean in? Assuming it's MyApp.ear, your lookup for the remote bean would look like:



[ February 07, 2007: Message edited by: Jaikiran Pai ]

[My Blog] [JavaRanch Journal]
Rachil Chandran
Ranch Hand

Joined: Mar 05, 2006
Posts: 67
Hi Jaikiran,

Thanks for your quick response.

I have packages the interface and bean classes in SessionListener.ejb3 archive file. Someone told me the latest JBoss (4.0.5) requires .ejb3 files instaed of JAR/EAR.

I tried the approach outlined by you, infact my original code had the following



I did check the JNDIview in the JMX-Console and it does not show the SessionListener to be bound in the gloabl JNDI.

I have no clue as to what is happening. I have spent a day and half trying to troubleshoot. Its is very discouraging to someone trying to use JBoss for the very first time.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

try just looking up

"SessionListenerBean/remote"

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Rachil Chandran
Ranch Hand

Joined: Mar 05, 2006
Posts: 67
It worked without a flaw.

Thanks a ton Mark and Jaikiran.

Mark, I know this may be asking for too much, but could you explain what's happening.

I ve read a few tutorials and all they do is just give you the plain syntax without explaining what's going on. Sorry if there is material out there regarding this that I simply missed.

Thanks,
Rachil
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10240
    
168

I ve read a few tutorials and all they do is just give you the plain syntax without explaining what's going on


You mean, you want to know about which jndi name to use while looking up your bean? EJBs are nothing but resources that get bound to the JNDI tree. These can then be looked up by the clients by doing operations on the JNDI tree. To put it in simple terms, its nothing more than specifying a name for your bean so that if you want to access it, you just refer it using that name.

Technically, by default (in EJB3), the jndi name that is given to the bean is of the following syntax:
For remote -
<ApplicationName>/<BeanClassName>/<remote>

For local-
<ApplicationName>/<BeanClassName>/<local>

I see that in your case where you deployed your archive as .ejb3, it was not required to specify the application name.

Also, you can always override these default jndi names by specifying your own jndi names for the beans.
[ February 07, 2007: Message edited by: Jaikiran Pai ]
Hernán Quevedo
Ranch Hand

Joined: Mar 18, 2009
Posts: 31
Hey, all.

I am sorry, but I have to ask this one more thing: using JEE EJB3 annotations, I have this ManagedBean, made in the faces-config.xml editor in ganymede:



The session-bean:



The local interface:



This session-bean comes inside an EJB 3.0 project packed in a jar inside this war and both inside an EAR and deployed on JBoss 5.0, and then it goes:



Any help really appreciated.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Hernan, you should have started a new post, and not asked a different question on a 2-year old post.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session bean not bound