Search code examples
javajakarta-eeejbjavabeansstripes

Stripes Injection Enricher: can't connect to ejb module


I got Java EE project. In the ejb module I have this class

@LocalBean
@Stateless
public class TestBean implements Test{

@PersistenceContext(unitName = "-----")
EntityManager em = null;

public Manager findByName(String name) {
    Manager manager = em.createNamedQuery("Manager.findByName", Manager.class).
            setParameter("name", name).getSingleResult();

    return manager;
}

}

In web module I have this class:

public abstract class BaseActionBean implements ActionBean  {

private MyActionBeanContext context;

@EJB
public TestBean wrapper;


public MyActionBeanContext getContext() {
    return context;
}

public void setContext(ActionBeanContext context) {
    this.context = (MyActionBeanContext) context;
}
}

In web.xml file I have this:

<init-param> 
        <param-name>Extension.Packages</param-name> 
        <param-value>
           com.samaxes.stripes.inject
        </param-value>
    </init-param>

But when I want to use this wrapper I got 'null'. stipes version 1.5.7 stripes-injection-enricher-1.0.3(this libraries added to web module) How can I inject to my EJB module? please help


Solution

  • I included stripes jar in ejb module and then wrote mappedName to ejb class

    @EJB(mappedName = "java:global/project-name/project-name-ejb/TestBean")
    public TestBean testBean;
    

    Now it works