8 Replies Latest reply on Apr 26, 2007 3:04 PM by Tomasz Milczarek

    Annotation @EJB not working

    Sven Borkert Newbie


      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:

      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?