[jboss-user] [EJB/JBoss] - forever problem! right way to create and deploy bean

henry _h do-not-reply at jboss.com
Wed Jul 4 03:25:08 EDT 2007


Hi,
i am new in Beans issue. I have a stateless Hellowrod Session bean.
(MyBean.java, MyBeanRemote )
and a Client, MyBeanCleint.
With eclipse i export/deploy the Project as Jar file to Jboss 4.0.5
(Left click project -> export-> jar file)
So i have a created jar file MyBean.jar in Jboss.
When i run the client i become ?Mybean not bound exception? from the 
naming server!
?All files? which i have in my project are (project is according to the book sample 
created as general java project):
1-sever.MyBean.java
2.server.MyBeanRemote.java
3-client.MyBeanClient.java

Here is my client code:
//////////////////////////////////
public class MyBeanClient {
	
	public static void main(String[] args) {
		try {
			Properties p = new Properties();
			p.put(Context.INITIAL_CONTEXT_FACTORY,
					"org.jnp.interfaces.NamingContextFactory");
			p.put(Context.URL_PKG_PREFIXES,
					"org.jboss.naming:org.jnp.interfaces");
			p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
			Context ctx = new InitialContext(p);
			Object ref = ctx.lookup("MyBean");
			MyBeanRemote mbr = (MyBeanRemote) PortableRemoteObject
					.narrow(ref, MyBeanRemote.class);

			System.out.println( mbr.sayHello());
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}
////////////////////////////////
Please help me
thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060261#4060261

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060261



More information about the jboss-user mailing list