• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Bean Not Bound Exception

 
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have deployed a simple stateless bean.Stateless Session Bean client code is

package client;

import beans.SimpleSession;
import javax.naming.InitialContext;

public class SimpleSessionClient
{
public static void main(String [] args)
throws Exception
{
InitialContext ctx=new InitialContext();

SimpleSession simpleSession=(SimpleSession)ctx.lookup(SimpleSession.class.getName());


for(int i=0;i<args.length;i++)
{
String returnedString=simpleSession.getEchoString(args[i]);
System.out.println("Sent String: "+args[i]+" Return String: "+returnedString);
}

}
}


After running the client i am getting following error

Exception in thread "main" javax.naming.NameNotFoundException: SimpleSessionApp. SimpleSession not bound

There is no error at server console.
My configuration is

JBOSS 4.0.3S1
Java 6.0

There is some problem in lookup method.
What is the JNDI naming convention to look for an ejb instance in JBOSS?

Thanks>
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You seem to be using an incorrect jndi-name for the lookup. Follow the steps mentioned here to view the jndi tree and figure out the jndi-name of your bean. You can then use it to lookup the bean.
 
Arpit Gadle
Ranch Hand
Posts: 69
MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jaikiran,
Just go through the snippets

My JNDI Tree View is

+- SimpleSessionBean (class: org.jnp.interfaces.NamingContext)
| +- remote (proxy: $Proxy72 implements interface beans.SimpleSession,interface org.jboss.ejb3.JBossProxy)


At Server console

20:05:06,959 INFO [EJBContainer] STARTED EJB: beans.SimpleSessionBean ejbName: SimpleSessionBean
20:05:07,169 INFO [EJB3Deployer] Deployed: file:/H:/jboss/server/all/deploy/SimpleSessionApp.ejb3


As per your advice and the above server console output i changed lookup method with jndi name as lookup("SimpleSessionBean") and at Client Console i got this exception

Exception in thread "main" java.lang.ClassCastException: org.jnp.interfaces.NamingContext cannot be cast to beans.SimpleSessi
on
at client.SimpleSessionClient.main(SimpleSessionClient.java:15)


So, Am i using a correct jndi name in lookup method?
What is the solution to the above exception ?

Bye
Thanks in advanace
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic