wildfly 调用EJB出错

wuqianshmily 2014-05-27 04:34:41
我写了个EJB 部署到wildfly 然后java client调用报错:

UserBean
com.imagin.test.User
ejb:/EJBTest02//UserBean!com.imagin.test.User?stateful
五月 27, 2014 4:28:09 下午 org.jboss.ejb.client.EJBClient <clinit>
INFO: JBoss EJB Client version 2.0.0.Final
javax.naming.NamingException: Failed to create proxy [Root exception is java.lang.IllegalStateException: EJBCLIENT000024: No EJB receiver available for handling [appName:, moduleName:EJBTest02, distinctName:] combination]
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:195)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:176)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.imagin.client.EJBTe.main(EJBTe.java:30)
Caused by: java.lang.IllegalStateException: EJBCLIENT000024: No EJB receiver available for handling [appName:, moduleName:EJBTest02, distinctName:] combination
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:813)
at org.jboss.ejb.client.EJBClient.createSessionWithPossibleRetries(EJBClient.java:222)
at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:202)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:216)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:193)
... 3 more

启动jboss 可以看到

java:global/EJBTest02/UserBean!com.imagin.test.User
java:app/EJBTest02/UserBean!com.imagin.test.User
java:module/UserBean!com.imagin.test.User
java:jboss/exported/EJBTest02/UserBean!com.imagin.test.User
java:global/EJBTest02/UserBean!com.imagin.test.UserBean
java:app/EJBTest02/UserBean!com.imagin.test.UserBean
java:module/UserBean!com.imagin.test.UserBean

调用ejb的代码

final Hashtable<String,Object> jndiPropertiesHashtable = new Hashtable<String,Object>();
jndiPropertiesHashtable.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
try {
final Context context = new InitialContext(jndiPropertiesHashtable);
final String appName = "";
final String moduleName = "EJBTest02";
final String distinctName = "";
final String beanName = UserBean.class.getSimpleName();
System.out.println(beanName);
final String viewClassName = User.class.getName();
System.out.println(viewClassName);
String jndiString = "ejb:" + appName + "/" +moduleName
+ "/" + distinctName + "/" + beanName + "!" + viewClassName + "?stateful";
System.out.println(jndiString);
User userBean = (User) context.lookup(jndiString);
userBean.AddBuyItem("<java>");
userBean.AddBuyItem("<c++>");
userBean.setName("hcs");
System.out.println(userBean.getName() + ":"+userBean.getBuyItem().size());

在调用ejb的client中的配置

endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

remote.connections=default

#remote.connection.default.host=10.66.193.129
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

remote.connection.default.username=*******
remote.connection.default.password=********

怎么解决啊??谢谢诶!
...全文
185 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuzeyong 2014-12-18
  • 打赏
  • 举报
回复
增加配置项 "jboss.naming.client.ejb.context", true
jiangrenpo 2014-12-09
  • 打赏
  • 举报
回复
WildFly借助HTTP Upgrade将多种协议复用到HTTP协议上,来减少端口的数量。. 8080 HTTP (Servlet, JAX-RS, JAX-WS), Web Sockets, HTTP Upgraded Remoting (EJB Invocation, Remote JNDI) application
jiangrenpo 2014-12-09
  • 打赏
  • 举报
回复
端口用8080 Here we are listing 2 connections named "one" and "two". Ultimately, each of the connections will map to a EJB receiver. So if you have 2 connections, that will setup 2 EJB receivers that will be added to the EJB client context. Each of these connections will be configured with the connection specific properties as follows: remote.connection.default.host=10.20.30.40 remote.connection.default.port = 8080 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false As you can see we are using the "remote.connection.<connection-name>." prefix for specifying the connection specific property. The connection name here is "default" and we are setting the "host" property of that connection to point to 10.20.30.40. Similarly we set the "port" for that connection to 4447.
woeser 2014-07-15
  • 打赏
  • 举报
回复
我只调成功了本地的,remote的也是一直不行。wildfly默认只有两个端口,8080和9090,,9090是管理端口,8080是其他协议的接口,所以至少4447是不对的。
wuqianshmily 2014-06-20
  • 打赏
  • 举报
回复
恩。我把配置写在了代码里面,自己去读那个配置文件。在官网有人说是配置文件的位置错了,我没试过!

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