This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes whats wrong with this client ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "whats wrong with this client ?" Watch "whats wrong with this client ?" New topic
Author

whats wrong with this client ?

Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
My JBoss client lookup return me org.jnp.interfaces.NamingContext type instead of my Bean remote type, I could not figure out anything wrong with the client. Please have a look.

Remote Interface



Bean Class



Client Class




Exception on the invocation of client. The loojup return me a type of org.jnp.interfaces.NamingContext, it shoud have been my remote type.

Exception in thread "main" java.lang.ClassCastException: org.jnp.interfaces.NamingContext
at mine.test.ejb.client.EjbClient.main(EjbClient.java:18)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Which version of JBoss AS?

Use JNDIView to determine the exact name to which the EJB was bound. In AS 5.x, the name will show in the console log.


JBoss In Action
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Hi Peter, Thanks for the reply. I am using jboss-5.0.1.GA.
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Thanks Peter its worked. This is what shown in the console.

12:22:50,131 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=mybean.jar,nam
e=MyBean,service=EJB3
12:22:50,131 INFO [EJBContainer] STARTED EJB: mine.test.ejb.MyBean ejbName: MyB
ean
12:22:50,209 INFO [JndiSessionRegistrarBase] Binding the following Entries in G
lobal JNDI:

MyBean/remote - EJB3.x Default Remote Business Interface
MyBean/remote-mine.test.ejb.IBean - EJB3.x Remote Business Interface


"/remote" with the bean name is something new I think. It was not there in JBoss 4, isn't it ?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9955
    
163



Based on this code, the remote interface of the bean should have been bound to "MyBean"

MyBean/remote - EJB3.x Default Remote Business Interface


Looks wrong. It should not have bound to MyBean/remote since you have overridden it in the code. Are you sure the jar that you are deploying, contains exactly this piece of code? And do you have any ejb-jar.xml or jboss.xml for this EJB app?


[My Blog] [JavaRanch Journal]
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
you are correct, I removed the jndi binding code from the bean class.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: whats wrong with this client ?
 
Similar Threads
Not able to run my first EJB code -
how many interceptor method in a Bean class ?
what is the reason? please help me
EJB 3.0 Problems
problem in deploying ejb3 app in jboss server