About Question enthuware.oce-ejbd.v6.2.376 :
Moderator: admin
Re: About Question enthuware.oce-ejbd.v6.2.376 :
Why does YLocal yl = (YLocal) sctx.lookup("XYSessionBean") not work? Is it because the bean implements 2 interfaces?
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
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.
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.
-
- Posts: 25
- Joined: Sun May 13, 2012 1:39 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
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
//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
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 55
- Joined: Thu Jan 03, 2013 7:51 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
YLocal yl = (YLocal) sctx.getBusinessObject(YLocal.class); do we have to always put cast operator ? or is it optional ?
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
It's optional.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Thu Apr 09, 2015 8:44 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
How can a bean declare 2 local interfaces?
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
By using the implements clause - ... implements I1 , I2.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Thu Apr 09, 2015 8:44 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
I was talking about this specific question, where it says:
Is it allowed to declare more than one interface via @Local or @Remote annotation?
Code: Select all
@Stateful @Local({XLocal.class, YLocal.class})
public class XYSessionBean implements XLocal, YLocal {
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
Yes, it is possible.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Tue Mar 04, 2014 7:03 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
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
(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
-
- Posts: 5
- Joined: Wed Dec 16, 2015 3:16 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
"YLocal yl = (YLocal) sctx.lookup("YLocal");"
I suppose this option is not correct because of the name String. What String would be correct?
I suppose this option is not correct because of the name String. What String would be correct?
-
- Posts: 5
- Joined: Wed Dec 16, 2015 3:16 am
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
Please, someone answer my question!
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
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.
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.
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-ejbd.v6.2.376 :
Fixed.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
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 8 guests