You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Steve Hostettler <st...@gmail.com> on 2012/08/21 13:41:45 UTC

Accessing Remote EJBs

Hi all!

I use geronimo 3.0 and therefore OpenEJB.

My projects are organized as follows:


so far so good. Now I have a second EAR

EAR2 will be most likely on the same server as EAR1 (but that is still under
discussion) From WS1 I can access to EJB1 with a jndi lookup:



This does work but I do not like it for testing reasons. I would like to be
able to use the @Inject coupled with an @Produces Something like Class1:



The problem is that the producer does not work, it simply does not use it.
Nevertheless if I use a producer for POJO (not an EJB) it does work.
Furthermore, I did not manage to inject the remote EJB with
@EJB(lookup="....") I did find the tutorials and tried them but without
success. Any idea? Many thanks in advance



--
View this message in context: http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Accessing Remote EJBs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
FYI:
http://openejb.apache.org/examples-trunk/cdi-alternative-and-stereotypes/

if you update the code to use ejb it works fine too

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*




2012/8/21 Romain Manni-Bucau <rm...@gmail.com>

> alternative should work, producers too...but with your cause i wonder if
> CDI is activated in your project.
>
> BTW,that's maybe a G issue so maybe ask on G list too
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau*
> *Blog: http://rmannibucau.wordpress.com*
>
>
>
>
> 2012/8/21 Steve Hostettler <st...@gmail.com>
>
>> Hi Romain and thanks for helping.
>>
>> By does not work I mean NullPointerException when using the property. In
>> other terms nothing has been injected.
>>
>> Regarding the second remark, I do not have the complete overview but I
>> though that geronimo is using openEJB isn't it?
>>
>> My main problem is that I would like to completly remove the @EJB
>> annotation
>> is order to @Inject. Therefore, I can have two producers one for the EJB
>> and
>> one for the mock. If possible I'd like to use the @alternative  for that.
>>
>> Thanks again for helping
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934p4656936.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
>

Re: Accessing Remote EJBs

Posted by Steve Hostettler <st...@gmail.com>.
As a matter of fact I did post on glassfish's forum. Unfortunatly, they do
not answer as fast as you do.
Thanks for the link but I start to suspect that it is indeed a glassfish
problem. I think they use OpenEJB 3.x instead of 4.

Thanks again for your help



--
View this message in context: http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934p4656948.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Accessing Remote EJBs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
alternative should work, producers too...but with your cause i wonder if
CDI is activated in your project.

BTW,that's maybe a G issue so maybe ask on G list too

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*




2012/8/21 Steve Hostettler <st...@gmail.com>

> Hi Romain and thanks for helping.
>
> By does not work I mean NullPointerException when using the property. In
> other terms nothing has been injected.
>
> Regarding the second remark, I do not have the complete overview but I
> though that geronimo is using openEJB isn't it?
>
> My main problem is that I would like to completly remove the @EJB
> annotation
> is order to @Inject. Therefore, I can have two producers one for the EJB
> and
> one for the mock. If possible I'd like to use the @alternative  for that.
>
> Thanks again for helping
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934p4656936.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Accessing Remote EJBs

Posted by Steve Hostettler <st...@gmail.com>.
Hi Romain and thanks for helping.

By does not work I mean NullPointerException when using the property. In
other terms nothing has been injected.

Regarding the second remark, I do not have the complete overview but I
though that geronimo is using openEJB isn't it?

My main problem is that I would like to completly remove the @EJB annotation
is order to @Inject. Therefore, I can have two producers one for the EJB and
one for the mock. If possible I'd like to use the @alternative  for that.

Thanks again for helping



--
View this message in context: http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934p4656936.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Accessing Remote EJBs

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you explicit the "does not work"? you should be able to produce a
client.

BTW in openejb (not sure about Geronimo) you can configure the way you want
to lookup your ejb and then inject it with @EJB(mappedName =
"jndi:ext://<properties provider id>:<ejb name>")

the properties provider is a resource:

<Resource id="... type="org.apache.openejb.config.sys.JndiProvider>
  java.naming.factory.initial = ...
  // your other initial context properties
</Resources>

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*




2012/8/21 Steve Hostettler <st...@gmail.com>

> Hi all!
>
> I use geronimo 3.0 and therefore OpenEJB.
>
> My projects are organized as follows:
>
>
> so far so good. Now I have a second EAR
>
> EAR2 will be most likely on the same server as EAR1 (but that is still
> under
> discussion) From WS1 I can access to EJB1 with a jndi lookup:
>
>
>
> This does work but I do not like it for testing reasons. I would like to be
> able to use the @Inject coupled with an @Produces Something like Class1:
>
>
>
> The problem is that the producer does not work, it simply does not use it.
> Nevertheless if I use a producer for POJO (not an EJB) it does work.
> Furthermore, I did not manage to inject the remote EJB with
> @EJB(lookup="....") I did find the tutorials and tried them but without
> success. Any idea? Many thanks in advance
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Accessing-Remote-EJBs-tp4656934.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>