• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@EJB static

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there:

i hope you can help me
does have this line of code any sense?

@EJB
private static myStatelessEJB ;

and..... what does it mean ?


Thanks !

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Camilo Diaz wrote:
@EJB
private static myStatelessEJB ;



Is that a typo? Because, it's not going to compile. As for what it means semantically - it's trying to "inject" an EJB into a member of some class. Even semantically, that injection on a static member is only allowed in application clients and for all other components, the injection of an EJB on static fields isn't allowed.

Ofcourse, whatever i said may not make sense, if you are beginning to learn J2EE or EJBs. So feel free to provide more context about your question
 
Camilo Diaz
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the response (Almost nobody answer my questions).

Well... the thing is that i need to use an instance variable of a certain stateless EJB inside a static method. Something like:

@EJB
private static myStatelessEJB myebj;

private static void myMethod()
{
myebj.doStuff();
}

in runtime the application launch a nullpointer exception.
So.... i dont really know what's going on .
Any help ?
 
Camilo Diaz
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well... if anyone wants to help me, i figured out that the real problem is how to inject a variable of a local interface (an ejb with the @Local annotation )inside a static method.

Thnks
 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Camilo Diaz wrote:the thing is that i need to use an instance variable of a certain stateless EJB inside a static method.


Well, what is the importance of that usage?
 
Camilo Diaz
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need to call a local interface from a POJO within a static method, but... the lookup is not working (launch a NameNotFoundException), any help ??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic