Losing UserTransaction state in Stateful session bean

I have a UserTransaction I wish to begin and commit in different methods of a Stateful session bean. I have 2 methods to test this on the session bean:
public void beginTransaction()
trans = context.getUserTransaction() ;
trans.begin() ;
public void commitTransaction()
trans = context.getUserTransaction() ;
trans.commit() ;
If I call these methods from one Perform method in a Struts action all works fine. If I call the methods in different Struts actions (storing the session bean handle on the HTTPSession in the first for retrieval in the second) the second call fails with the following exception:
java.lang.IllegalStateException: No active Transaction
The state of the transaction on the second call is STATUS_NO_TRANSACTION. I am certain that I have lost no state on the session bean and that using handles gives me the correct bean since I have written some state to test this. Basically something seems to close the transaction between the end of the first Perform method and the beginning of the second (I am of course assuming this is a valid thing to do).
My session bean descriptor has <transaction-type>Bean</transaction-type>, and I am using OC4J.
If anyone can point out what it is I am doing wrong I would be grateful!
James.

Sorry, I have re-checked my code and I believe I found the problem.
I was beginning my transaction inside ejbCreate() and trying to commit/rollback in another method. This works in JBoss 3.2 but does not work in either OC4J or WebLogic 7.
If I begin my transaction in a business method and commit/rollback in another method, everything works fine. (It also seems to work fine in 9.0.3 this way).
So I am not sure whether this is a bug in 9iAS/WLS, or a bug in JBoss, or something that is left "vague" in the J2EE spec. Unfortunately, examples on bean-managed transactions are thin on the ground generally (the usual advice being not to use them, which I definitely agree with!).
If you believe that the behaviour I describe is a bug in 9iAS, I can send a simple EJB test case.
Keith

