|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
EJB injection does not seem to work when using mapped name annotation attributeHi -
When using OpenEJB3.1 and 3.1.1 we are noticing that when we use the 'mappedName' attribute of the @EJB annotation, OpenEJB does not seem to successfully inject the EJB. For example: @EJB(mappedName="FooImpl/Local") Foo myInjectedFoo; // does not work, always null @EJB Foo myOtherInjectedFoo; // works We noticed that the mappedName problem only occurs when the injected bean is used by a outside it's own Eclipse project (i.e. Project A injects Foo into one of its SLSBs, but Foo is defined in Project B). Can someone help or suggest a work around? Many Thanks. -greg |
|
|
RE: EJB injection does not seem to work when using mapped name annotation attributeAre these separate JAR files? Is there a mappedName for the
@Stateless/@Stateful EJB? -----Original Message----- From: Totsline, Greg [mailto:greg.totsline@...] Sent: Tuesday, October 20, 2009 6:50 PM To: users@... Subject: EJB injection does not seem to work when using mapped name annotation attribute Hi - When using OpenEJB3.1 and 3.1.1 we are noticing that when we use the 'mappedName' attribute of the @EJB annotation, OpenEJB does not seem to successfully inject the EJB. For example: @EJB(mappedName="FooImpl/Local") Foo myInjectedFoo; // does not work, always null @EJB Foo myOtherInjectedFoo; // works We noticed that the mappedName problem only occurs when the injected bean is used by a outside it's own Eclipse project (i.e. Project A injects Foo into one of its SLSBs, but Foo is defined in Project B). Can someone help or suggest a work around? Many Thanks. -greg No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09 18:42:00 |
|
|
Re: EJB injection does not seem to work when using mapped name annotation attributeInside the bean you're trying to inject, does the following code
return an object: new InitialContext().lookup("FooImpl/Local") ? Is the "Foo" EJB mapped to FooImpl/Local and how? If not, are you using a JNDI format to define the above bean-class/interface format? Quintin Beukes On Wed, Oct 21, 2009 at 12:49 AM, Totsline, Greg <greg.totsline@...> wrote: > Hi - > > When using OpenEJB3.1 and 3.1.1 we are noticing that when we use the 'mappedName' attribute of the @EJB annotation, OpenEJB does not seem to successfully inject the EJB. For example: > > @EJB(mappedName="FooImpl/Local") > Foo myInjectedFoo; // does not work, always null > > @EJB > Foo myOtherInjectedFoo; // works > > We noticed that the mappedName problem only occurs when the injected bean is used by a outside it's own Eclipse project (i.e. Project A injects Foo into one of its SLSBs, but Foo is defined in Project B). > > Can someone help or suggest a work around? > > Many Thanks. > > -greg > > > > |
|
|
RE: EJB injection does not seem to work when using mapped name annotation attributeHi -
Yes, the lookup from the IC works. I am using the following JNDI format: {ejbClass.simpleName}/{interfaceType.annotationName} Note that if I simply move the bean I am trying to inject into the same eclipse project as the bean doing the injection, everything works fine. This problem only occurs when the bean I am trying to inject is in a different project. Thanks. -greg -----Original Message----- From: Quintin Beukes [mailto:quintin@...] Sent: Wednesday, October 21, 2009 3:31 AM To: users@... Subject: Re: EJB injection does not seem to work when using mapped name annotation attribute Inside the bean you're trying to inject, does the following code return an object: new InitialContext().lookup("FooImpl/Local") ? Is the "Foo" EJB mapped to FooImpl/Local and how? If not, are you using a JNDI format to define the above bean-class/interface format? Quintin Beukes On Wed, Oct 21, 2009 at 12:49 AM, Totsline, Greg <greg.totsline@...> wrote: > Hi - > > When using OpenEJB3.1 and 3.1.1 we are noticing that when we use the 'mappedName' attribute of the @EJB annotation, OpenEJB does not seem to successfully inject the EJB. For example: > > @EJB(mappedName="FooImpl/Local") > Foo myInjectedFoo; // does not work, always null > > @EJB > Foo myOtherInjectedFoo; // works > > We noticed that the mappedName problem only occurs when the injected bean is used by a outside it's own Eclipse project (i.e. Project A injects Foo into one of its SLSBs, but Foo is defined in Project B). > > Can someone help or suggest a work around? > > Many Thanks. > > -greg > > > > |
|
|
RE: EJB injection does not seem to work when using mapped name annotation attributeI just came across the following thread:
http://www.nabble.com/@... Based on this, it appears support for @EJB(mappedName) is limited to just the simple bean name. I understand that its use is not portable across App Servers, but in OEJB 3.1.1 we don't have the control we need for JNDI names. We need to make the annotation name lower case, which I understand is now provided in OEJB 3.1.2 as: {ejbClass.simpleName}/{interfaceType.annotationName.lc} Is there any workaround available for 3.1.1? Thanks. -greg -----Original Message----- From: Totsline, Greg Sent: Wednesday, October 21, 2009 8:36 AM To: users@... Subject: RE: EJB injection does not seem to work when using mapped name annotation attribute Hi - Yes, the lookup from the IC works. I am using the following JNDI format: {ejbClass.simpleName}/{interfaceType.annotationName} Note that if I simply move the bean I am trying to inject into the same eclipse project as the bean doing the injection, everything works fine. This problem only occurs when the bean I am trying to inject is in a different project. Thanks. -greg -----Original Message----- From: Quintin Beukes [mailto:quintin@...] Sent: Wednesday, October 21, 2009 3:31 AM To: users@... Subject: Re: EJB injection does not seem to work when using mapped name annotation attribute Inside the bean you're trying to inject, does the following code return an object: new InitialContext().lookup("FooImpl/Local") ? Is the "Foo" EJB mapped to FooImpl/Local and how? If not, are you using a JNDI format to define the above bean-class/interface format? Quintin Beukes On Wed, Oct 21, 2009 at 12:49 AM, Totsline, Greg <greg.totsline@...> wrote: > Hi - > > When using OpenEJB3.1 and 3.1.1 we are noticing that when we use the 'mappedName' attribute of the @EJB annotation, OpenEJB does not seem to successfully inject the EJB. For example: > > @EJB(mappedName="FooImpl/Local") > Foo myInjectedFoo; // does not work, always null > > @EJB > Foo myOtherInjectedFoo; // works > > We noticed that the mappedName problem only occurs when the injected bean is used by a outside it's own Eclipse project (i.e. Project A injects Foo into one of its SLSBs, but Foo is defined in Project B). > > Can someone help or suggest a work around? > > Many Thanks. > > -greg > > > > |
|
|
Re: EJB injection does not seem to work when using mapped name annotation attributeOn Oct 21, 2009, at 6:39 AM, Totsline, Greg wrote: > I just came across the following thread: > > http://www.nabble.com/@... > > Based on this, it appears support for @EJB(mappedName) is limited to > just the simple bean name. More specifically the mappedName points to the internal globally unique ID of the bean. A bean may have several JNDI names (one for each business interface), but just one ID (which we call the deployment id). So it isn't a matter using the right JNDI name format, the way we resolve mapped name isn't linked to JNDI at all. I'm not sure how your Eclipse structure translates to how things are deployed in the target server. If you mean separate jars but in the same ear, then the @EJB.beanName attribute is guaranteed to work and be portable. If the two jars are deployed separately (not in an ear or in different ears), then there is no spec defined guaranteed portable way (well none that doesn't require extra vendor specific information). In OpenEJB @EJB.beanName will still work, if that works in JBoss, then that would definitely be the way to go. Either way this is the second time this has come up, so I'll definitely add that "jndi name" based mappedName support. We can probably do it as a fallback when resolution using the deploymentId doesn't work. -David > -----Original Message----- > From: Totsline, Greg > Sent: Wednesday, October 21, 2009 8:36 AM > To: users@... > Subject: RE: EJB injection does not seem to work when using mapped > name annotation attribute > > Hi - > > Yes, the lookup from the IC works. I am using the following JNDI > format: > {ejbClass.simpleName}/{interfaceType.annotationName} > > Note that if I simply move the bean I am trying to inject into the > same eclipse project as the bean doing the injection, everything > works fine. This problem only occurs when the bean I am trying to > inject is in a different project. > > Thanks. > > -greg > > -----Original Message----- > From: Quintin Beukes [mailto:quintin@...] > Sent: Wednesday, October 21, 2009 3:31 AM > To: users@... > Subject: Re: EJB injection does not seem to work when using mapped > name annotation attribute > > Inside the bean you're trying to inject, does the following code > return an object: > > new InitialContext().lookup("FooImpl/Local") ? > > Is the "Foo" EJB mapped to FooImpl/Local and how? If not, are you > using a JNDI format to define the above bean-class/interface format? > > Quintin Beukes > > > > On Wed, Oct 21, 2009 at 12:49 AM, Totsline, Greg <greg.totsline@... > > wrote: >> Hi - >> >> When using OpenEJB3.1 and 3.1.1 we are noticing that when we use >> the 'mappedName' attribute of the @EJB annotation, OpenEJB does not >> seem to successfully inject the EJB. For example: >> >> @EJB(mappedName="FooImpl/Local") >> Foo myInjectedFoo; // does not work, always null >> >> @EJB >> Foo myOtherInjectedFoo; // works >> >> We noticed that the mappedName problem only occurs when the >> injected bean is used by a outside it's own Eclipse project (i.e. >> Project A injects Foo into one of its SLSBs, but Foo is defined in >> Project B). >> >> Can someone help or suggest a work around? >> >> Many Thanks. >> >> -greg >> >> >> >> |
|
|
RE: EJB injection does not seem to work when using mapped name annotation attributeDavid -
Thanks for explanation - very helpful! -greg -----Original Message----- From: David Blevins [mailto:david.blevins@...] Sent: Wednesday, October 21, 2009 4:22 PM To: users@... Subject: Re: EJB injection does not seem to work when using mapped name annotation attribute On Oct 21, 2009, at 6:39 AM, Totsline, Greg wrote: > I just came across the following thread: > > http://www.nabble.com/@... > > Based on this, it appears support for @EJB(mappedName) is limited to > just the simple bean name. More specifically the mappedName points to the internal globally unique ID of the bean. A bean may have several JNDI names (one for each business interface), but just one ID (which we call the deployment id). So it isn't a matter using the right JNDI name format, the way we resolve mapped name isn't linked to JNDI at all. I'm not sure how your Eclipse structure translates to how things are deployed in the target server. If you mean separate jars but in the same ear, then the @EJB.beanName attribute is guaranteed to work and be portable. If the two jars are deployed separately (not in an ear or in different ears), then there is no spec defined guaranteed portable way (well none that doesn't require extra vendor specific information). In OpenEJB @EJB.beanName will still work, if that works in JBoss, then that would definitely be the way to go. Either way this is the second time this has come up, so I'll definitely add that "jndi name" based mappedName support. We can probably do it as a fallback when resolution using the deploymentId doesn't work. -David > -----Original Message----- > From: Totsline, Greg > Sent: Wednesday, October 21, 2009 8:36 AM > To: users@... > Subject: RE: EJB injection does not seem to work when using mapped > name annotation attribute > > Hi - > > Yes, the lookup from the IC works. I am using the following JNDI > format: > {ejbClass.simpleName}/{interfaceType.annotationName} > > Note that if I simply move the bean I am trying to inject into the > same eclipse project as the bean doing the injection, everything > works fine. This problem only occurs when the bean I am trying to > inject is in a different project. > > Thanks. > > -greg > > -----Original Message----- > From: Quintin Beukes [mailto:quintin@...] > Sent: Wednesday, October 21, 2009 3:31 AM > To: users@... > Subject: Re: EJB injection does not seem to work when using mapped > name annotation attribute > > Inside the bean you're trying to inject, does the following code > return an object: > > new InitialContext().lookup("FooImpl/Local") ? > > Is the "Foo" EJB mapped to FooImpl/Local and how? If not, are you > using a JNDI format to define the above bean-class/interface format? > > Quintin Beukes > > > > On Wed, Oct 21, 2009 at 12:49 AM, Totsline, Greg <greg.totsline@... > > wrote: >> Hi - >> >> When using OpenEJB3.1 and 3.1.1 we are noticing that when we use >> the 'mappedName' attribute of the @EJB annotation, OpenEJB does not >> seem to successfully inject the EJB. For example: >> >> @EJB(mappedName="FooImpl/Local") >> Foo myInjectedFoo; // does not work, always null >> >> @EJB >> Foo myOtherInjectedFoo; // works >> >> We noticed that the mappedName problem only occurs when the >> injected bean is used by a outside it's own Eclipse project (i.e. >> Project A injects Foo into one of its SLSBs, but Foo is defined in >> Project B). >> >> Can someone help or suggest a work around? >> >> Many Thanks. >> >> -greg >> >> >> >> |
| Free embeddable forum powered by Nabble | Forum Help |