Annotations (@EJB, @Resource, ...) within a RESTful Service

Posted by Dominik on Stack Overflow See other posts from Stack Overflow or by Dominik
Published on 2010-03-19T15:41:47Z Indexed on 2010/03/20 15:51 UTC
Read the original article Hit count: 435

Filed under:
|
|
|

Hi!

I'm trying to inject a EJB within my RESTful Service (RESTEasy) via Annotations.

public class MyServelet implements MyServeletInterface {

...

@EJB

MyBean mybean;

...

}

Unfortunately there is no compilation or AS error, the variable "mybean" is just null and I get a NullPointerException when I try to use it.

What I'm doing wrong?

Here are some side-informations about my architecture:

  • JBoss 4.2.2.GA
  • Java version: 1.5.0_17
  • local MDB-Project
  • remote EJB-Project
  • WAR Project with the RESTful Service which uses the remote EJB and sends messages to the local MDB-Project

Thanks in advance!

br Dominik

p.s: everything is working fine when I use normal context lookup.

© Stack Overflow or respective owner

Related posts about rest

Related posts about java