Similar Messages

  • Stateful Session Bean with BMT: JDBCpmf or EEpmf?

    Quote:
    For the record: when using BMT as David described, you should use a JDBCPersistenceManagerFactory
    instead of an EEPersistenceManagerFactory. EEPersistenceManagerFactory is only appropriate when
    transaction synchronization is desired.
    -Patrick
    Hi Patrick,
    I wanted to follow up on this. In the case of Kodo, the JDBCpmf does not turn on the
    UserTransaction in a managed environment, while the EEpmf does. My question: isn't is necessary to
    turn on the UserTransaction in a stateful session bean with BMT? If this doesn't happen, isn't
    there a danger, if the bean allows transactions to span business method invocations, that the
    container will passivate the bean while a transaction is active? Since the PM can't be saved during
    passivation, the tx would be interrupted by passivation -- something that would not happen if the
    container were aware that a tx was active.
    David Ezzio

    David,
    My interpretation of your initial post was that you were using fully
    unmanaged transactions in your bean. That is, that you were not using the
    UserTransaction, but were just using the javax.jdo.Transaction for
    transactional data store access.
    In the situation I just described, using the EEPMF would result in changes
    to the UserTransaction. If your goal was to manage the UserTransaction in
    the bean, then yes, you'd still want to use the EEPMF.
    -Patrick
    On 7/25/02 7:17 PM, "David Ezzio" <[email protected]> wrote:
    Quote:
    For the record: when using BMT as David described, you should use a
    JDBCPersistenceManagerFactory
    instead of an EEPersistenceManagerFactory. EEPersistenceManagerFactory is only
    appropriate when
    transaction synchronization is desired.
    -Patrick
    Hi Patrick,
    I wanted to follow up on this. In the case of Kodo, the JDBCpmf does not turn
    on the
    UserTransaction in a managed environment, while the EEpmf does. My question:
    isn't is necessary to
    turn on the UserTransaction in a stateful session bean with BMT? If this
    doesn't happen, isn't
    there a danger, if the bean allows transactions to span business method
    invocations, that the
    container will passivate the bean while a transaction is active? Since the PM
    can't be saved during
    passivation, the tx would be interrupted by passivation -- something that
    would not happen if the
    container were aware that a tx was active.
    David Ezzio--
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Local Stateful Session Bean State Failover Cluster

              Hi,
              How are you doing? I have poured through the previous postings and still am unclear
              on the following: If we have a stateful session bean that is local is the state
              replicated in a cluster if we are using in-memory replication?
              What controls when the state is replicated? Transactions?
              What happens if the methods are not transacted? Is the state replication at the
              method level?
              Thank you so much,
              -Bart Simpson
              

    Hi Bart,
              I'm a bit unclear on it too. It's been asked before, but no definite answer
              has been provided.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "Bart Simpson" <[email protected]> wrote in message
              news:[email protected]..
              >
              > Hi,
              >
              > How are you doing? I have poured through the previous postings and still
              am unclear
              > on the following: If we have a stateful session bean that is local is the
              state
              > replicated in a cluster if we are using in-memory replication?
              >
              > What controls when the state is replicated? Transactions?
              >
              > What happens if the methods are not transacted? Is the state replication
              at the
              > method level?
              >
              > Thank you so much,
              > -Bart Simpson
              

  • HttpSession vs. Stateful Session Bean ---- when State Session is large

    I hope most of the people come across with this issue where to put the state
    for the internet/intranet based applications when they are using
    servlet/jsps calling session beans. Weblogic 4.5.1 does support httpsession
    in-memory replication for the servlets but the stateful session beans are
    not replicated in clustered environment. Plus with stateful bean u get
    activation/passivation overhead too. So one tempts to use stateless session
    beans and store state in httpsession?
    Then what is the upper limit for the session state one can put in
    HttpSession with the weblogic? Is there any way to configure it?
    One way to overcome the httpsession size limitation is to use database for
    storing state and just store some unique Ids for the session info in
    httpSession. But then there will be overhead for database connection?(jdbc
    connection pool can provide some help here). So what is the recommended way
    for doing this provided few thousand concurrent clients with session size
    say exceeding 4kb per client?
    Thanks
    Usmani

    There are no special setting in sun-ejb-jar.xml regarding cache settings. The default settings from server.xml are used:
        <jdbc-connection-pool steady-pool-size="8" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="2" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="false" is-connection-validation-required="false" connection-validation-method="auto-commit" fail-all-connections="false" datasource-classname="oracle.jdbc.pool.OracleDataSource" name="ebs">
          <property value="jdbc:oracle:thin:@myebsdbsserver:1521:ebsdevdb" name="url"/>
          <property value="ebs" name="user"/>
          <property value="ebs" name="password"/>
        </jdbc-connection-pool>
      <ejb-container steady-pool-size="32" pool-resize-quantity="16" max-pool-size="64" cache-resize-quantity="32" max-cache-size="512" pool-idle-timeout-in-seconds="600" cache-idle-timeout-in-seconds="600" removal-timeout-in-seconds="5400" victim-selection-policy="nru" commit-option="B" monitoring-enabled="true">
         </ejb-container>The Session Bean uses Container Managed Transaction. Is it possible in this case, that the bean isn't 'idle enough' in order to set into passivated?

  • Accessing the same stateful session bean from multiple clients in a clustered environment

    I am trying to access the same stateful session bean from multiple
              clients. I also want this bean to have failover support so we want to
              deploy it in a cluster. The following description is how we have tried
              to solve this problem, but it does not seem to be working. Any
              insight would be greatly appreciated!
              I have set up a cluster of three servers. I deployed a stateful
              session bean with in memory replication across the cluster. A client
              obtains a reference to an instance of one of these beans to handle a
              request. Subsequent requests will have to use the same bean and could
              come from various clients. So after using the bean the first client
              stores the handle to the bean (actually the replica aware stub) to be
              used by other clients to be able to obtain the bean. When another
              client retrieves the handle gets the replica aware stub and makes a
              call to the bean the request seems to unpredictably go to any of the
              three servers rather than the primary server hosting that bean. If the
              call goes to the primary server everything seems to work fine the
              session data is available and it gets backed up on the secondary
              server. If it happens to go to the secondary server a bean that has
              the correct session data services the request but gives the error
              <Failed to update the secondary copy of a stateful session bean from
              home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              to the primary server will not reflect changes made on the secondary
              and vice versa. If the request happens to go to the third server that
              is not hosting an instance of that bean then the client receives an
              error that the bean was not available. From my understanding I thought
              the replica aware stub would know which server is the primary host for
              that bean and send the request there.
              Thanks in advance,
              Justin
              

              If 'allow-concurrent-call' does exactly what you need, then you don't have a problem,
              do you?
              Except of course if you switch ejb containers. Oh well.
              Mike
              "FBenvadi" <[email protected]> wrote:
              >I've got the same problem.
              >I understand from you that concurrent access to a stateful session bean
              >is
              >not allowed but there is a
              >token is weblogic-ejb-jar.xml that is called 'allow-concurrent-call'
              >that
              >does exactly what I need.
              >What you mean 'you'll get a surprise when you go to production' ?
              >I need to understand becouse I can still change the design.
              >Thanks Francesco
              >[email protected]
              >
              >"Mike Reiche" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Get the fix immediately from BEA and test it. It would be a shame to
              >wait
              >until
              >> December only to get a fix - that doesn't work.
              >>
              >> As for stateful session bean use - just remember that concurrent access
              >to
              >a stateful
              >> session bean is not allowed. Things will work fine until you go to
              >production
              >> and encounter some real load - then you will get a surprise.
              >>
              >> Mike
              >>
              >> [email protected] (Justin Meyer) wrote:
              >> >I just heard back from WebLogic Tech Support and they have confirmed
              >> >that this is a bug. Here is their reply:
              >> >
              >> >There is some problem in failover of stateful session beans when its
              >> >run from a java client.However, it is fixed now.
              >> >
              >> >The fix will be in SP2 which will be out by december.
              >> >
              >> >
              >> >Mike,
              >> >Thanks for your reply. I do infact believe we are correctly using
              >a
              >> >stateful session bean however it may have been misleading from my
              >> >description of the problem. We are not accessing the bean
              >> >concurrently from 2 different clients. The second client will only
              >> >come into play if the first client fails. In this case we want to
              >be
              >> >able to reacquire the handle to our stateful session bean and call
              >it
              >> >from the secondary client.
              >> >
              >> >
              >> >Justin
              >> >
              >> >"Mike Reiche" <[email protected]> wrote in message
              >news:<[email protected]>...
              >> >> You should be using an entity bean, not a stateful session bean
              >for
              >> >this application.
              >> >>
              >> >> A stateful session bean is intended to be keep state (stateful)
              >for
              >> >the duration
              >> >> of a client's session (session).
              >> >>
              >> >> It is not meant to be shared by different clients - in fact, if
              >you
              >> >attempt to
              >> >> access the same stateful session bean concurrently - it will throw
              >> >an exception.
              >> >>
              >> >> We did your little trick (storing/retrieving handle) with a stateful
              >> >session bean
              >> >> on WLS 5.1 - and it did work properly - not as you describe. Our
              >sfsb's
              >> >were not
              >> >> replicated as yours are.
              >> >>
              >> >> Mike
              >> >>
              >> >> [email protected] (Justin Meyer) wrote:
              >> >> >I am trying to access the same stateful session bean from multiple
              >> >> >clients. I also want this bean to have failover support so we want
              >> >to
              >> >> >deploy it in a cluster. The following description is how we have
              >tried
              >> >> >to solve this problem, but it does not seem to be working. Any
              >> >> >insight would be greatly appreciated!
              >> >> >
              >> >> >I have set up a cluster of three servers. I deployed a stateful
              >> >> >session bean with in memory replication across the cluster. A client
              >> >> >obtains a reference to an instance of one of these beans to handle
              >> >a
              >> >> >request. Subsequent requests will have to use the same bean and
              >could
              >> >> >come from various clients. So after using the bean the first client
              >> >> >stores the handle to the bean (actually the replica aware stub)
              >to
              >> >be
              >> >> >used by other clients to be able to obtain the bean. When another
              >> >> >client retrieves the handle gets the replica aware stub and makes
              >> >a
              >> >> >call to the bean the request seems to unpredictably go to any of
              >the
              >> >> >three servers rather than the primary server hosting that bean.
              >If
              >> >the
              >> >> >call goes to the primary server everything seems to work fine the
              >> >> >session data is available and it gets backed up on the secondary
              >> >> >server. If it happens to go to the secondary server a bean that
              >has
              >> >> >the correct session data services the request but gives the error
              >> >> ><Failed to update the secondary copy of a stateful session bean
              >from
              >> >> >home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              >> >> >to the primary server will not reflect changes made on the secondary
              >> >> >and vice versa. If the request happens to go to the third server
              >that
              >> >> >is not hosting an instance of that bean then the client receives
              >an
              >> >> >error that the bean was not available. From my understanding I
              >thought
              >> >> >the replica aware stub would know which server is the primary host
              >> >for
              >> >> >that bean and send the request there.
              >> >> >
              >> >> >Thanks in advance,
              >> >> >Justin
              >>
              >
              >
              

  • Can I use UserTransaction within a CMP Session bean?

    Basically the problem is as follow:
    I have the following method in a Statefull session bean:
    public Whatever do()
    processSomething();
    notify();
    the notify() basically notifying the client that then query for the something that was processed in the processSomething() method.
    THE PROBLEM is that the changes have not been committed yet as the do() method is not finished yet and the container has not committed the changes.
    THE QUESTION is - can I use UserTransaction inside
    processSomething to commit the changes and leave the bean as CMP? I want to leave it as CMP as there are more methods on the bean and I don't want to have to manage the transactions for them.
    Anyone has any other ideas?
    Thanks in advanced.

    Hi again,
    The EJB specs say that a stateful Session Bean with CMT is NOT allowed to use the UserTransaction; see page 361 of the EJB2.0 specification. So combining them will not (or should not) work.
    I suggest CMT+SessionSynchronization combined with using a flag to indicate whether notify should be called or not. Otherwise, you could try splitting up the bean into two beans: one with CMT and another one without. The one without CMT could use the UserTransaction and notify.
    Also, you might want to check http://www.onjava.com/pub/a/onjava/2001/10/02/ejb.html
    Hope that helps a bit,
    Guy
    http://www.atomikos.com

  • How create  EJB 2.1 Stateful Session Bean in a EJB 3.0 Session Bean

    Hi All,
    We have been developing on EJB 2.1. We are now adding a module on EJB 3.0.
    How can we "create" a stateful session bean with create method signature similar to create(String id)?
    We have tried
    // this is the remote interface
    @EJB AddressBean abean;
    But not working
    Any help will be appreciated.

    There is no explicit create() call for EJB 3.0 session beans. It doesn't really matter though
    since you can accomplish the same thing by defining your own business method to act
    as an initializer for whatever state you'd like. E.g.
    @Remote
    public interface FooInterface {
    public void initialize(String id);
    // ... other business methods
    @EJB FooInterface fooRef;
    fooRef.initialize("foo");
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Deploy Error when using Stateful Session Bean inside Webdynpro

    Hi,
    I'm trying to create a webdynpro project that uses a stateful session bean
    I have created DC's for a EJB Module project, Enterprise Application and Webdynpro component. Created the bean, built it, added it's package to the public part, added the EJB Module to the EAR project. Built the EAR project. Added the EJB Module project and Enterprise Application project as a used DC in the Webdynpro DC.
    In the Webdynpro DC I added com.sap.archive-packaging.default.update-descriptors=true in the build.properties file of the cfg directory. (using the navigator view) That resolved an error while building it.
    Deployed the Enterprise Application DC without problems.
    Tried to deploy the Webdynpro DC but I get the following error:
    Jun 16, 2008 9:40:46 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] WARNING:
    [012]Deployment finished with warning
    Settings
    SDM host : 10.64.36.74
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME~1/JESCHA~1/LOCALS~1/Temp/temp59822company.nl~projempactcmp.ear
    Result
    => deployed with warning : file:/C:/DOCUME~1/JESCHA~1/LOCALS~1/Temp/temp59822company.nl~projempactcmp.ear
    Finished with warnings: development component 'projempactcmp'/'company.nl'/'local'/'20080616094022':Caught exception during application startup from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Error occurred while starting application company.nl/projempactcmp and wait. Reason: Clusterwide execption: server ID 6060950:<--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='Failed implicit start for company.nl/projempejb : Unknown state(5)', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Failed implicit start for company.nl/projempejb : Unknown state(5) (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : Got problems during deployment
    Does anyone know what this error means and how to resolve it. I searched the forum but only found errors that look like this relating to XI not to Webdynpro.......
    Thansk,
    Jeschael
    Edited by: J.V. Lebbink on Jun 17, 2008 6:52 AM

    Default is 30mts.
    This is done as a parameter in orion-ejb-jar.xml. Please look at the EJB Guide at http://otn.oracle.com/docs/products/ias/doc_library/903doc_otn/generic.903/a97677/dtdxml.htm#634197 for details
    regards
    Debu

  • Stateful Session Beans are not passivated / serialized when cache idle time

    Technology: Sun Application Server version 7.0.0_01; JDK 1.4.1; developed on Windows 2000; Tested on Sun Solaris.
    Initial error on Sun Solaris:
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr: Exception in thread "service-j2ee-25" org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 1015 completed: No
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.preinvoke(GenericPOAServerSC.java:389)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.ServantCachePOAClientSC.initServant(ServantCachePOAClientSC.java:112)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.ServantCachePOAClientSC.setOrb(ServantCachePOAClientSC.java:95)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.createDelegate(CDRInputStream_1_0.java:760)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.internalIORToObject(CDRInputStream_1_0.java:750)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:669)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:890)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:884)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream.read_abstract_interface(CDRInputStream.java:307)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:228)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:381)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:318)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.enterprise.iiop.IIOPHandleDelegate.getStub(IIOPHandleDelegate.java:58)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.enterprise.iiop.IIOPHandleDelegate.readEJBObject(IIOPHandleDelegate.java:38)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.ejb.portable.HandleImpl.readObject(HandleImpl.java:91)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObject(Native Method)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1298)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStream.java:908)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:261)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:247)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:209)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:981)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:287)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.copyObject(Util.java:598)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.rmi.CORBA.Util.copyObject(Util.java:314)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.ejb._NodeMaint_Stub.getHandle(Unknown Source)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.arch.NMAViewBeanProxy.checkBeans(NMAViewBeanProxy.java:631)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.view.html.NMAStandardButton.handleRequest(NMAStandardButton.java:143)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.arch.NMAViewBeanBase.handleRequest(NMAViewBeanBase.java:1573)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.dispatchInvocation(ViewBeanBase.java:824)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal(ViewBeanBase.java:637)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler(ViewBeanBase.java:595)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.dispatchRequest(ApplicationServletBase.java:772)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:446)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.view.ViewServlet.doPost(ViewServlet.java:243)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at java.security.AccessController.doPrivileged(Native Method)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    The above error caused the server to use all available memory and required a reboot to proceed.
    Subsequent testing against the Sun Appliucation Server 7 on Windows 2000 dev environment using the Sun Studio IDE for debugging and trace statements inserted in the code indicate that the Application Server is removing the Stateful Session Beans when they time out without an ejbPassivate event and without serializing the beans to the data-store. cache-idle-timeout-in-seconds set to 180 and removal-timeout-in-seconds set to 1800.
    The server.log indicates that the beans are timing out:
    [19/Aug/2004:18:15:10] WARNING ( 1664): [NRU-com.telstra.nodeman.ejb.AddressMaintBean]: IdleBeanCleanerTask finished after removing 2 idle beans
    Trace statements inserted in ejbPassivate do not appear in the log.
    It is my understanding that the above timeout should have caused an ejbPasssivate and serialization of the beans.
    The beans have been validated using Sun Java Studio Enterprise 6 with 'EJB validate'.
    My reading of the problem is that the beans are not being serialized and the error occurs when the application attempts to reference (getHandle) the bean after timeout.
    Any suggestions would be appreciated.

    Thanks Thorick.
    I am using NRU caching. WL 7.0 SP2.
    I have not defined idle-timeout-seconds in my weblogic-ejb-jar.xml. As I understand
    the default value for this is 600secs. So the ejbs should be removed after this
    time. Below is the
    weblogic-ejb-jar.xml that I am using.
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <!-- Generated XML! -->
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>Cart</ejb-name>
    <stateful-session-descriptor>
    <stateful-session-clustering>
    <home-is-clusterable>true</home-is-clusterable>
    <replication-type>InMemory</replication-type>
    </stateful-session-clustering>
    </stateful-session-descriptor>
    <transaction-descriptor>
         <trans-timeout-seconds>
              60
         </trans-timeout-seconds>
    </transaction-descriptor>
    <jndi-name>CartHome</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    "thorick" <[email protected]> wrote:
    >
    The idle-timeout-seconds property controls the timeout/removal behavior.
    which stateful session cache type are you using ? LRUCache or NRUCache

  • Passivation of Connection Object in Stateful Session Bean

    Hi all,
    I am developing a Stateful session bean that has a Connection object as its instance variable. And this bean starts transaction that spans across multiple method calls and finally either commit or rollback.
    BeanClass
    UserTransaction utx;
    Connection conn;
    ejbCreate()
    allocateconnection();
    ejbRemove()
    closeconnection();
    ejbActivate()
    allocateconnection();
    ejbpassivate()
    closeconnection();
    StartTransaction()
    utx = getusertransaction();
    utx.begin();
    Method1()
    do something with database
    Method2()
    do something with database
    CommitTransaction()
    utx.commit();
    For example, the typical usage of this bean would be:
    bean.StartTransaction();
    bean.Method1();
    bean.Method2();
    bean.CommitTransaction();
    Here are my two questions:
    1. General Question: In order for a Connection object to join a Transaction, Do I have to create the connection after the transaction has started?
    2. If the answer to the above question is yes, then: I understand that when this bean get passivated, the UserTransaction instance object would be passivated. And since the connection object can't not be passivated, I have to recreate the connection object in ejbactivate() method, would newly created connection participate in the same Transaction that was being passivated and now activated?

    >
    Hi all,
    I am developing a Stateful session bean that has a
    Connection object as its instance variable. And this
    bean starts transaction that spans across multiple
    method calls and finally either commit or rollback.
    BeanClass
    UserTransaction utx;
    Connection conn;
    ejbCreate()
    allocateconnection();
    ejbRemove()
    closeconnection();
    ejbActivate()
    allocateconnection();
    ejbpassivate()
    closeconnection();
    StartTransaction()
    utx = getusertransaction();
    utx.begin();
    Method1()
    do something with database
    Method2()
    do something with database
    CommitTransaction()
    utx.commit();
    For example, the typical usage of this bean would be:
    bean.StartTransaction();
    bean.Method1();
    bean.Method2();
    bean.CommitTransaction();
    Here are my two questions:
    1. General Question: In order for a Connection object
    to join a Transaction, Do I have to create the
    connection after the transaction has started?Strictly NO. In fact, the connection is obtained first and then can a transaction begin.
    2. If the answer to the above question is yes, then: I
    understand that when this bean get passivated, the
    UserTransaction instance object would be passivated.
    And since the connection object can't not be
    passivated, I have to recreate the connection object
    in ejbactivate() method, would newly created
    connection participate in the same Transaction that
    was being passivated and now activated?
    The answer to first question being NO, your argument for question 2 does not hold true. According to the EJB specification, a stateful session bean can only be passivated between the transaction and not within a transaction. Your implementation for the stateful EJB is good to work.

  • Handling Transaction in Stateful Session Bean

    I wrote a public method like public void doTransaction()
    it will call 2 private method, like: methodA and methodB
    Both private methods have db accesss statement and will update the db. They got different db connection and will close the connection when method call finished.
    How to include them to one transaction? I want to be able to rollback the job of the first method when I catch exception thrown by the second method.
    I tried simply define transaction type of the public method to be Container and Required. But it doesn't work, the first method doesn't rollback. Of course I can let the 2 private methods share a same connection and commit after finishing calling them. But how if they are in different DB?

    Ok... Here it goes...
    You can do it in the following manner.
    As you said you have got 2 private methods doing d/b updates and these are called from a public method.
    Stateful session beans since associated with a client across methods, you can take advantage of it. Write your own user defined transaction.
    Begin the transaction scope in your public before calling the 1st private method. Call the 2 methods in a try block. Once you are done with these methods, you can commit and end the transaction. If you get any exception, rollback the transaction in the catch block. Otherwise if u get any exception in the 2nd method, you can rollback the transaction there itself.
    Stateful session beans lets u allow to spawn the bean managed transaction across methods. you can begin your transaction in one method and end it in a differnt method or you can end the transaction after calling the methods.
    The problem you are dealing with can typically very well handled by writing bean managed transaction.
    Hope this helps. If you need anymore clarity on my solution, please let me know.
    -amit

  • How to intantiate Stateful session bean in EJB 3 ?

    In EJB 2.x, to instantiate a Stateful Session bean the process was:
    1. Lookup Home object
    2. call create(args) method on Home, that in turn would call corresponding ejbCreate(args) on the bean implementation.
    Now, in EJB 3, there is no concept of Home interaface, How can I instantiate a stateful session bean with some initialization parameters.
    Thanks

    Just the spec. NetBeans should only be providing the ability to add an ejbCreate method if the bean exposes a Local or Remote 2.x view.
    Each lookup or injection of a stateful session bean results in a new bean instance. As long as you call your methods to populate the additional
    state right after first acquiring the stateful session bean reference it will work.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Stateful Session Bean accesed by two JSPs.

    Hi there,
    We are having quite an issue; we have an application that stores session
    state in an stateful session bean. And we have noticed some parts of the
    application create a situation where is possible that two frames -and so two
    jsp- access the session bean at the same time. And, of course, it´s going to
    be the same instance of the session bean..... what will be the behaviour in
    this case?. Will the requests be serialized, an exception will be thrown or
    the EJB will be destroyed?. Not very sure of what would happen. I suppose
    there could be some problems with this-. I would appreciate any help.
    Many thanks. Best regards.

    Hrm. EJB spec is quite clear on what will happen (RemoteException thrown) if
    the second client attempts to use Stateful Session bean which is already in
    use (and the bean will not be destroyed - container will simply throw an
    exception after failing to acquire a lock on the bean instance without waiting
    (allow-concurrent-calls option in WebLogic allows client call to wait to acquire
    lock - this was probably added as a convinience feature for applications which
    use frames)).
    So, normally your application has to ensure that no 2 clients are able to use
    the same stateful session bean concurrently, or use allow-concurrent-calls option,
    which will do that for you, but the application will become non portable.
    Dimitri
    PS: Thanks. Maine Coon cats are the best. Ours is a 22-pound giant ;-)
    Pinklon Thomas <[email protected]> wrote:
    Hi Dimitri,
    Thnaks a lot for the help:one thing that I do not know if it´s an issue is
    that calls come from different JSPs; the strategy I have seen in another Web
    application servers is trying to activate the EJB in the middle of another
    transaction... In this situation, the container cannot activate the EJB,
    roolback the transaction and destroys the EJB.... Would Weblogic feature
    avoid this?. I will investigate on my part....
    Many many thnaks. Nice cats.
    "Dimitri Rakitine" <[email protected]> wrote in message
    news:[email protected]...
    In 6.1 you can set allow-concurrent-calls to true in this situation:
    <!--
    The allow-concurrent-calls specifies whether a stateful session bean
    instance will allow concurrent method calls. The value of this
    element may be either "True" or "False". The default value is
    "False". When a stateful session bean instance is currently in a
    method call and another (concurrent) method call arrives on the
    server, the EJB specification requires that the server throw a
    RemoteException. By default, allow-concurrent-calls is false, and the
    EJB container will follow the EJB specification. When this value is
    set to true, the EJB container will block the concurrent method call
    and allow it to proceed when the previous call has completed.
    Used in: stateful-session-descriptor
    -->
    Pinklon Thomas <[email protected]> wrote:
    Hi there,
    We are having quite an issue; we have an application that stores
    session
    state in an stateful session bean. And we have noticed some parts of the
    application create a situation where is possible that two frames -and sotwo
    jsp- access the session bean at the same time. And, of course, it´sgoing to
    be the same instance of the session bean..... what will be the behaviourin
    this case?. Will the requests be serialized, an exception will be thrownor
    the EJB will be destroyed?. Not very sure of what would happen. Isuppose
    there could be some problems with this-. I would appreciate any help.
    Many thanks. Best regards.--
    Dimitri

  • Stateful session bean and faces

    I have one stateful session bean(EJB) that manages business logic and conditional page flow. In the web part i have a bunch of JSP pages and each page has it's own JSF bean with data and "submit" methods. Each bean has to keep a reference to this stateful bean and it should be the same reference among all beans. Also i have to create and destroy this bean some way (I think i can use HttpSessionBindingListener).So, any suggestions how to do this? Also i'm searching for 'tips'n'tricks' or design pattern for JSF.
    anton

    why do you need to hold the same EJB reference in all your JSF beans?
    something is wrong with your design, you should take a closer look to see why you need this. a stateless bean does not hold client specific state and there is no difference between stateless bean instances, so your JSF beans do not have to point to the same EJB reference.

  • 1) Second thread call to stateful session bean.

    Hi Friend,
    I read your threads on otn and i compared your problem with us and i analysed that your application and my application is same, So Plese can you help me in some issues.
    Friend, Please help me in these issues, Thanks for this
    We have very big ADF Swing+BC Application and deployed as Stateful Session Bean. in my application there are 500 Application Modules,For each application module i created Stateful session beans and deployed it on OC4J Container but when working on deployed application then i am getting time out error after 15 min of working.
    1). I set that parameter that you mentioned i.e jbo.ejb.txntimeout = 86400,but still it is giving me same error.
    2). Second Issue is of ---ORA-01000: maximum open cursors exceeded
    For this issue i chaged the Database Parameter i.e OpenCurser=2000, but still it is giving me same error,
    is there any parameter on application module required to change so that this error will not come.
    3). When i close the form then application module is not releasing database connection.
    4). (oracle.oc4j.rmi.OracleRemoteException) Second thread call to stateful session bean
    This error is also coming when I am using deployed application for long time i.e more than 15 min for Heavy Transactions

    Hi Suyog,
    How r u?
    We all are fine.
    I alerady tried for the Max Curser Property but it is not helpfull.
    I think again i have to go for closing opened db RS and statements.
    Thanks
    Vijay

Maybe you are looking for