2 Replies Latest reply on Nov 27, 2007 12:59 PM by jinesh parikh

    Regrading

    jinesh parikh Newbie

      Hello ,

      I am using JBoss [Zion] 4.0.3RC1.Here is the code of my session bean

      Home Interface
      ------------------
      import java.rmi.RemoteException;
      import javax.ejb.CreateException;
      import javax.ejb.EJBHome;

      public interface AdviceHome extends EJBHome{
      public AdviceComponent create() throws RemoteException,CreateException;
      }

      Component Interface
      -------------------------
      package com.fritolay;

      import java.rmi.RemoteException;
      import javax.ejb.EJBObject;

      public interface AdviceComponent extends EJBObject{
      public String getAdvice() throws RemoteException;
      }

      Bean class
      --------------
      package com.fritolay;

      import java.rmi.RemoteException;

      import javax.ejb.EJBException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;


      public class AdviceImpl implements SessionBean{

      public void ejbActivate() throws EJBException, RemoteException {
      // TODO Auto-generated method stub

      }

      public void ejbPassivate() throws EJBException, RemoteException {
      // TODO Auto-generated method stub

      }

      public void ejbRemove() throws EJBException, RemoteException {
      // TODO Auto-generated method stub

      }

      public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
      // TODO Auto-generated method stub

      }

      public void ejbCreate(){
      System.out.println("ejbcreate method called...");
      }
      public String getAdvice(){
      return "No Advice Temporirly";

      }
      }



      Client code
      ----------------
      package com.fritolay;

      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;

      public class AdviceClient {


      public static void main(String[] args) {
      InitialContext context = null;
      try {

      java.util.Hashtable JNDIParm = new java.util.Hashtable();
      JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      JNDIParm.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
      JNDIParm.put(Context.PROVIDER_URL, "localhost:1099" );
      context = new InitialContext(JNDIParm);

      if(context==null){
      System.out.println("Context is Null");
      }
      else
      {
      System.out.println("Context is Not Null");
      }
      Object o=context.lookup("kamini");
      AdviceHome hec=(AdviceHome)PortableRemoteObject.narrow(context.lookup("kamini"),AdviceHome.class);
      }
      catch(Exception e){
      e.printStackTrace();
      }

      }

      }

      Here is my ejb-jar.xml
      ejb-jar.xml
      --------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
      JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>Advice</ejb-name>
      com.fritolay.AdviceHome
      com.fritolay.AdviceComponent
      <ejb-class>com.fritolay.AdviceImpl</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>
      </ejb-jar>

      jboss.xml
      ------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">



      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jboss-beans.xml that contains
      the , and <message-driven></message-driven>
      markup for those beans.
      -->


      <ejb-name>Advice</ejb-name>
      <jndi-name>kamini</jndi-name>





      <!--
      write a merge file jboss-webservices.ent for webservice-description
      -->

      </enterprise-beans>

      <resource-managers>
      </resource-managers>

      <!--
      | for container settings, you can merge in jboss-container.xml
      | this can contain <invoker-proxy-bindings/> and <container-configurations/>
      -->



      i am using the jdk1.5.0_06 .

      when i am deploying the EJBJar (advice.jar) file of the above ejb in above ejb it is deployed properly without any errors.But when i am running the client i am getting following error

      javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.util.id.GUID; local class incompatible: stream classdesc serialVersionUID = 3289509836244263718, local class serialVersionUID = 6926421946503004889]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:663)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at com.fritolay.AdviceClient.main(AdviceClient.java:27)
      Caused by: java.io.InvalidClassException: org.jboss.util.id.GUID; local class incompatible: stream classdesc serialVersionUID = 3289509836244263718, local class serialVersionUID = 6926421946503004889
      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.readObject(Unknown Source)
      at org.jboss.invocation.InvokerInterceptor.readExternal(InvokerInterceptor.java:190)
      at java.io.ObjectInputStream.readExternalData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      at java.io.ObjectInputStream.readExternalData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      at java.io.ObjectInputStream.readExternalData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      at java.io.ObjectInputStream.readExternalData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:147)
      at java.io.ObjectInputStream.readExternalData(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:51)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:566)
      ... 3 more


      can anybody help me in solving the above error please it is urgent.Please help me....