Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Beans > JNDI, session b...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 1280 of 1401
Post > Topic >>

JNDI, session beans and JBoss

by cold80@[EMAIL PROTECTED] Feb 2, 2007 at 09:03 AM

I was trying the first EJB example of the book "Mastering Enterprise
Java Beans". After building the bean and deploying it successfully I
had many problems making the client work. The client code is very
simple

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

        Hello hello=(Hello)ctx.lookup("HelloBean");
        System.out.println(hello.hello());
    }
}

But I found many problems using the lookup method. Using the full
"path" for the interface "examples.session.stateless.Hello", as
specified in the book, I got

Exception in thread "main" javax.naming.NameNotFoundException:
examples.session.stateless.Hello not bound

Otherwise, using the line

Hello hello=(Hello)ctx.lookup("HelloBean");

I got the error

Exception in thread "main" java.lang.ClassCastException:
org.jnp.interfaces.NamingContext cannot be cast to
examples.session.stateless.Hello

So I think I was grabbing the wrong object from JBoss. Looking on many
posts and web pages I found that using

Hello hello=(Hello)ctx.lookup("HelloBean/remote");

I can get the right object. Why? It's really difficult for me to
understand the way JNDI is naming my resources...can you give me
informations about that? It would be really appreciated...

Cold
 




 4 Posts in Topic:
JNDI, session beans and JBoss
cold80@[EMAIL PROTECTED]   2007-02-02 09:03:20 
Re: JNDI, session beans and JBoss
Per Newgro <per.newgro  2007-02-03 11:42:56 
Re: JNDI, session beans and JBoss
cold80@[EMAIL PROTECTED]   2007-02-05 00:23:04 
Re: JNDI, session beans and JBoss
Per Newgro <per.newgro  2007-02-05 11:38:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:22:13 CST 2008.