2 Replies Latest reply on May 19, 2010 3:35 AM by sgreddy.vardhan

    Please help me to solve the problem

      !)

      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(

        • 1. Re: Please help me to solve the problem
          cullendw

          make sure that your client libraries are compatible with the server libraries you are connecting to. Different versions of the same class would result in the id mismatch (if the id was updated which seems to be the case here).

          • 2. Re: Please help me to solve the problem

            Hi Daniel Cullender,

             

            Excellent, i tried for this 2 days, but i am unable to find the solution.I got solution, now the program is working properly. Previously i run the application on jboss-4.0.5.GA., now i am running the application in jboss-4.2.2.GA, but i aded jboss-4.0.5.GA client jars, so that it is giving version id problem. Now i added jboss-4.2.2.GA jars and it is working properly. Any how once again heartfully i am saying thanks to you.