停止持有 JCA 连接工厂的 Weblogic 应用程序时出现异常

Exception on stopping Weblogic application which holds a JCA connection factory

我在 Weblogic 12.2.1.2 上部署了一个 JCA 适配器和一个消费者 Web 应用程序。

JCA 连接工厂通过以下代码注入到我的 EJB 中:

@ConnectionFactoryDefinition(
    interfaceName   = "myapp.adapter.api.MyConnectionFactory",
    name            = "java:comp/env/eis/MyConnectionFactory",
    resourceAdapter = "my-adapter"
)

@Stateless
public class MyEJBBean extends AbstractEJBBean {


    @Resource(lookup = "java:comp/env/eis/MyConnectionFactory")
    private MyConnectionFactory connectionFactory;

    // My methods...
}

按预期工作,但是当我停止或取消部署该应用程序时,出现此异常:

<Oct 9, 2018, 1:23:30,590 PM CEST> <Error> <Connector> <BEA-190125> <An internal consistency check failed, assertion failed: Resource does not exist DOMAIN|myapp.ws_war_0.0.1-SNAPSHOT#my-app-0.0.1-SNAPSHOT-dev#my-app-0.0.1-SNAPSHOT-dev|java:comp/env/eis/MyConnectionFactory|NONE
java.lang.AssertionError: Internal error occurred, Assertion Failed: Resource does not exist DOMAIN|myapp.ws_war_0.0.1-SNAPSHOT#my-app-0.0.1-SNAPSHOT-dev#my-app-0.0.1-SNAPSHOT-dev|java:comp/env/eis/MyConnectionFactory|NONE
    at weblogic.connector.common.Debug.throwAssertionError(Debug.java:2271)
    at weblogic.connector.common.AppDefinedResourceManager.revokeResource(AppDefinedResourceManager.java:122)
    at weblogic.connector.outbound.RAOutboundManager.revokeAppdefinedConnectionFactory(RAOutboundManager.java:558)
    at weblogic.connector.common.RAInstanceManager.revokeAppdefinedConnectionFactory(RAInstanceManager.java:2072)
    at weblogic.connector.external.RAUtil.revokeConnectionFactory(RAUtil.java:409)
    at weblogic.connector.external.RAUtil$AdministeredObjectUtilityServiceImpl.revokeConnectionFactory(RAUtil.java:526)
    at weblogic.application.naming.EnvironmentBuilder.unbindConnectionFactoryResources(EnvironmentBuilder.java:688)
    at weblogic.application.naming.EnvironmentBuilder.unbindEnvEntries(EnvironmentBuilder.java:2042)
    at weblogic.servlet.internal.CompEnv.destroy(CompEnv.java:307)
    at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletContext.java:3191)
    at weblogic.servlet.internal.ServletContextManager.destroyContext(ServletContextManager.java:251)
    at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:672)
    at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.java:1853)
    at weblogic.servlet.internal.WebAppModule.deactivate(WebAppModule.java:909)
    at weblogic.application.internal.ExtensibleModuleWrapper$ActivateStateChange.previous(ExtensibleModuleWrapper.java:328)
    at weblogic.application.internal.ExtensibleModuleWrapper$ActivateStateChange.previous(ExtensibleModuleWrapper.java:313)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:207)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:193)
    at weblogic.application.internal.ExtensibleModuleWrapper.deactivate(ExtensibleModuleWrapper.java:163)
    at weblogic.application.internal.flow.ModuleListenerInvoker.deactivate(ModuleListenerInvoker.java:131)
    at weblogic.application.internal.flow.ModuleStateDriver.previous(ModuleStateDriver.java:216)
    at weblogic.application.internal.flow.ModuleStateDriver.previous(ModuleStateDriver.java:207)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:207)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:193)
    at weblogic.application.internal.flow.ModuleStateDriver.deactivate(ModuleStateDriver.java:101)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(DeploymentCallbackFlow.java:120)
    at weblogic.application.internal.BaseDeployment.previous(BaseDeployment.java:756)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:207)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:193)
    at weblogic.application.internal.BaseDeployment.deactivate(BaseDeployment.java:283)
    at weblogic.application.internal.SingleModuleDeployment.deactivate(SingleModuleDeployment.java:52)
    at weblogic.application.internal.DeploymentStateChecker.deactivate(DeploymentStateChecker.java:202)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.deactivate(AppContainerInvoker.java:114)
    at weblogic.deploy.internal.targetserver.operations.DeactivateOperation.deactivate(DeactivateOperation.java:78)
    at weblogic.deploy.internal.targetserver.operations.RemoveOperation.removeDeployment(RemoveOperation.java:348)
    at weblogic.deploy.internal.targetserver.operations.RemoveOperation.doCommit(RemoveOperation.java:134)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:347)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:901)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1456)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:456)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:181)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:217)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access0(DeploymentReceiverCallbackDeliverer.java:14)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.run(DeploymentReceiverCallbackDeliverer.java:69)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

我尝试了很多变通方法,但每次停止应用程序时都会出现该异常。

怎么了?

非常感谢, 安东尼奥

问题已解决:我删除了 ConnectionFactoryDe​​finition 并在 weblogic-ra.xml 中定义了工厂 JNDI 名称,如下所示:

        <wls:connection-definition-group>
            <wls:connection-factory-interface>myapp.adapter.api.MyConnectionFactory</wls:connection-factory-interface>
            <wls:connection-instance>
                <wls:jndi-name>eis/MyConnectionFactory</wls:jndi-name>
            </wls:connection-instance>
        </wls:connection-definition-group>