Deploy ejb project to JBOSS AS7.1.0 final issue.
clauslee Sep 29, 2013 6:34 AMHi eveyone.
I am new in JBOSS AS 7.1.0. recently, i try to create a EJB project named Myejb and do deployment on JBOSS AS7.1.0 final. The .jar file can be deployed successful as following logs:
8:06:48,580 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-2) Hibernate Validator 4.2.0.Final
18:06:48,714 INFO [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /jboss-as-numberguess
18:06:48,721 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "jboss-as-numberguess.war"
18:06:48,723 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "jboss-as-helloworld.war"
18:06:48,763 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 5169ms - Started 247 of 323 services (74 services are passive or on-demand)
18:06:48,769 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "Myejb.jar"
18:06:48,833 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named HelloworldBean in deployment unit deployment "Myejb.jar" are as follows:
java:global/Myejb/HelloworldBean!com.org.beans.HelloworldBean
java:app/Myejb/HelloworldBean!com.org.beans.HelloworldBean
java:module/HelloworldBean!com.org.beans.HelloworldBean
java:global/Myejb/HelloworldBean!com.org.beans.view.HelloworldBeanRemote
java:app/Myejb/HelloworldBean!com.org.beans.view.HelloworldBeanRemote
java:module/HelloworldBean!com.org.beans.view.HelloworldBeanRemote
java:jboss/exported/Myejb/HelloworldBean!com.org.beans.view.HelloworldBeanRemote
18:06:48,978 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "Myejb.jar"
But, when i try to test my Remotebean instance via run helloworldBeanClient class. the error displayed as following I also test the http://localhost:4447 url is avaliable. Anyone can tell me ? what happed over here. thanks in advance.
2013-9-29 18:28:51 org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@b000b, receiver=Remoting connection EJB receiver [connection=Remoting connection <7fca7fca>,channel=jboss.ejb,nodename=adminib-lr2lmks]} on channel Channel ID c531a8cf (outbound) of Remoting connection 74367436 to localhost/127.0.0.1:4447
2013-9-29 18:28:51 org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleMessage
WARN: Unsupported message received with header 0xffffffff
Exception in thread "main" javax.ejb.NoSuchEJBException: No such EJB[appname=,modulename=Myejb,distinctname=,beanname=com.org.beans.HelloworldBean]
at org.jboss.ejb.client.remoting.GeneralInvocationFailureResponseHandler.processMessage(GeneralInvocationFailureResponseHandler.java:75)
at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:385)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:435)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:736)
2013-9-29 18:28:51 org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleEnd
INFO: Channel Channel ID c531a8cf (outbound) of Remoting connection 74367436 to localhost/127.0.0.1:4447 can no longer process messages
Following codes for your reference.
//helloworldBeanClient class
package com.org.clients;
import javax.naming.Context;
import javax.naming.NamingException;
import com.org.beans.HelloworldBean;
import com.org.beans.view.HelloworldBeanRemote;
import com.org.initializes.InitializeContentUt;
public class helloworldBeanClient {
private static void lookupSources(){
try {
Context cont = InitializeContentUt.getInitialContext();
String lookupStr = getLookupName();
HelloworldBeanRemote hello = (HelloworldBeanRemote) cont.lookup(lookupStr);
System.out.println("Result: "+hello.sayHello());
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static String getLookupName(){
//The ear name of deployed EJB without .ear suffix
String appName = "";
//The jar name of deployed EJB without .jar suffix
String moduleName = "Myejb";
//
String distinctName = "";
//The EJB bean implementation class name
String beanName = HelloworldBean.class.getName();
//The EJB bean remote interface name
String interfaceName = HelloworldBeanRemote.class.getName();
String names = "ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+interfaceName;
System.out.println(""+names);
return names;
}
public static void main(String args[]){
lookupSources();
}
}
//jboss-ejb-client.properties under /src directory
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=passw0rd