users@glassfish.java.net

How to inject EJB to Servlet Filter?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Oct 2009 07:55:08 PDT

I failed to inject an EJB instance to my servlet filter:

import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.ejb.EJB;

import org.apache.struts2.dispatcher.FilterDispatcher;

import my.package.MyBeanHome;

@EJB(beanInterface = MyBeanHome.class)
public class MyFilterDispatcher extends FilterDispatcher {
   private static final Logger LOGGER = Logger.getLogger(MyFilterDispatcher.class.getName());

   @EJB
   private MyBeanHome myBean;

//...
}

myBean is always NULL.

An org.apache.struts2.dispatcher.FilterDispatcher implements org.apache.struts2.StrutsStatics and javax.servlet.Filter.

MyBeanHomeBean is a stateless bean.

What do I wrong?

Thanks a lot.
[Message sent by forum member 'hegalor' (Michael.Decker_at_MobileXAG.de)]

http://forums.java.net/jive/thread.jspa?messageID=368220