[jboss-user] [EJB/JBoss] - Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam

thomas2008ch do-not-reply at jboss.com
Thu May 8 03:30:00 EDT 2008


Here is all my codes:

MyBeanLocal.java
****************
@Local
public interface MyBeanLocal {
	public String test(String text);
}

TestMyBean.java
***************
@Stateless
public class TestMyBean implements MyBeanLocal {

	public static final String LocalJNDIName =  TestMyBean.class.getSimpleName() + "/local";
	
	public String test(String text) {
		return "Hello, " + text;
	}

}

TestClient.java
*************
public class TestClient {
	public static void main(String[] args) {

		Context context;
		try {
			context = new InitialContext();
			MyBeanLocal beanLocal = (MyBeanLocal) context
					.lookup(TestMyBean.LocalJNDIName);
			beanLocal.test("Wei Chen");
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}
}

jndi.properties
*************
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099

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

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



More information about the jboss-user mailing list