首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >EJB7:没有可用的JBoss接收器

EJB7:没有可用的JBoss接收器
EN

Stack Overflow用户
提问于 2012-07-09 14:48:20
回答 3查看 5.4K关注 0票数 1

我是JBoss 7的新手,我正面临着奇怪的行为。有时,当我尝试调用会话bean时,会遇到以下异常:

代码语言:javascript
代码运行次数:0
运行
复制
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.util.List myServlet.getData() throws myException' threw an unexpected exception: java.lang.IllegalStateException: No EJB receiver available for handling [appName:myAppNameEE,modulename:myModuleEJB,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@3e23bd28

这通常发生在从Eclipse运行我的GWT应用程序时。异常并不总是发生。有时,它发生的次数比其他人要少。有时,每次我调用会话bean时都会发生这种情况,这是一种痛苦。我阅读了教程(https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI?_sscc=t),我非常确定jboss-ejb-client.properties位于正确的位置。

我的jboss-ejb-client看起来像这样:

endpoint.name=myAppEE/myAppEJB remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.host=localhost remote.connection.default.port = 4447 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

它位于:

myAppEJB\ejbModule\com\myApp\ejb\conf

商务代表:

代码语言:javascript
代码运行次数:0
运行
复制
public class myAppServerDelegate extends ServerDelegate{

private Logger logger = Logger.getLogger(myAppServerDelegate.class.getName());
private myAppRemote theSession = null;

public myAppServerDelegate() throws Exception {

    try {
        theSession = (myAppRemote) getJndiContext().lookup(getJindiLookupName(myAppServerDelegate.class, myAppRemote.class));
    } catch (NamingException e) {
        throw (e);
    }
}

public List<myDataDTO> getAllmyDataBy(String a, String b,
        String c, String d,Integer e,
        Integer f) throws ServerDelegateException {

        return theSession.getAllmyDataBy(a, b, c, d,e,f);
}

public Integer getCountmyDataBy(String a, String b, String c, String d) throws ServerDelegateException {

    return theSession.getCountmyDataBy(a, b, c, d);
}
...

public String getServiceMessage() {

    return theSession.getServiceMessage();
}

...
}

会话bean:

代码语言:javascript
代码运行次数:0
运行
复制
@Stateless

public class myAppSession implements myAppRemote {

private Logger logger = Logger.getLogger(myAppSession.class.getName());
@PersistenceContext
protected EntityManager entityManager;
@EJB
private myAppHomeLocal beanmyApp;

...

public String getServiceMessage() {

    return "MESSAGGIODISERVIZIO";
}

public List<myDataDTO> getAllmyDataBy(String a,String b,
        String c, String d,Integer e,
        Integer f) throws ServerDelegateException {

    logger.info("myAppSession.getAllmyDataBy.");
    List<myData> entityList = findByParms(a, b, c, d,e,f);
    return myDataAssemblyDTO.getmyDataDTOList(entityList);
}

public Integer getCountmyDataBy(String a,String b, String c, String d) throws ServerDelegateException {

    return findByParmsCount(a, b, c, d);
}
...
}

servlet:

代码语言:javascript
代码运行次数:0
运行
复制
...

@SuppressWarning(“串行”)

公共类MyGenericServiceImpl扩展了RemoteServiceServlet实现的MyGenericService {

代码语言:javascript
代码运行次数:0
运行
复制
private MyAppServerDelegate myAppServerDelegate = null;

public MyGenericServiceImpl() throws Exception{
    super();
    myAppServerDelegate = new MyAppServerDelegate();
}

private MyAppServerDelegate getDelegate()    {
    return myAppServerDelegate;
}

private myGWTException buildLocalExceptionFromServerException(ServerDelegateException sde)    {
    myGWTException x = new myGWTException();
    x.setParms(sde.guiMessage,sde.timestamp,sde.tipoEvento);
    return x;
}

@Override
public PagingLoadResult<myDataBean> getAllmyDataBy(String a, String b, String c, PagingLoadConfig plc) throws MyGWTException {
    try    {
        String cs = ((UserSessionBean)this.getThreadLocalRequest().getSession().getAttribute("user")).getCodiceStudio();
        List<myDataBean> tsb = MyDataClientAssembly.getMyDataBeanList(myAppServerDelegate.getAllmyDataBy(cs, a, b, c, plc.getOffset(), plc.getLimit()));
        return new BasePagingLoadResult<MyDataBean>(tsb, plc.getOffset(), myDataServerDelegate.getCountmyDataBy(cs, a, b, c));
    } catch (ServerDelegateException sde)    {
        throw buildLocalExceptionFromServerException(sde);
    }
}

@Override
public String getServiceMessage() {
    return getDelegate().getServiceMessage();
}

@Override
public Integer getCountmyDataBy(String a, String b, String c) throws AmbrogioGWTException {
    try    {
        String cs = ((UserSessionBean)this.getThreadLocalRequest().getSession().getAttribute("user")).getCs();
        return myAppServerDelegate.getCountmtDataBy(cs, a, b, c);
    } catch (ServerDelegateException sde)    {
        throw buildLocalExceptionFromServerException(sde);
    }
}
}

