-
1. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
jonlee Aug 7, 2003 11:55 PM (in response to eliza)Unfortunately I don't think you are calling it correctly. I don't think you can just bundle the actual JAR into your JAR. You actually have to unpack the contents jnp-client.jar and then pack those contents into your own JAR, preserving the directory structures.
Also, normally you don't need all the JBoss client JARs. Some of these have the same classes in them, as the intention is to have different bundlings for different application purposes.
The usual client JAR for JBoss/EJB work purposes is jbossall-client.jar.
From the command line, you would need to do the following:
java -cp C:\jboss\client\jbossall-client.jar;clientapp.jar my.object.Main
You would substitute my.object.Main with the fully qualified name for the class that has your main() method in it.
That should work - your code looks ok.
Hope it helps. -
2. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
eliza Aug 8, 2003 5:31 AM (in response to eliza)Thank you! The command works. Then I also unjarred jbossall-client.jar before including it into my jar file. Thanks!
-
3. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
demiante Sep 19, 2003 9:25 AM (in response to eliza)Hi people, I'm trying to execute a java standalone client to access a session bean. My code compiles normally
(javac -classpath /usr/bin/jboss-3.2.2RC2/client/jbossall-client.jar:hellobean.jar hello/client/HelloBeanClient.java)
but when i execute it, it shows the following Exception.
$java -classpath /usr/bin/jboss-3.2.2RC2/client/jbossall-client.jar:hellobean.jar hello/client/HelloBeanClient
java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory
at java.lang.Class.forName (Class.java)
at java.lang.Class.forName (Class.java:44)
at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:86)
at javax.naming.InitialContext.getDefaultInitCtx (InitialContext.java:183)
at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.java:218)
at javax.naming.InitialContext.lookup (InitialContext.java:238)
at hello.client.HelloBeanClient.main (HelloBeanClient.java:14)
My class HelloBeanClient:
package hello.client;
import javax.rmi.*;
import javax.naming.*;
import javax.ejb.*;
import hello.*;
public class HelloBeanClient {
public static void main(String[] args) throws Exception {
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "jnp://sartre:1099");
System.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/HelloBean");
HelloBeanHome home = (HelloBeanHome) PortableRemoteObject.narrow(ref, HelloBeanHome.class);
HelloBean hello = home.create();
System.out.println(hello.sayHello());
}
}
S.O: Debian GNU/Linux
JbossDist: jboss-3.2.2RC2 -
4. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
jonlee Sep 20, 2003 10:39 AM (in response to eliza)Your java.naming.factory.url.pkgs should usually be "org.jboss.naming:org.jnp.interfaces". That is most likely the issue.
Otherwise, check that jbossall-client.jar does contain the specified class. It should be there. -
5. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
demiante Oct 10, 2003 2:57 PM (in response to eliza)As you can see in my previous message I did it! I put the jar jbossall-client.jar in my classpath but now this work only when i put the classpath in the command line . I still dont know why it not find the org.jnp.interfaces.NamingContextFactory in jbossall-client.jar. The class is there! I've tried other jars too, but again... the same error.
In this meanwhile i'm setting the classpath in the java command line. -
6. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
demiante Oct 10, 2003 3:02 PM (in response to eliza)By the way, i'm setting my classpath in the file /etc/bash.bashrc like this:
CLASSPATH=/usr/local/java/lib/tools.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/javax.servlet.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/jboss-j2ee.jar:/usr/local/jboss-3.2RC2/client/jbossall-client.jar:.
export CLASSPATH
thanxs! -
7. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
darranl Oct 13, 2003 8:12 AM (in response to eliza)Have you checked that the classpath is definately being exported and is available in the shell that you are using to execute the client?
-
8. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
demiante Oct 14, 2003 6:08 AM (in response to eliza)Yes. I'm wondering if this is a jvm problem or a jar problem.
Whatever... it's weird. -
9. Re: java.lang.ClassNotFoundException: org.jnp.interfaces.Nam
darranl Oct 14, 2003 6:37 AM (in response to eliza)Did you copy the following from the bash.bashrc file to post on here?
CLASSPATH=/usr/local/java/lib/tools.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/javax.servlet.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/jboss-j2ee.jar:/usr/local/jboss-3.2RC2/client/jbossall-client.jar:.
export CLASSPATH
If you did you might have a .2 missing
CLASSPATH=/usr/local/java/lib/tools.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/javax.servlet.jar:/usr/local/jboss-3.2.2RC2/server/default/lib/jboss-j2ee.jar:/usr/local/jboss-3.2.2RC2/client/jbossall-client.jar:.
export CLASSPATH