Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError running ejb Client  RSS feed

 
Nalini Reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have written a small HelloWorld ejb and have also deployed successfully on Jboss3.0.6_tomcat-4.1.18.
But when i try to run the client program,i get Exception in thread main:NoClassDefFoundError rg/jboss/logging/Logger error.


Could any of you please help me out soon.


My client ejb is as follows:import java.rmi.RemoteException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.util.Hashtable;

public class HelloClient
{
public static void main(String args[]) throws Exception
{
// String JNDI_NAME ="ejb20-Hello-HelloHome";
Hashtable h=new Hashtable();

h.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");

h.put(Context.PROVIDER_URL, "localhost:1099");

h.put("java.naming.factory.url.pkgs",
"org.jboss.naming rg.jnp.interfaces");

InitialContext initial=new InitialContext(h);

Object obj=initial.lookup("ejb/Hello");

HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);


Hello hello=home.create();
System.out.println(hello.hello());

hello.remove();
}
}


Thanks and regards
Nalini.
 
H Sivad
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nalini Reddy:
Hi All,

I have written a small HelloWorld ejb and have also deployed successfully on Jboss3.0.6_tomcat-4.1.18.
But when i try to run the client program,i get Exception in thread main:NoClassDefFoundError rg/jboss/logging/Logger error.


Could any of you please help me out soon.


My client ejb is as follows:import java.rmi.RemoteException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.util.Hashtable;

public class HelloClient
{
public static void main(String args[]) throws Exception
{
// String JNDI_NAME ="ejb20-Hello-HelloHome";
Hashtable h=new Hashtable();

h.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");

h.put(Context.PROVIDER_URL, "localhost:1099");

h.put("java.naming.factory.url.pkgs",
"org.jboss.naming rg.jnp.interfaces");

InitialContext initial=new InitialContext(h);

Object obj=initial.lookup("ejb/Hello");

HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);


Hello hello=home.create();
System.out.println(hello.hello());

hello.remove();
}
}


Thanks and regards
Nalini.



You need to make sure and if needed add the jar containing "rg/jboss/logging/Logger" to the server configuration. At run time, the server will try to find this class in it's classpath, so you need to be sure it's there.

H
 
Nalini Reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am unable to find that..Could u please guide me..

Thanks and regards
Nalini.
 
H Sivad
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nalini Reddy:
Hi

I am unable to find that..Could u please guide me..

Thanks and regards
Nalini.


I have not used JBoss, but based on experience with other servers would look in the administration configuration section dealing with "environment".

You can also package the jar with you EAR file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!