Can a plain servlet be configured to as a seam component?

Posted by stacker on Stack Overflow See other posts from Stack Overflow or by stacker
Published on 2010-06-09T17:59:23Z Indexed on 2010/06/09 18:02 UTC
Read the original article Hit count: 153

I created a plain servlet within a seam-gen (2.1.2) application, now I would like to use injection. Thus I annotated it with @Name and it's recognized as component:

     INFO  [Component] Component: ConfigReport, 
scope: EVENT, type: JAVA_BEAN, class: com.mycompany.servlet.ConfigReport

Unfortunatly the injection of the logger doesn't work NullPointerException in init()

import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;

@Name("ConfigReport")
public class ConfigReport extends HttpServlet {

    @Logger
    private Log log;

    public void init(ServletConfig config) throws ServletException {
        log.info( "BOOM" );
    }

}

Is my approach abusive?
What would be the alternatives (the client sending requests to the servlet is curl, not a browser)?

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets