Client Problem
binnyms Feb 10, 2004 4:07 AMHi,
I am new to jboss. I have downloaded , installed and sucessfully deployed a test bean (in server/default/deploy directory)
but when i run the client program it is giving the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Log
ger
at org.jnp.interfaces.NamingContext.(NamingContext.java:102)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingConte
xtFactory.java:41)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
62)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
at Client.main(Client.java:25)
I have added jboss-j2ee.jar, jnp-client.jar and jboss-client.jar into the classpath
I am using the following program as client
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import com.javapro.ejb.StringProcessor;
import com.javapro.ejb.StringProcessorHome;
public class Client {
public static void main(String[] args) {
// first argument must be the input
if (args.length==0) {
System.out.println("Please specify the input to convert to upper case.");
return;
}
String input = args[0];
// preparing properties for constructing an InitialContext object
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");
try {
// Get an initial context
InitialContext jndiContext = new InitialContext(properties);
System.out.println("Got context");
// Get a reference to the Bean
Object ref = jndiContext.lookup("StringProcessor");
System.out.println("Got reference");
// Get a reference from this to the Bean's Home interface
StringProcessorHome home = (StringProcessorHome)
PortableRemoteObject.narrow (ref, StringProcessorHome.class);
// Create an Adder object from the Home interface
StringProcessor sp = home.create();
System.out.println ("Uppercase of '" + input + "' is " +
sp.toUpperCase(input));
}
catch(Exception e) {
System.out.println(e.toString());
}
}
}
What could be wrong??
Please help
Binny