Stripes Injection Enricher:无法连接到ejb模块

时间:2015-08-06 11:26:12

标签: java java-ee ejb javabeans stripes

我有Java EE项目。在ejb模块中,我有这个类

@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;
}

}

在网络模块中,我有这个课程:

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;
}
}

在web.xml文件中我有:

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

但是当我想要使用这个包装时,我得到了&#39; null&#39;。 stipes版本1.5.7 stripe-in​​jection-enricher-1.0.3(此库添加到Web模块) 我如何注入我的EJB模块?请帮忙

1 个答案:

答案 0 :(得分:0)

我在ejb模块中包含了条带jar,然后将mappedName写入了ejb类

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

现在可行了