About Question enthuware.oce-ejbd.v6.2.376 :

Moderator: admin

Post Reply
Guest

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by Guest » Sat Aug 06, 2011 6:23 pm

Why does YLocal yl = (YLocal) sctx.lookup("XYSessionBean") not work? Is it because the bean implements 2 interfaces?

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Sun Aug 07, 2011 9:05 am

This is not valid because -
1. No-interface view is provided only if the bean class does not provide any other view. Or if it provide other views, it also contains @LocalBean annotation. Therefore, the bean code given in the question does not provide a no-interface view.
2. Even if the no-interface view were available in this bean, the name used here to look it up is not right. It should follow rules given in Section 4.4.
3. When interacting with a reference to the no-interface view, the client must not make any assumptions regarding the internal implementation of the reference, such as any instance-specific state that may be present in the reference. Thus, it would not be appropriate to assume that the looked up bean implements YLocal.
If you like our products and services, please help us by posting your review here.

prakashyaji
Posts: 25
Joined: Sun May 13, 2012 1:39 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by prakashyaji » Mon May 14, 2012 5:11 pm

In the explanation you specify as follows
//Does not work
//YLocal yl = (YLocal) sctx.lookup("java:comp/env/ejb/XYSessionBean");

Can you please explain me why this won't work? Is it because the Bean name is not specified or something?

Thanks,
Prakash Yaji

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Wed May 16, 2012 8:33 pm

Because the java:comp space contains the objects that are injected into the component (either using annotation or deployment descriptor). Here, we are not injecting any reference.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

gurpreet_asrgndu
Posts: 55
Joined: Thu Jan 03, 2013 7:51 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by gurpreet_asrgndu » Tue Jul 16, 2013 4:12 pm

YLocal yl = (YLocal) sctx.getBusinessObject(YLocal.class); do we have to always put cast operator ? or is it optional ?

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Tue Jul 16, 2013 6:19 pm

It's optional.
If you like our products and services, please help us by posting your review here.

n4noman
Posts: 4
Joined: Thu Apr 09, 2015 8:44 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by n4noman » Thu Apr 09, 2015 12:21 pm

How can a bean declare 2 local interfaces?

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Thu Apr 09, 2015 8:28 pm

By using the implements clause - ... implements I1 , I2.
If you like our products and services, please help us by posting your review here.

n4noman
Posts: 4
Joined: Thu Apr 09, 2015 8:44 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by n4noman » Fri Apr 10, 2015 3:07 am

I was talking about this specific question, where it says:

Code: Select all

@Stateful @Local({XLocal.class, YLocal.class}) 
public class XYSessionBean implements XLocal, YLocal {
Is it allowed to declare more than one interface via @Local or @Remote annotation?

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Fri Apr 10, 2015 5:03 am

Yes, it is possible.
If you like our products and services, please help us by posting your review here.

negociadordns
Posts: 2
Joined: Tue Mar 04, 2014 7:03 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by negociadordns » Mon May 04, 2015 10:54 am

The case of the bean name in the first answer is incorrect.

(YLocal) sctx.lookup("java:global/EJBD-ToyApp/EJBD-ToyApp-ejb/XYSessionbean!YLocal");

Please change XYSessionbean to XYSessionBean, so the answer would be 100% correct.


Regards

peter.varga
Posts: 5
Joined: Wed Dec 16, 2015 3:16 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by peter.varga » Sun Mar 18, 2018 4:23 pm

"YLocal yl = (YLocal) sctx.lookup("YLocal");"
I suppose this option is not correct because of the name String. What String would be correct?

peter.varga
Posts: 5
Joined: Wed Dec 16, 2015 3:16 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by peter.varga » Sun Apr 08, 2018 2:38 pm

Please, someone answer my question!

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Sun Apr 08, 2018 9:58 pm

Yes, the name is incorrect. The correct string is already given in option 1: "java:global/EJBD-ToyApp/EJBD-ToyApp-ejb/XYSessionbean!YLocal"
You should also go through section 4.4 of Global JNDI Access of EJB 3.1 for complete details.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

admin
Site Admin
Posts: 7593
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.376 :

Post by admin » Sun Apr 08, 2018 10:05 pm

negociadordns wrote:The case of the bean name in the first answer is incorrect.

(YLocal) sctx.lookup("java:global/EJBD-ToyApp/EJBD-ToyApp-ejb/XYSessionbean!YLocal");

Please change XYSessionbean to XYSessionBean, so the answer would be 100% correct.


Regards
Fixed.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests