Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

Glassfish 4 filter with @EJB

$
0
0

Hi guys.

I'm developing an REST application using Glassfish 4.0. I'm using JAX-RS filters and I'm trying to use an EJB in the filter. The bean with @EJB annotation works on any REST resource in the project, except on the filter.

See code below:

######### MyBean #########

@Remote
public interface MyBeanInterface {
String getStuff();
}

-----

@Stateless
public class MyBean implements MyBeanInterface {

@Override
public String getStuff() {
return "stuff done";
}
}

######### Filter #########

@Provider
public class UpdateFilter implements ContainerRequestFilter {

@EJB
private MyBeanInterface doStuffBean;

@Override
public void filter(ContainerRequestContext requestContext) {
....
}
}

####################

"doStuffBean" is always null.

Can anyone help me?


Viewing all articles
Browse latest Browse all 1091

Trending Articles