I am again iterating the steps which I have done to create ejb
1. I created a package com.webage.ejbs
i. Created an Interface
package com.webage.ejbs;
import javax.ejb.*;
@Remote
public interface SimpleBean {
public String sayHello(String name);
}
ii. Create the class for implementing the interface
package com.webage.ejbs;
import javax.ejb.Stateless;
@Stateless
public class SimpleBeanImpl implements SimpleBean {
public String sayHello(String name) {
return "Hello " + name + "!";
}
}
2. I Packed the above class in beans.jar
3. I created a folder and copied the beans.jar in it.
4. I also created a META-INF Folder & copied a application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee [url=http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">]http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">[/url]
<display-name>Simple</display-name>
<description>Simple EJB3</description>
<module>
<ejb>beans.jar</ejb>
</module>
</application>
5. I named the folder as firstebj3.ear
6. Final Folder Structure
firstebj3.ear
META-INF
application.xml
manifest.mf
beans.jar
7. I copied the firstebj3.ear in <JSOSS_HOME>\server\default\deploy folder
8. I started the server.
9. Following is the snap shot of
http://localhost:8080/jmx-console Searched For: jboss.j2ee
ear=firstebj3.ear,jar=beans.jar,name=SimpleBeanImpl,service=EJB3
module=beans.jar,service=EJB3
service=ClientDeployer
service=EARDeployer
service=EARDeployment,url='firstebj3.ear'
service=EARDeployment,url='jbossejb30.ear'
10. I am trying to call the above ejb from local client
package com.webage.client;
import java.util.Properties;
import javax.naming.*;
import com.webage.ejbs.SimpleBean;
public class TestClient {
public void runTest() throws Exception {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming
rg.jnp.interfaces");
props.setProperty("java.naming.provider.url", "jnp://127.0.0.1:1099");
InitialContext ctx = new InitialContext(props);
SimpleBean bean = (SimpleBean) ctx.lookup("firstebj3/SimpleBeanImpl/Remote");
String result = bean.sayHello("Billy Bob");
System.out.println(result);
}
public static void main(String[] args) {
try {
TestClient cli = new TestClient();
cli.runTest();
} catch (Exception e) {
e.printStackTrace();
}
}
}
WHAT AM I MISSING?
PLEASE HELP!!!