grails + EJB3 =没有EJB接收器可供处理

时间:2016-12-16 17:23:45

标签: spring groovy jboss ejb

一个简短的问题,我正在将一个旧的jboss 4.2.x GA grails应用程序(2.3.10)移动到wildfly 10,我正在调用我的ejb。

例如,resources.groovy文件中的简单配置:

jndiBinBaseTemplate(JndiTemplate) {

    environment = [
            "java.naming.factory.initial": "org.jboss.naming.remote.client.InitialContextFactory",
            "java.naming.provider.url": "http-remoting://127.0.0.1:8080".toString(),
            "java.naming.security.principal":"test",
            "java.naming.security.credentials":"test",
            "jboss.naming.client.ejb.context":true,
            "java.naming.factory.url.pkgs":"org.jboss.ejb.client.naming"
    ]
}

binbaseStatus(SimpleRemoteStatelessSessionProxyFactoryBean) {
    businessInterface = "edu.ucdavis.genomics.metabolomics.binbase.bci.server.jmx.StatusJMXFacade"
    jndiName = "bci/bci-core/StatusJMXFacadeBean!edu.ucdavis.genomics.metabolomics.binbase.bci.server.jmx.StatusJMXFacade"
    jndiTemplate = ref(jndiBinBaseTemplate)
}

始终导致以下异常:

EJBCLIENT000025: No EJB receiver available for handling [appName:bci, moduleName:bci-core, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4a639717. Stacktrace follows:
java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:bci, moduleName:bci-core, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@4a639717
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
at minix.BinBaseClusterController$_closure4.doCall(BinBaseClusterController.groovy:29)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1360)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:539)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:288)

有人知道缺少什么吗?这似乎是特定于grails的,因为我对远程ejb的arquillian测试工作正常。

1 个答案:

答案 0 :(得分:0)

出于某种原因,我无法解释。这是通过使用两个jndi配置选项来解决的。

ressrouces.groovy:

binbaseProperties(org.springframework.beans.factory.config.MapFactoryBean){         sourceMap = [

            "java.naming.factory.initial": "org.jboss.naming.remote.client.InitialContextFactory",
            "java.naming.provider.url": "http-remoting://${BinBaseConfigReader.getServer()}:8080",
            "${Context.SECURITY_PRINCIPAL}":"binbase",
            "${Context.SECURITY_CREDENTIALS}":"binbase",
            "jboss.naming.client.ejb.context":true,
            "java.naming.factory.url.pkgs":"org.jboss.ejb.client.naming",
            "org.jboss.ejb.client.scoped.context": true,
            "endpoint.name":"client-endpoint",


            "remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED":false,
            "remote.connections":"default",
            "remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS":false,
            "remote.connection.default.host":"${BinBaseConfigReader.getServer()}",
            "remote.connection.default.port":"8080",
            "remote.connection.default.protocol":"http-remoting",
            "remote.connection.default.username":"binbase",
            "remote.connection.default.password":"binbase"


    ]

}

resources.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">

<jee:remote-slsb environment-ref="binbaseProperties" id="binbaseStatus"
                 jndi-name="ejb:bci/bci-core//StatusJMXFacadeBean!edu.ucdavis.genomics.metabolomics.binbase.bci.server.jmx.StatusJMXFacade"
                 business-interface="edu.ucdavis.genomics.metabolomics.binbase.bci.server.jmx.StatusJMXFacade"
                 lazy-init="true" />

如果未提供remote.connection.default属性,则只会在服务器端出现class not found错误而失败,并显示此无用的错误消息。