Community

Please help me to solve the problem

created by Govardhan Reddy in EJB 3.0 - View the full discussion

!)

package

 

com.ejb3.account;

 

import

 

javax.ejb.Stateless;

 

@Stateless

(name="AccountBean",mappedName="AccountBean")

public

 

class AccountBean implements AccountRemote{

public

 

void deposit(int accno,double amt)

{

System.

out.println("Ok Deposited");

}

public

 

double getBal(int accno)

{

 

return 9999;

}

}

 

 

2)

package

com.ejb3.account;

 

 

 

 

import

 

javax.ejb.Remote;

 

@Remote

public

interface AccountRemote {

 

 

public double getBal(int accno);

 

 

public void deposit(int accno,double amt);

}

 

3)package com.ejb3.account;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

public class AccountEjb3Jboss422Client {

/**
  * @param args
  */
public static void main(String[] args) {
  try{
   Properties p=new Properties();
   p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
   p.setProperty("java.naming.provider.url","localhost:1099");
   p.setProperty("java.naming.factory.url.pkgs","org.jboss.naming");
  
   Context ctx=new InitialContext(p);
     
   System.out.println("Initial Context created");

   Object o=ctx.lookup("AccountBean/remote");
   System.out.println("lookup successful");
   AccountRemote ar=(AccountRemote)o;
   System.out.println("Calling EJB method . . .");
   ar.deposit(88,10000);
   double bal=ar.getBal(88);
   System.out.println("Bal is: "+bal);
   System.out.println("Output will be in Managed server console");
  
  }catch (Exception e) {
   e.printStackTrace();
  }
}
}

error

Initial Context created

javax.naming.CommunicationException

 

NamingContext.java:722)

at org.jnp.interfaces.NamingContext.lookup(

NamingContext.java:587)

at javax.naming.InitialContext.lookup(Unknown Source)

at com.ejb3.account.AccountEjb3Jboss422Client.main(

AccountEjb3Jboss422Client.java:24)

Caused by:

java.io.InvalidClassException: org.jboss.remoting.InvokerLocator; local class incompatible: stream classdesc serialVersionUID = -4977622166779282521, local class serialVersionUID = -2909329895029296248

at java.io.ObjectStreamClass.initNonProxy(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.defaultReadFields(Unknown Source)

at java.io.ObjectInputStream.readSerialData(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.defaultReadFields(Unknown Source)

at java.io.ObjectInputStream.readSerialData(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at java.rmi.MarshalledObject.get(Unknown Source)

at org.jnp.interfaces.MarshalledValuePair.get(

MarshalledValuePair.java:72)

at org.jnp.interfaces.NamingContext.lookup(

NamingContext.java:652)

... 3 more

 

please help me

[Root exception is java.io.InvalidClassException: org.jboss.remoting.InvokerLocator; local class incompatible: stream classdesc serialVersionUID = -4977622166779282521, local class serialVersionUID = -2909329895029296248]

at org.jnp.interfaces.NamingContext.lookup(

Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community