EasyBeans is an open source implementation by ObjectWeb of the EJB3 container specification.

Project

Developer

Wiki

About

|
If you were logged in you would be able to see more operations.
|
|
|
EasyBeans
Created: 04/Nov/08 10:27 AM
Updated: 04/Nov/08 10:28 AM
|
|
| Component/s: |
OSGi
|
| Affects Version/s: |
EasyBeans 1.1.0 M1
|
| Fix Version/s: |
None
|
|
|
The following bit of code in a session bean:
====
@EJB
private Stateless2Remote m_stateless2 = null;
====
is working (i.e. when Stateless2Remote becomes available, the m_stateless2 member is set to it) when Stateless2 interface/implementation is in the same bundle.
However when it is moved to another bundle, the '@EJB' auto-injection no longer works, however the service it still is available though when using it through a jndi lookup.
|
|
Description
|
The following bit of code in a session bean:
====
@EJB
private Stateless2Remote m_stateless2 = null;
====
is working (i.e. when Stateless2Remote becomes available, the m_stateless2 member is set to it) when Stateless2 interface/implementation is in the same bundle.
However when it is moved to another bundle, the '@EJB' auto-injection no longer works, however the service it still is available though when using it through a jndi lookup. |
Show » |
|
Hi,
The following bit of code in a session bean:
====
@EJB
private Stateless2Remote m_stateless2 = null;
====
is working (i.e. when Stateless2Remote becomes available, the m_stateless2 member is set to it) when Stateless2 interface/implementation is in the same bundle.
However when it is moved to another bundle, the '@EJB' auto-injection no longer works, however the service it still is available though when using it through a jndi lookup.
Anyone have a clue what's going on here?
Cheers,
Jaap
>>>>>>>
Does it means that if you do a manual lookup, it works ?
--G
>>>>>>>
Hi Guillaume,
That's right, if the lookup is performed through
====
m_stateless2 =
(Stateless2Remote)new InitialContext().lookup(String.format(
"%s_%s@Remote",
"net.luminis.ezb.stateless2.impl.Stateless2Impl",
Stateless2Remote.class.getName()));
====
it is available without problems.
Cheers,
Jaap
>>>>>>>
Seems this is something missing in EasyBeans: the @EJB resolution do not work between standalone EjbJars deployed on EasyBeans.
Can you check that outside of an OSGi environment ?
If the problem is still here, please open a JIRA:
http://jira.easybeans.org
On the other hand, I can propose you a workaround: simply specify a mappedName attribute in your @Stateless EJB, and specify the same value for the @EJB.mappedName attribute.
Not so elegant, but it should works.
Cheers
--Guillaume
>>>>>>>
hi guillaume,
because I'm just working on the sample server (equinox, riena, easybeans) I made some tests:
Jaap is right, it doesnt work
and you're also right - using a mappedName works
using the InitialContext().lookup always works
and one trap I run into (and now changed my bundle-start-order in detail)
bundle X: contains @EJB MyBusinessInterface
bundle Y: contains @Stateless EJB implementing MyBusinessInterface
bundle Z: contains @Remote MyBusinessInterface
if your bundle X is started, it will only work if the bundle Y was started before - otherwise the @EJB isn't known.
Bundle X has a dependency to Bundle Z (knows only the interface)
Bundle Y has a dependency to Bundle Z
ekke
>>>>>>>
OK, that's a confirmation for me.
can you (or Jaap) open a JIRA for that please ?
Cheers
--Guillaume