服务器委托:

代码语言:javascript
代码运行次数:0
运行
复制
public class ServerDelegate {

static public String getJindiLookupName( Class<?> theBeanClass, Class<?> theSessionClass) throws NamingException    {
    String jbossServerName = System.getProperty("jboss.server.name");
    if (jbossServerName== null ||  "".equals(jbossServerName)){
        return "myAppEE/myAppEJB/"+ theBeanClass.getSimpleName() + "!" + theSessionClass.getName();
    }else{
        return "java:global/myAppEE/myAppEJB/" + theBeanClass.getSimpleName() + "!" + theSessionClass.getName();
    }       
}

static public Context getJndiContext() throws NamingException    {
    System.out.println("ServerDelegate.getJndiContext");
    final Properties jndiProperties = new Properties();
    String jbossServerName = System.getProperty("jboss.server.name");
    if (jbossServerName== null ||  "".equals(jbossServerName)){
        jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());
        jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");
        jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
        }             
    return new InitialContext(jndiProperties);       
    }
}

我搞不懂发生了什么事。蒂娅。

弗朗西斯科

EN

回答 3

Stack Overflow用户

发布于 2012-08-31 22:32:56

这可能是使用Local vs Remote接口的问题,也可能是连接问题。

尝试在org.jboss.ejb.client包上启用TRACE日志级别。如果您的类路径中已经有一个log4j.properties,请包括下面这行:

代码语言:javascript
代码运行次数:0
运行
复制
log4j.logger.org.jboss.ejb.client=TRACE

This post包含用于调试JBoss EJB客户端的其他线索。

票数 2
EN

Stack Overflow用户

发布于 2012-11-10 02:45:14

有一个我必须包含在mavens pom.xml文件中的依赖项列表。其中包括

  1. jboss-ejb-client
  2. xnio-nio
  3. jboss-remote-naming
  4. jboss-sasl
  5. jboss-transaction-ap
  6. jboss-marshalling
  7. jboss-marshalling-river

我能够成功地从我的独立java客户机发出远程请求,但是我确实看到了以下问题

Jboss 7.1: 13:43:25,028信息stdout Hello world 13:43:25,825 ERROR org.jboss.remoting.remote.connection (Remoting "mycomputername“read-1) JBREM000200:远程连接失败: java.io.IOException:现有连接被远程主机强制关闭

我的java ejb客户端:警告Remoting "client-endpoint" task-2 -收到标题为0xffffffff的不支持的消息

在线阅读的人们似乎已经通过更新某些jars的版本来解决了这个问题。然而,我还没有找到一个成功的解决方案。

更新:在部署独立的ejb客户端时,我在类路径中包含了jboss-client.jar。效果很好。

java "$JBOSS_HOME/bin/client/jboss-client.jar;./my-ejb-client.jar“-classpath com.test.Myclient

票数 0
EN

Stack Overflow用户

发布于 2014-02-24 15:17:58

在类MyAppServerDelegate中,必须在以下方法中而不是在构造函数中实例化属性"theSession“:

  • getAllmyDataBy();
  • getCountmyDataBy();
  • getServiceMessage();

theSession方法调用的结果应该存储在一个临时变量中,然后调用getJndiContext().close(),然后返回临时值。

每个连接都必须显式关闭。实际上,当达到允许的最大连接数时,就会发生异常。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11390217

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档