I am following the tutorial posted on fawcette by Budi Kurniawan.
http://www.fawcette.com/javapro/2003_01/online/j2ee_bkurniawan_01_09_03/ All the program should do is turn the client input to uppercase - sheesh. Anyway, I followed the example step by step and yet I get this error when i run the program on jboss-3.0.4_tomcat-4.1.12:
///////////////////////////////////////////
java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jnp.interfaces.NamingContext.<clinit>(NamingContext.java:92)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at Client.main(Client.java:39)
Exception in
thread "main"
/////////////////////////////////////////////
This is the client code:
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 = (Properties)properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
// properties = (Properties)properties.setProperty(Context.PROVIDER_URL, "localhost:1099");
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());
}
}
}