1 Reply Latest reply on Jun 11, 2007 12:58 AM by Mahtab Singh

    [b] Changes for session time out are not taking place.... Ur

    Sumit Malik Newbie

      Hi Everyone,

      I m running the sample's which are provided for Jboss EJB3Trail Demo application..

      I have these configuration

      Linux Fedora Core 4

      Jboss 4.0.4 CA

      Well, whenever i have deployed Session bean then try to get stub locally i get this exception after

      
      00:32:05,174 ERROR [[/test]] Session attribute event listener threw exception
      java.lang.RuntimeException: Could not resolve beanClass method from proxy call: public abstract void javax.ejb.EJBLocalObject.remove() throws javax.ejb.RemoveException,javax.ejb.EJBException
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:169)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy98.remove(Unknown Source)
       at net.java.dev.strutsejb.web.SessionRemover.attributeRemoved(SessionRemover.java:39)
       at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1623)
       at org.apache.catalina.session.StandardSession.expire(StandardSession.java:732)
       at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:572)
       at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
       at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
       at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
       at java.lang.Thread.run(Thread.java:595)
      
      



      Here my session bean is working fine and i think ejb session time out is not working in smooth way. I have googled this problem and find few solution but none of them helped me out yet like i have changed and increased session bean passivate time but no result

      <max-bean-life>300<max-bean-life> to <max-bean-life>300<max-bean-life>
      


      and even i have changed
      <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
      ...
       <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clus
      tered)">
       @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=3600
      )
       </annotation>
      ...
       </domain>
      [/code ]
      but not yet i have gain any result and problem is still there....
      So here i m just getting blocked
      
      
      
      Looking forward for the help !!!


        • 1. Re: [b] Changes for session time out are not taking place...
          Mahtab Singh Newbie

          Hi,

          I am also getting somewhat simillar error:

          the error stack is below:


          java.lang.RuntimeException: Could not resolve beanClass method from proxy call
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:199)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
          at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
          at org.jboss.remoting.Client.invoke(Client.java:525)
          at org.jboss.remoting.Client.invoke(Client.java:488)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
          at $Proxy0.updateCabin(Unknown Source)
          at com.titan.clients.Client_1.main(Client_1.java:51)


          below is my client code:

          public class Client_1
          {
          public static void main(String [] args)
          {
          try
          {
          Properties p = new Properties( );
          p.put(Context.INITIAL_CONTEXT_FACTORY,
          "org.jnp.interfaces.NamingContextFactory");
          p.put(Context.URL_PKG_PREFIXES,
          " org.jboss.naming:org.jnp.interfaces");
          p.put(Context.PROVIDER_URL, "jnp://localhost:1099");

          Context jndiContext = new InitialContext(p);
          Object ref = jndiContext.lookup("TravelAgentBean/remote");
          TravelAgentRemote dao = (TravelAgentRemote)ref;

          Cabin noCabin = dao.findCabin(1);
          System.out.println("no cabin should be null: " + noCabin);

          Cabin cabin_1 = new Cabin();
          cabin_1.setId(4);
          cabin_1.setName("Master Suite");
          cabin_1.setDeckLevel(3);
          cabin_1.setShipId(3);
          cabin_1.setBedCount(3);

          dao.createCabin(cabin_1);

          Cabin cabin_2 = dao.findCabin(4);
          System.out.println(cabin_2.getName());
          System.out.println(cabin_2.getDeckLevel());
          System.out.println(cabin_2.getShipId());
          System.out.println(cabin_2.getBedCount());

          System.out.println("Updating detached cabin instance with new bed count of 4");
          cabin_2.setBedCount(4); // this is where it fails
          dao.updateCabin(cabin_2);

          System.out.println("Finding cabin to see it has been updated with a merge() on server");
          Cabin cabin_3 = dao.findCabin(4);
          System.out.println("new bed count is: " + cabin_3.getBedCount());
          }
          catch (Exception ne)
          {
          ne.printStackTrace();
          }
          }


          }


          My Business Interface:

          @Remote
          public interface TravelAgentRemote
          {
          public void createCabin(Cabin cabin) throws java.rmi.RemoteException;
          public Cabin findCabin(int pKey) throws java.rmi.RemoteException;
          public void updateCabin(Cabin cabin) throws java.rmi.RemoteException;
          public void flushModeExample() throws java.rmi.RemoteException;
          }


          Bean Implementation:

          package com.titan.travelagent;

          import javax.ejb.Stateless;
          import javax.persistence.EntityManager;
          import javax.persistence.EntityManagerFactory;
          import javax.persistence.PersistenceContext;
          import javax.persistence.PersistenceUnit;
          import javax.persistence.FlushModeType;

          import com.titan.domain.Cabin;

          @Stateless
          public class TravelAgentBean implements TravelAgentRemote
          {
          @PersistenceUnit(unitName="Test") private EntityManagerFactory factory;
          @PersistenceContext(unitName="Test") private EntityManager manager;

          public void createCabin(Cabin cabin)
          {
          manager.persist(cabin);
          }

          public Cabin findCabin(int pKey)
          {
          return manager.find(Cabin.class, pKey);
          }

          public void updateCabin(Cabin cabin)
          {
          manager.merge(cabin);
          }

          public void flushModeExample()
          {
          EntityManager createdManager = factory.createEntityManager();

          try
          {
          Cabin newCabin2 = new Cabin();
          newCabin2.setId(2);
          newCabin2.setName("Another Cabin");
          newCabin2.setBedCount(1);
          createdManager.persist(newCabin2);

          Cabin cabin2 = manager.find(Cabin.class, 2);
          if (cabin2 != null)
          {
          throw new RuntimeException("newCabin2 should not be flushed yet");
          }

          Cabin cabin1 = (Cabin)createdManager.createQuery("FROM Cabin c WHERE c.id = 1").getSingleResult();

          cabin2 = manager.find(Cabin.class, 2);
          if (cabin2 == null)
          {
          throw new RuntimeException("newCabin2 should be flushed now");
          }

          createdManager.setFlushMode(FlushModeType.COMMIT);
          newCabin2.setBedCount(99);

          cabin1 = (Cabin)createdManager.createQuery("FROM Cabin c WHERE c.id = 1").getSingleResult();

          manager.refresh(cabin2);
          if (cabin2.getBedCount() == 99)
          {
          throw new RuntimeException("should not be 99 yet with COMMIT and a query");
          }

          createdManager.flush();

          manager.refresh(cabin2);
          if (cabin2.getBedCount() != 99)
          {
          throw new RuntimeException("should be 99 yet with a flush");
          }
          }
          finally
          {
          createdManager.close();
          }
          }
          }


          Entity Code

          package com.titan.domain;

          import javax.persistence.Entity;
          import javax.persistence.Table;
          import javax.persistence.Column;
          import javax.persistence.Id;

          @Entity
          @Table(name="CABIN")
          public class Cabin implements java.io.Serializable
          {
          private int id;
          private String name;
          private int deckLevel;
          private int shipId;
          private int bedCount;

          @Id
          @Column(name="CABIN_ID")
          public int getId()
          {
          return id;
          }
          public void setId(int pk)
          {
          id = pk;
          }

          @Column(name="CABIN_NAME")
          public String getName()
          {
          return name;
          }
          public void setName(String str)
          {
          name = str;
          }

          @Column(name="CABIN_DECK_LEVEL")
          public int getDeckLevel()
          {
          return deckLevel;
          }
          public void setDeckLevel(int level)
          {
          deckLevel = level;
          }

          @Column(name="CABIN_SHIP_ID")
          public int getShipId()
          {
          return shipId;
          }
          public void setShipId(int sid)
          {
          shipId = sid;
          }

          @Column(name="CABIN_BED_COUNT")
          public int getBedCount()
          {
          return bedCount;
          }
          public void setBedCount(int bed)
          {
          bedCount = bed;
          }
          }



          If somebody can help me out..would be a great help...

          Thanks