javax.naming.CommunicationException
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   niraj_pathak
Posted On:   Friday, January 30, 2004 05:49 AM

following is my client source: import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import java.util.Properties; import org.jnp.interfaces.NamingContextFactory; public class Client { public static void main(String[] args) { try { Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); properties.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099"); properties.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); properties.p   More>>

following is my client source:

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import org.jnp.interfaces.NamingContextFactory;

public class Client
{

public static void main(String[] args)
{
try
{
Properties properties = new Properties();

properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
properties.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
properties.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url", "127.0.0.1:1099");


System.out.println("Line: 1");
Context initial = new InitialContext(properties);
System.out.println("Line: 2");
Object objref = initial.lookup("Convert");
System.out.println("Line: 3");

ConvertHome home =
(ConvertHome)PortableRemoteObject.narrow(objref,
ConvertHome.class);
System.out.println("Line: 4");

ConvertRem currencyConverter = home.create();
System.out.println("Line: 5");

double amount = currencyConverter.conversion(10.50);
System.out.println("Line: 6");
System.out.println(String.valueOf(amount));
System.out.println("Line: 7");
}
catch (Exception ex)
{
System.err.println("Exception "+ex);
}
}
}


FOLLOWING ERROR IS FOUND WHILE RUNNING THE ABOVE PROG :

Exception javax.naming.CommunicationException [Root exception is c; local class incompati
ble: stream classdesc serialVersionUID = 3844706474734439975, local class serial
VersionUID = 4582256576523491346]


PLEASE HELP ME OUT : I AM RUNNING THE CLIENT AND SERVER ON LOCAL HOST. AT LOOKUP STATEMENT IN ABOVE SOURCE I GOT THE EXCEPTION. HELP ME OUT !!!

   <<Less
About | Sitemap | Contact