Daphne Dojo

Greenhorn
+ Follow
since Jan 20, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daphne Dojo

I got it!!!
I added a few more jars to the classpath and it works.
jboss-common.jar
log4j.jar
jboss-client.jar
jbossall-client.jar
Thanks everyone for your help.
21 years ago
Thanks for responding.
Arun. I will check out your tutorial.
Ersin. Yes, i have the jboss-j2ee.jar in my ide's classpath. Do I need to configure anything else with JBoss?
21 years ago
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());
}
}
}
21 years ago