10 Replies Latest reply on Jul 16, 2008 3:07 PM by Balvindar Dhaliwal

    Weblogic: LockTimedOutException

    Balvindar Dhaliwal Newbie
      Hello,

      I am working with Seam, Weblogic 10MP1 and Trinidad JSF. I have a Stateful search action bean with a  @Synchronized(timeout=1000000000) setting, which throws a  weblogic.ejb20.locks.LockTimedOutException when a method on it is called when a button on a page is hit 3 or more times in quick succession. The button calls the find method which returns data from the database.

      search.xhtml:

      tr:commandButton text="Search" action="#{mySearch.find}" id="find"  blocking="true"/>

      web.xml:

      <ejb-local-ref>      
          <ejb-ref-name>ipbWeb/MySearchAction/local</ejb-ref-name>      
          <ejb-ref-type>Session</ejb-ref-type>      
          <local>com.myltd.action.MySearch</local>      
          <ejb-link>MySearchAction</ejb-link>   
        </ejb-local-ref>


      weblogic-ejb-jar.xml:

      <weblogic-enterprise-bean>
          <ejb-name>mySearch</ejb-name>
          <local-jndi-name>primeBrokerWeb/MySearchAction/local</local-jndi-name>
          <stateful-session-descriptor>
                <allow-concurrent-calls>true</allow-concurrent-calls>
           </stateful-session-descriptor>   
        </weblogic-enterprise-bean>

      The following exception is thrown:


      Caused by javax.servlet.ServletException with message: "/searchEvents.xhtml @110,25 binding="#{mySearch.table}": javax.ejb.EJBTransactionRolledbackException: [EJB:011042]Stateful Session EJBs cannot be used concurrently. If a stateful session EJB instance is in the middle of a method call and another call is attempted on this instance, a java.rmi.RemoteException is thrown. You may also consider setting the <allow-concurrent-calls> option in your weblogic-ejb-jar.xml. When this tag is set, the concurrent call waits for the first method call to complete.; nested exception is: weblogic.ejb20.locks.LockTimedOutException: [EJB:010107]The lock request from EJB:MySearchAction with primary key:50800237521928192 timed-out after waiting 0 ms. The transaction or thread requesting the lock was:Xid=BEA1-001A7EB869C1C40C9E06(26274925),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=299,activeThread=Thread[[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[seam_domain+AdminServer]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+169.183.166.196:7001+seam_domain+t3+, XAResources={WLStore_seam_domain__WLS_AdminServer, PrimeBrokerDb_DS, GPB_CS_DS},NonXAResources={})],CoordinatorURL=AdminServer+169.183.166.196:7001+seam_domain+t3+)."



      Please advise how I can make the Stateful MySarchAction bean receive concurrent requests.

      Thanks,
      Balvindar
        • 1. Re: Weblogic: LockTimedOutException
          Pete Muir Master

          What scope is the component?

          • 2. Re: Weblogic: LockTimedOutException
            Balvindar Dhaliwal Newbie

            The component is SESSION scope.


            Regards,
            Balvindar

            • 3. Re: Weblogic: LockTimedOutException
              Pete Muir Master

              Try increasing the concurrent-request-timeout in components.xml

              • 4. Re: Weblogic: LockTimedOutException
                Jay Balunas Novice

                Take a look at JBSEAM-2592 for some more details on this, and the workaround to the issue you are seeing (it is richfaces specific though). 


                With the Trinidad component there might be a way to queue, or send in these commands synchronously, which is one part of the work around.   


                Also do you have each EJB interceptor defined separately in your ejb-jar.xml. Like this example from the reference guide chapter on Weblogic:


                <assembly-descriptor>
                   <interceptor-binding> 
                      <ejb-name>AuthenticatorAction</ejb-name>
                      <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                   </interceptor-binding>
                   <interceptor-binding> 
                      <ejb-name>BookingListAction</ejb-name>
                      <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                   </interceptor-binding>
                </assembly-descriptor>



                The jira has some more information, but the root of this issue has to do with how Weblogic queues and handles requests to EJBs.  From what I remember the <allow-concurrent-calls>true</allow-concurrent-calls> did no good, and from BEA forums others saw that as well.  There is also a Weblogic setting for adjusting the lock timeout for waits you might be able to get that working in Weblogc, but I had exceptions attempting to.


                Certainly try Pete's suggestion as well, but I think this is really a weblogic problem.




                • 5. Re: Weblogic: LockTimedOutException
                  Balvindar Dhaliwal Newbie
                  Hello,

                  I have tried  the above suggestions:-

                  1) components.xml

                  <core:manager conversation-timeout="3600000"
                                    concurrent-request-timeout="1000000000"
                                    conversation-id-parameter="cid"/>


                  2) ejb-jar.xml

                  <interceptors>
                        <interceptor>
                           <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                        </interceptor>
                     </interceptors>
                    
                     <assembly-descriptor>
                        <interceptor-binding>
                           <ejb-name>*</ejb-name>
                           <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                        </interceptor-binding>
                       
                       
                     </assembly-descriptor>


                  I have also tried:

                  <weblogic-enterprise-bean>
                      <ejb-name>spillCashTradeSearch</ejb-name>
                      <local-jndi-name>ipbWeb/MySearchAction/local</local-jndi-name>
                      <stateful-session-descriptor>
                            <allow-concurrent-calls>true</allow-concurrent-calls>
                            
                       </stateful-session-descriptor>
                       <transaction-descriptor>
                            <trans-timeout-seconds>100</trans-timeout-seconds>
                       </transaction-descriptor>

                         
                    </weblogic-enterprise-bean>

                  The  weblogic settings do not work.
                   
                  Is there any  way to synchronise the request, or workaround.

                  Please advise.

                  Thanks,
                  Balvindar
                  • 6. Re: Weblogic: LockTimedOutException
                    Jay Balunas Novice

                    In the example that you are showing above for the ejb-jar.xml you are using a wild card.  Wildcards will make weblogic use a single instance of the interceptor for all EJBs.  You need to break out each bean like in the example I gave above.


                    I was not able to fix Weblogic's issue, but by adjusting the richfaces component I could make it very difficult to reproduce.  Does trinidad have the idea of an event queue, or some way to limit requests from piling up?


                    -Jay


                    • 7. Re: Weblogic: LockTimedOutException
                      Balvindar Dhaliwal Newbie

                      I also tried putting all the specific action classes in ejb-jar.xml. This also did not work. I am not sure about event queues in trinidad, will require investigation. Can I apply @Interceptors to my SearchAction class, and catch the exception and ignore it if it refers to the LockedTimeOut.I tried looking at applying @Interceptors to my stateful bean, but it complained about disallowed in section. Could I use this as a possible workaround?


                      Thanks,
                      Balvindar

                      • 8. Re: Weblogic: LockTimedOutException
                        Balvindar Dhaliwal Newbie

                        With trinidad, I can call an actionListioner method , ie performFind(ActionEvent), this gives me access to javax.faces.event.ActionEvent. This allows me access  to the actual UIComponent and queue as well. Any suggestions with what I can do here to block subsequent requests?


                        Thanks,
                        Bal.

                        • 9. Re: Weblogic: LockTimedOutException
                          Jay Balunas Novice

                          I would experiment - but you could try tracking pending requests, queuing them like richfaces does.  I believe they implement it like a FIFO queue.  This is alot easier on a discrete client like a browser.  This will require more fiddling on the server - i.e. where to store the queue, and how to block/unblock the correct requests.  The trick will be to that with out making the system unstable - but there must be a way.



                          -Jay

                          • 10. Re: Weblogic: LockTimedOutException
                            Balvindar Dhaliwal Newbie

                            On firefox, I don't have this issue. The issue is on ie 6.


                            Balvindar.