Re: javax.naming.NameNotFoundException: HelloHome not bound - Java
This is a discussion on Re: javax.naming.NameNotFoundException: HelloHome not bound - Java ; carrozzini wrote:
> I'm quite new in the world of Enterprise Java Bean and I'm trying to
> do the example of the Mastering EJB2 book and i got this error :
> javax.naming.NameNotFoundException: HelloHome not bound
> Properties props ...
-
Re: javax.naming.NameNotFoundException: HelloHome not bound
carrozzini wrote:
> I'm quite new in the world of Enterprise Java Bean and I'm trying to
> do the example of the Mastering EJB2 book and i got this error :
> javax.naming.NameNotFoundException: HelloHome not bound
> Properties props = System.getProperties();
> Context ctx = new InitialContext(props);
Could you try the default constructor here (new InitialContext())?
-marek
-
Re: javax.naming.NameNotFoundException: HelloHome not bound
Marek Lange <marek.lange@web.de> wrote in message news:<bgnkvj$s7r$00$1@news.t-online.com>...
> carrozzini wrote:
> > I'm quite new in the world of Enterprise Java Bean and I'm trying to
> > do the example of the Mastering EJB2 book and i got this error :
> > javax.naming.NameNotFoundException: HelloHome not bound
>
> > Properties props = System.getProperties();
> > Context ctx = new InitialContext(props);
>
> Could you try the default constructor here (new InitialContext())?
>
> -marek
Hi,
Just a question, how can I see if my Bean is correctly named in the
JNDI server. Maybe is not a mystake in my code but simply that the
JNDI name doesn't exist at all ?
Do you know how can I check this ?
Thanx.
-
Re: javax.naming.NameNotFoundException: HelloHome not bound
"carrozzini" <carrozzini@perso.ch> skrev i meddelandet
news:26d065a7.0308050640.2b880353@posting.google.com...
> Marek Lange <marek.lange@web.de> wrote in message
news:<bgnkvj$s7r$00$1@news.t-online.com>...
> > carrozzini wrote:
> > > I'm quite new in the world of Enterprise Java Bean and I'm trying to
> > > do the example of the Mastering EJB2 book and i got this error :
> > > javax.naming.NameNotFoundException: HelloHome not bound
> >
> > > Properties props = System.getProperties();
> > > Context ctx = new InitialContext(props);
> >
> > Could you try the default constructor here (new InitialContext())?
> >
> > -marek
>
> Hi,
>
> Just a question, how can I see if my Bean is correctly named in the
> JNDI server. Maybe is not a mystake in my code but simply that the
> JNDI name doesn't exist at all ?
>
> Do you know how can I check this ?
>
> Thanx.
Try to list and print out the JNDI-bindings.
NamingEnumeration ne = ctx.listBindings("");
while(ne.hasMore()).... etc...
You might have to step further down the JNDI-namespace, i.e
NamingEnumeration ne = ctx.listBindings("ejb");
//Josef
-
Re: javax.naming.NameNotFoundException: HelloHome not bound
Marek Lange <marek.lange@web.de> wrote in message news:<bgp1dj$9v8$06$1@news.t-online.com>...
> carrozzini wrote:
> > Marek Lange <marek.lange@web.de> wrote in message news:<bgnkvj$s7r$00$1@news.t-online.com>...
> >
> >>carrozzini wrote:
> >>
> >>>I'm quite new in the world of Enterprise Java Bean and I'm trying to
> >>>do the example of the Mastering EJB2 book and i got this error :
> >>>javax.naming.NameNotFoundException: HelloHome not bound
> >>
> >>
> >>
> >>> Properties props = System.getProperties();
> >>> Context ctx = new InitialContext(props);
> >>
> >>Could you try the default constructor here (new InitialContext())?
> >>
> >>-marek
> >
> >
> > Hi,
> >
> > Just a question, how can I see if my Bean is correctly named in the
> > JNDI server. Maybe is not a mystake in my code but simply that the
> > JNDI name doesn't exist at all ?
> >
> > Do you know how can I check this ?
>
> Look at the JBoss JMX-Console (htpp://host:8080/jmx-console). There you
> can see all deployed beans and their JNDI names (domain: jboss.j2ee).
>
> -marek
Hi everybody,
so I corrected 1-2 bugs. I don't know why but the the error was in my
xml file. So know the ejb is deployed correctly now and I tried the
url that you mentionned and i got this :
jboss.j2ee
jndiName=HelloHome,plugin=pool,service=EJB
jndiName=HelloHome,service=EJB
jndiName=ejb/converter/Converter,plugin=pool,service=EJB
jndiName=ejb/converter/Converter,service=EJB
jndiName=ejb/mgmt/MEJB,plugin=pool,service=EJB
jndiName=ejb/mgmt/MEJB,service=EJB
module=HelloWorld.jar,service=EjbModule
module=converter.jar,service=EjbModule
module=ejb-management.jar,service=EjbModule
service=EARDeployer
Does it means that's ok ?
But know I got another error code when I launch my test client :
javax.naming.CommunicationException: Receive timed out. Root
exception is java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:671)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1038)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1158)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:478)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at tests.Test.main(Test.java:23)
Exception in thread "main"
My test client code :
import exemples.Hello;
import exemples.HelloHome;
/**
*
*/
public class Test extends java.lang.Object {
public static void main(String[] args) throws Exception{
Properties p = new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs","org.jboss.naming
rg.jnp.interfaces");
p.put("java.naming.provider.url.package","localhost:1099");
InitialContext ic = new InitialContext(p);
Object obj = ic.lookup("HelloHome");
HelloHome home = (HelloHome) PortableRemoteObject.narrow(obj,
HelloHome.class);
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}
}
Could you help me ?
thanx !!!
-
Re: javax.naming.NameNotFoundException: HelloHome not bound
carrozzini wrote:
> jboss.j2ee
> jndiName=HelloHome,plugin=pool,service=EJB
> jndiName=HelloHome,service=EJB
> jndiName=ejb/converter/Converter,plugin=pool,service=EJB
> jndiName=ejb/converter/Converter,service=EJB
> jndiName=ejb/mgmt/MEJB,plugin=pool,service=EJB
> jndiName=ejb/mgmt/MEJB,service=EJB
> module=HelloWorld.jar,service=EjbModule
> module=converter.jar,service=EjbModule
> module=ejb-management.jar,service=EjbModule
> service=EARDeployer
>
> Does it means that's ok ?
Yes.
> But know I got another error code when I launch my test client :
>
> javax.naming.CommunicationException: Receive timed out. Root
> exception is java.net.SocketTimeoutException: Receive timed out
> Properties p = new Properties();
> p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
> p.put("java.naming.factory.url.pkgs","org.jboss.naming
rg.jnp.interfaces");
> p.put("java.naming.provider.url.package","localhost:1099");
^^^^^^^^
The key is wrong here - it should be "java.naming.provider.url". You'd
better take the constants:
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.setProperty(Context.PROVIDER_URL, "localhost:1099");
p.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming
rg.jnp.interfaces");
That should work.
-marek
-
Similar Threads
-
By Application Development in forum Java
Replies: 0
Last Post: 05-01-2005, 02:51 PM
-
By Application Development in forum Java
Replies: 0
Last Post: 01-14-2005, 04:18 AM
-
By Application Development in forum Java
Replies: 2
Last Post: 08-19-2004, 03:54 AM
-
By Application Development in forum Java
Replies: 0
Last Post: 07-12-2004, 12:01 AM
-
By Application Development in forum Java
Replies: 0
Last Post: 09-08-2003, 10:03 AM