Meaningless Drivel is fun!*
The moose likes JBoss/WildFly and the fly likes Can't access remote Sessionbean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Can Watch "Can New topic
Author

Can't access remote Sessionbean

hal arres
Ranch Hand

Joined: Jan 10, 2003
Posts: 30
Hi all,

I am trying to setup my first jboss application, but I have some kind of a problem.
During the access of the Bean I get the following exception:
Code:


I'am using jboss 4.2.3GA.


This is the Bean:
Code:



And these are the interfaces:

Code:



Code:




And next the Client:
Code:





I have no idea what kind of a problem this is. I also checked the JNDI-Namespace inside the jboss, but this seems to be fine:
Code:



It would be very nice, if someone could help me resolving my problem

Thank you in advance,
Arres
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi hal,

as long as you get the NameNotFoundException you don't have to worry about the rest of your code. This is only related to JNDI and lookup problems.

It may depend on the application server how exactly the lookup name has to be specified. In case of JBoss it's usually the full path down the JNDI tree if I remember it correctly. In this case I think you have to change the lookup to instead. As you see this one also gives the top level name which is usually the name of your project/application.

I hope this helps

Marco

[ August 31, 2008: Message edited by: Marco Ehrentreich ]
[ August 31, 2008: Message edited by: Marco Ehrentreich ]
hal arres
Ranch Hand

Joined: Jan 10, 2003
Posts: 30
Hi Marco,

thank you very very much. It was exactly how you wrote it.
I have to say that I became desperate in facing this problem.

So thank you very very much

All the best,
Hal
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi Hal,

I'm glad to hear that your problem is solved now I guess almost everyone who is trying to get some enterprise examples up and running is facing these problems with the JNDI lookup. Unfortunately this is often not even mentioned in examples or tutorials that the lookup name may be application server specific. The best thing you can do is to look carefully at such exceptions before you start changing some parts of the code...

Marco
S Setty
Greenhorn

Joined: Sep 08, 2008
Posts: 16
Hi all

Did any one try dependency injection in the client.

I could not make it work in 4.2.3.

It worked in 5, after adding mappedName and setting the callByValue to true in the JMX console

@EJB(mappedName="ear/HelloBean/remote")
private HelloBeanLocal helloBean;

Did anyone come across this issue?

Thanks
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

As far as I know, client-side dependency injection is not implemented in 4.2.x.


JBoss In Action
S Setty
Greenhorn

Joined: Sep 08, 2008
Posts: 16
Thanks Peter,

Any idea why it is not working in the 5.x? I think it is implemented.

Thanks
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi,

what "clients" are you exactly talking about? Standalone applications or other enterprise beans? Anyway, as far as I know dependency injection is part of J2EE 5.0 and JBoss 4.x officially only supports J2EE 1.4. This is probably the reason why it doesn't work in these versions.

For JBoss 5.x I don't have any experiences but I think it could easily be a naming problem with JNDI like the problems described above. If everything else is working correctly the JBoss server logs should tell you if that's the problem.

Marco
S Setty
Greenhorn

Joined: Sep 08, 2008
Posts: 16
I tried from a servlet and application client.

It worked in 5.x, after adding mappedName and setting the callByValue to true in the JMX console

@EJB(mappedName="ear/HelloBean/remote")
private HelloBeanLocal helloBean;
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9937
    
159

There's a bug in JBoss-5 CR1, because of which the mappedName is necessary while injecting the bean in the servlets.


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't access remote Sessionbean
 
Similar Threads
Could not access Local Session Bean using JNDI lookup
Learning EJB3 on JBOSS 4.22
client lookup java.lang.ClassCastException: $Proxy0
Doubt in JNDI binding
netbeans 5.5 + Jboss 4.0.4 + EJB 3.0