aspose file tools*
The moose likes JBoss/WildFly and the fly likes Please help me to run a client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Please help me to run a client " Watch "Please help me to run a client " New topic
Author

Please help me to run a client

Jasmine kaur
Ranch Hand

Joined: Nov 25, 2003
Posts: 160
Hello Everybody ,
Iam facing this problem to run a client with JBoss4.0 , this is my client code and In the classpath I have put the following jar files :
a)jboss-client.jar
b)jnp-client.jar
c)jbosssx-client.jar
d)jndi.properties
if any other file is requierd please tell me or something is wrong in the classpath or in code so please do tell me.

import java.util.*;
import javax.rmi.*;
import javax.ejb.*;
import javax.naming.*;

public class MathClient
{
public static void main(String h[])
{
try{
System.out.println("Iam in the client");
Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL,"jnp://127.0.0.1:1099");
Context context=new InitialContext(prop);
Object object=context.lookup("abhi");
MathHome home=(MathHome)PortableRemoteObject.narrow(object,MathHome.class);
MathRemote remote=home.create();
System.out.println("My addition value is:"+remote.add(20,20));
}
catch(NamingException e){
e.printStackTrace();
}
catch(Exception f){
System.out.println(f.getMessage());
}
}
}


This exception is comming after running the program .

D:\ABHI\EJB\SESSION>java MathClient
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o
rg.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
52)
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 MathClient.main(MathClient.java:16)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFac
tory
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.jav
a:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
49)
... 4 more



Thanks in advance.


jasmine kaur
Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
Add jbossall-client.jar to your classpath. This is only API you need to include to run your client.
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 293

If you use jbossall-client.jar instead of all the other jars, you should have everything you need.
Jasmine kaur
Ranch Hand

Joined: Nov 25, 2003
Posts: 160
Hi ,
Thanks a lot for helping me , client is running .
Thanks a tonnne.
Thanks once again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me to run a client