Java 是什么使我无法在WAB中使用EJB注入?

Java 是什么使我无法在WAB中使用EJB注入?,java,osgi,glassfish-3,war,ejb-3.1,Java,Osgi,Glassfish 3,War,Ejb 3.1,我试图从我的WAB访问@singleton EJB,但由于“模块状态不一致”错误而失败 我已经创建了一个Web归档包,到目前为止一切都很好。但是我想访问我刚刚创建的EJB 我在servlet侦听器中使用注入,如下所示: @EJB(name="Config") private Configuration config; 当我将WAB部署为一个简单的WAR时,注入工作正常,但OSGI激活器没有激活(这是正常的) 如果我将我的WAB部署为WAB,OSGI激活器被激活,servlet侦听器被激发,但注

我试图从我的WAB访问@singleton EJB,但由于“模块状态不一致”错误而失败

我已经创建了一个Web归档包,到目前为止一切都很好。但是我想访问我刚刚创建的EJB

我在servlet侦听器中使用注入,如下所示:

@EJB(name="Config")
private Configuration config;
当我将WAB部署为一个简单的WAR时,注入工作正常,但OSGI激活器没有激活(这是正常的)

如果我将我的WAB部署为WAB,OSGI激活器被激活,servlet侦听器被激发,但注入不起作用,那么部署失败,堆栈跟踪如下:

    [#|2012-02-26T00:39:34.172+0100|WARNING|glassfish3.1.1|org.glassfish.osgijavaeebase|_ThreadID=26;_ThreadName=Thread-3;|Failed to deploy bundle WABPluginToto [366]
org.glassfish.osgijavaeebase.DeploymentException: Deployment of WABPluginToto [366] failed because of following reason: Failed while deploying bundle WABPluginToto [366] : java.lang.RuntimeException: Failed to deploy bundle [ WABPluginToto [366] ], root cause: Exception while loading the app
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:125)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Failed to deploy bundle [ WABPluginToto [366] ], root cause: Exception while loading the app
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:196)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    ... 10 more
Caused by: org.glassfish.deployment.common.DeploymentException: Error in linking security policy for WABPluginToto_1.0.0.SNAPSHOT -- Inconsistent Module State
    at com.sun.enterprise.security.SecurityUtil.linkPolicyFile(SecurityUtil.java:337)
    at com.sun.enterprise.security.SecurityDeployer.linkPolicies(SecurityDeployer.java:279)
    at com.sun.enterprise.security.SecurityDeployer.access$100(SecurityDeployer.java:81)
    at com.sun.enterprise.security.SecurityDeployer$AppDeployEventListener.event(SecurityDeployer.java:114)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:270)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    ... 12 more
我真的不明白为什么

我还有一个问题:如果我尝试在OSGI激活器中使用注入,那么属性总是空的

如何在OSGI实例中使用EJB

谢谢大家