stateless approach is a method call returns a word is used in a very successful and EJB3.0 Jboss7
but call stateful following error:
javax.ejb.NoSuchEJBException: No such EJB[appname=,modulename=EJB_T7,distinctname=,beanname=CartBean,viewclassname=com.yi.sessionful.Cart]
at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler.processMessage(NoSuchEJBExceptionResponseHandler.java:64)
at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:395)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:EJB_T7,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@26aee
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBClientInvocationContext.retryRequest(EJBClientInvocationContext.java:206)
at org.jboss.ejb.client.EJBReceiverInvocationContext.retryInvocation(EJBReceiverInvocationContext.java:95)
at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler.processMessage(NoSuchEJBExceptionResponseHandler.java:78)
at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:395)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler$ResultProducer.getResult(NoSuchEJBExceptionResponseHandler.java:101)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:270)
at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:47)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:272)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:132)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:260)
at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:399)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:140)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.addProduct(Unknown Source)
at com.yi.test.TestFul.main(TestFul.java:30)
invoked method is as follows:
final Properties jndiProperties = new Properties();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final Context context = new InitialContext(jndiProperties);
final String appName = "";
//部署的jar文件的名字
final String moduleName = "EJB_T7";
final String distinctName = "";
//实现类的类名
final String beanName = CartBean.class.getSimpleName();
//接口类的全名
final String viewClassName = Cart.class.getName();
String lookupStr="ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName;
Cart cart = (Cart)context.lookup(lookupStr);
//添加
cart.addProduct("one");
cart.addProduct("two");
//查询
System.out.println(cart.getProItem().size());
Cart interface and its CartBean as follows:
//向购物车中添加商品
public void addProduct(String proName);
//显示商品列表
public List<String> getProItem();
//删除商品
public void removeProduct(String proName);
//清空购物车
public void clearProduct();
private List<String> proList = new ArrayList<String>();
public void addProduct(String proName) {
proList.add(proName);
}
public List<String> getProItem() {
return proList;
}
public void removeProduct(String proName) {
proList.remove(proName);
}
public void clearProduct() {
proList.clear();
}
jboss-ejb-client.properties configuration file is as follows:
endpoint.name=client-endpoint
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
remote.connection.default.username=admin
remote.connection.default.password=admin
seeking master wing .................
------ Solution ---------------- ----------------------------
is not no import jboss-client.jar pack ah
------ For reference only ---------------------------------- -----
------ For reference only ---------------------------------- -----
String lookupStr = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName
I have not ever do this , how do you call the ejb ?
If EJB application packaged as suffix *. jar release file, the default path name is the JNDI
Visit the local interface : EJB-CLASS-NAME/local
Access Remote Interface : EJB-CLASS-NAME/remote
If the EJB packaged into suffix *. ear of J2EE release file, the default path name is the JNDI
Visit the local interface : EAR-FILE-BASE-NAME/EJB-CLASS-NAME/local
Access Remote Interface : EAR-FILE-BASE-NAME/EJB-CLASS-NAME/remote
------ For reference only --------------- ------------------------
I use jboss7 Yeah brother , the previous version I will use ah. .
------ For reference only -------------------------------------- -
I also encountered the problem of the landlord - I ask you how to solve it ? ?
------ For reference only -------------------------------------- -
help help me
没有评论:
发表评论