如何更正 "The injection target must not be declared static." 警告

How to correct "The injection target must not be declared static." warning

我收到警告

"The IssuePermitProcessManager.ecmManagerLocal injection target must not be declared static."

在我的 WebSphere 9 服务器控制台上。我相信导致问题的代码是:

@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class IssuePermitProcessManager implements IssuePermitProcessManagerRemote, IssuePermitProcessManagerLocal {

    @Resource
    private UserTransaction userTransaction;

    @EJB
    protected static EcmManagerLocal ecmManagerLocal = null;
    protected final static String EcmManagerLocal_JNDI = "ejblocal:gov.mo.dnr.ecwis.sessions.ecm.EcmManagerLocal";

我不清楚注入目标是什么。我只是从 protected static EcmManagerLocal ecmManagerLocal = null; 声明中删除 static 吗?

是的,ecmManagerLocal 是一个声明为静态的注入目标(用 @EJB 注释以注入 ejb)。替换代码行,

    @EJB
    protected static EcmManagerLocal ecmManagerLocal = null;

    @EJB
    protected EcmManagerLocal ecmManagerLocal;