[jboss-user] [EJB/JBoss] - How to access a stateless Bean from Java standalone client

yhqian99 do-not-reply at jboss.com
Sat Mar 28 03:31:01 EDT 2009


Hello All,

I am using MyEclipse5.5 + JBOSS to develop a stateless HelloEJB, after deployment, I can see the deployed bean from http://localhost:8080/jmx-console/. 

Then I use a standalone java client to access the EJB, but get the error of "javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]"


Here is my code:

package com;

import javax.ejb.Stateless;

@Stateless
public class HelloEJB implements HelloEJBLocal, HelloEJBRemote
{
	public HelloEJB()
	{		
	}
	public String sayHello(String name)
	{
		return "Welcome, " + name + ", I am a stateless Session Bean";
	}
}


package com;

import javax.ejb.Local;

@Local
public interface HelloEJBLocal
{
	public String sayHello(String name);
}

package com;

import javax.ejb.Remote;

@Remote
public interface HelloEJBRemote
{
	public String sayHello(String name);
}

I have set the jbossall-client.jar to my java build path, is there anything I missed? Any help are highly apprieciated.

Yhqian

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

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



More information about the jboss-user mailing list