• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't access remote Sessionbean

 
hal arres
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, client-side dependency injection is not implemented in 4.2.x.
 
S Setty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter,

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

Thanks
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a bug in JBoss-5 CR1, because of which the mappedName is necessary while injecting the bean in the servlets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic