[jboss-user] [EJB 3.0] - Annotation @EJB not working

RaoulDuke do-not-reply at jboss.com
Sat Apr 21 08:43:15 EDT 2007


Hello,

I tried out some examples where a servlet in the web part of an EAR tries to access a SessionBean thats in the ejb-jar of the ear.

As I read, something like this should give me a reference that I can use to access the Session bean through the local interface:


  | @EJB
  | private StatelessSession sless;
  | 

Where "StatelessSession" is the name of the local interface.

Now it happens that sless always stays null. It does not get initialized correctly (And there is nothing about a problem visible in the logfiles). I tried this out by myself building a project, and I tried out an Enteprise Application Example that comes with Netbeans 5.5. The Netbeans example is called "ServletStateless". This example does just what I want. I deployed it in jboss 4.0.5 and got a null pointer exception just a the line of code where "sless" gets used the first time. Thats just the same behaviour I had in all my self built examples.

The interesting thing is that all these examples work fine when I deploy in the Sun Application Server 9. So, whats the problem with Jboss here?

Regards,

Sven

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039535#4039535

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039535



More information about the jboss-user mailing list