Threads/Locks within EJBs

I'm trying to get a good handle on the reason there are restrictions on threading/locking
semantics used from within application code dealing with EJBs. I think the idea
is the application code shouldn't do anything to interfere with the locking of
the ejbs done from within the container at various stages in their lifecycle.
So, I shouldn't subject the bean implemenation class to any explicit synch. But
what about spawning threads from within my EJBs? In 3rd party classes used by
my EJBs?
Any clear explanation is gratefully appreciated.
Max

Max
See section 24.1.2 "Programming restrictions" in the ejb20 final release specification.
Thanks
Jim
Max wrote:
I'm trying to get a good handle on the reason there are restrictions on threading/locking
semantics used from within application code dealing with EJBs. I think the idea
is the application code shouldn't do anything to interfere with the locking of
the ejbs done from within the container at various stages in their lifecycle.
So, I shouldn't subject the bean implemenation class to any explicit synch. But
what about spawning threads from within my EJBs? In 3rd party classes used by
my EJBs?
Any clear explanation is gratefully appreciated.
Max[Reply.vcf]

Similar Messages

  • Thread lock in WL 8.1-on jRockit (queryMbeans)

    I have noticed in our thread dumps of Weblogic 8.1 managed servers, the following lock:
    "ExecuteThread: '2' for queue: 'weblogic.admin.RMI'" id=186 idx=0x182 tid=5292 prio=5 alive, in native, native_blocked, daemon
    at jrockit/vm/Allocator.allocLargeArray(JIZ)Ljava/lang/Object;(Native Method)
    at jrockit/vm/Allocator.allocArray(JIZ)Ljava/lang/Object;(Unknown Source)
    at java/util/HashMap.resize(I)V(Unknown Source)
    at java/util/HashMap.addEntry(ILjava/lang/Object;Ljava/lang/Object;I)V(Unknown Source)
    at java/util/HashMap.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
    at java/util/HashSet.add(Ljava/lang/Object;)Z(HashSet.java:192)
    at com/sun/management/jmx/RepositorySupport.query(Ljavax/management/ObjectName;Ljavax/management/QueryExp;)Ljava/util/Set;(RepositorySupport.java:241)
    at com/sun/management/jmx/MBeanServerImpl.queryMBeans(Ljavax/management/ObjectName;Ljavax/management/QueryExp;)Ljava/util/Set;(MBeanServerImpl.java:1042)
    ^-- Holding lock: weblogic/management/internal/RemoteMBeanServerImpl@0x2000000008e78fc0[fat lock]
    at weblogic/management/internal/RemoteMBeanServerImpl.queryMBeans(Ljavax/management/ObjectName;Ljavax/management/QueryExp;)Ljava/util/Set;(RemoteMBeanServerImpl.java:911)
    at com/sun/management/jmx/MBeanServerImpl.queryNames(Ljavax/management/ObjectName;Ljavax/management/QueryExp;)Ljava/util/Set;(MBeanServerImpl.java:1075)
    at weblogic/management/internal/MBeanHomeImpl.mbeanServerQuery(Ljavax/management/ObjectName;Ljavax/management/QueryExp;)Ljava/util/Set;(MBeanHomeImpl.java:487)
    at weblogic/management/internal/MBeanHomeImpl.getMBeansByClass(Ljava/lang/Class;Ljava/lang/String;)Ljava/util/Set;(MBeanHomeImpl.java:311)
    at weblogic/management/internal/MBeanHomeImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
    at weblogic/rmi/internal/BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
    at weblogic/rmi/internal/BasicServerRef$1.run()Ljava/lang/Object;(BasicServerRef.java:435)
    at weblogic/security/acl/internal/AuthenticatedSubject.doAs(Lweblogic/security/subject/AbstractSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(AuthenticatedSubject.java:363)
    at weblogic/security/service/SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(SecurityManager.java:147)
    at weblogic/rmi/internal/BasicServerRef.handleRequest(Lweblogic/rmi/spi/InboundRequest;)V(BasicServerRef.java:430)
    at weblogic/rmi/internal/BasicExecuteRequest.execute(Lweblogic/kernel/ExecuteThread;)V(BasicExecuteRequest.java:35)
    at weblogic/kernel/ExecuteThread.execute(Lweblogic/kernel/ExecuteRequest;)V(ExecuteThread.java:224)
    at weblogic/kernel/ExecuteThread.run()V(ExecuteThread.java:183)
    at jrockit/vm/RNI.c2java(JJJJ)V(Native Method)
    -- end of trace
    Then a big number of other threads are blocked by this lock. An example is:
    "ExecuteThread: '1' for queue: 'HZOZMsgEjbExecuteThreadQueue'" id=17 idx=0x30 tid=5123 prio=5 alive, in native, blocked, daemon
    -- Blocked trying to get lock: weblogic/management/internal/RemoteMBeanServerImpl@0x2000000008e78fc0[fat lock]
    at jrockit/vm/Threads.waitForSignal(J)Z(Native Method)
    at jrockit/vm/Locks.fatLockBlockOrSpin(JLjrockit/vm/ObjectMonitor;II)V(Unknown Source)
    at jrockit/vm/Locks.lockFat(Ljava/lang/Object;JLjrockit/vm/ObjectMonitor;Z)Ljava/lang/Object;(Unknown Source)
    at jrockit/vm/Locks.monitorEnterSecondStage(Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
    at jrockit/vm/Locks.monitorEnter(Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
    at com/sun/management/jmx/MBeanServerImpl.internal_addObject(Ljava/lang/Object;Ljavax/management/ObjectName;)V(MBeanServerImpl.java:2379)
    at com/sun/management/jmx/MBeanServerImpl.registerMBean(Ljava/lang/Object;Ljavax/management/ObjectName;)Ljavax/management/ObjectInstance;(MBeanServerImpl.java:876)
    at weblogic/management/internal/RemoteMBeanServerImpl.private_registerMBean(Ljava/lang/Object;Ljavax/management/ObjectName;)Ljavax/management/ObjectInstance;(RemoteMBeanServerImpl.java:614)
    at weblogic/management/internal/RemoteMBeanServerImpl.registerMBean(Ljava/lang/Object;Ljavax/management/ObjectName;)Ljavax/management/ObjectInstance;(RemoteMBeanServerImpl.java:554)
    at weblogic/management/runtime/RuntimeMBeanDelegate.register()V(RuntimeMBeanDelegate.java:166)
    at weblogic/management/runtime/RuntimeMBeanDelegate.<init>(Ljava/lang/String;Lweblogic/management/runtime/RuntimeMBean;Z)V(RuntimeMBeanDelegate.java:122)
    at weblogic/management/runtime/RuntimeMBeanDelegate.<init>(Ljava/lang/String;Lweblogic/management/runtime/RuntimeMBean;)V(RuntimeMBeanDelegate.java:85)
    at weblogic/jms/frontend/FEConnection.<init>(Lweblogic/jms/frontend/FEConnectionFactory;Ljava/lang/String;Lweblogic/jms/common/JMSID;Lweblogic/jms/dispatcher/Dispatcher;IIJJJJLjava/lang/String;JZZIIIZZ)V(FEConnection.java:183)
    at weblogic/jms/frontend/FEConnectionFactory$1.run()Ljava/lang/Object;(FEConnectionFactory.java:434)
    at weblogic/security/acl/internal/AuthenticatedSubject.doAs(Lweblogic/security/subject/AbstractSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(AuthenticatedSubject.java:363)
    at weblogic/security/service/SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(SecurityManager.java:147)
    at weblogic/jms/frontend/FEConnectionFactory.connectionCreateInternal(Lweblogic/jms/dispatcher/DispatcherWrapper;Z)Lweblogic/jms/client/JMSConnection;(FEConnectionFactory.java:430)
    at weblogic/jms/frontend/FEConnectionFactory.connectionCreate(Lweblogic/jms/dispatcher/DispatcherWrapper;)Lweblogic/jms/client/JMSConnection;(FEConnectionFactory.java:371)
    at weblogic/jms/client/JMSConnectionFactory.createConnectionInternal(Ljava/lang/String;Ljava/lang/String;Z)Lweblogic/jms/client/JMSConnection;(JMSConnectionFactory.java:148)
    at weblogic/jms/client/JMSConnectionFactory.createQueueConnection()Ljavax/jms/QueueConnection;(JMSConnectionFactory.java:75)
    at gr/cosmote/common/util/UtilLib.putObjToQueue(IILjava/io/Serializable;JLgr/cosmote/common/bus/LoginInfo;)V(UtilLib.java:664)
    at gr/cosmote/common/util/UtilLib.putObjToQueue(IILjava/io/Serializable;Lgr/cosmote/common/bus/LoginInfo;)V(UtilLib.java:636)
    at gr/cosmote/bus/session/HZOZQueueBean.handleMozartCallbackVO(Lgr/cosmote/common/bus/mozartVOs/MozartCallbackVO;)V(HZOZQueueBean.java:418)
    at gr/cosmote/bus/session/HZOZQueueBean.onMessage(Ljavax/jms/Message;)V(HZOZQueueBean.java:191)
    at weblogic/ejb20/internal/MDListener.execute(Lweblogic/kernel/ExecuteThread;)V(MDListener.java:400)
    at weblogic/ejb20/internal/MDListener.transactionalOnMessage(Ljavax/jms/Message;)V(MDListener.java:333)
    at weblogic/ejb20/internal/MDListener.onMessage(Ljavax/jms/Message;)V(MDListener.java:298)
    at weblogic/jms/client/JMSSession.onMessage(Ljavax/jms/MessageListener;Lweblogic/jms/common/MessageImpl;)V(JMSSession.java:2686)
    at weblogic/jms/client/JMSSession.execute(Lweblogic/kernel/ExecuteThread;)V(JMSSession.java:2598)
    at weblogic/kernel/ExecuteThread.execute(Lweblogic/kernel/ExecuteRequest;)V(ExecuteThread.java:224)
    at weblogic/kernel/ExecuteThread.run()V(ExecuteThread.java:183)
    at jrockit/vm/RNI.c2java(JJJJ)V(Native Method)
    -- end of trace
    What is this 'weblogic.admin.RMI' queue?
    What I understand so far is that the object that appears as locked (RemoteMBeanServerImpl) is used to initiate and instantiate ejb/rmi calls from the managed servers. Does it attempt some sort of connection to the admin? Something else quite interesting that I read somewhere, that when this call (queryMBeans) is performed, the result is handled by a non thread-safe collection object which could (as a result of a weblogic bug) result in an infinite loop.
    By the way, our set up is 1 cluster, 4 managed servers in 4 different machines. The admin is installed along with one of the managed. All servers are configured to start/stop/run independently.
    Anybody any ideas?

    hi,
    What is this 'weblogic.admin.RMI' queue has the threads executing the calls from remote managed servers to the Admin Server and from the Admin Server to the managed servers for internal status updates.
    There was a bug in wls 8.1 where the call the to the admin server from all the managed server in the cluster used to create a thread lock state.
    Contact the Oracle support for the related CR and the patch.
    thanks,
    Sandeep

  • Alamouti 2x2 using USRP- PPL did not lock within the allotted time

    Hello.
    I've been trying to use the following example VI:
    http://www.ni.com/white-paper/13878/en/
    I can't understand how to connect the two USRPs 
    What clock source should I use? How should I connect it?
    right now I have my USRPs connected with a MIMO cable, and both are connected to my laptop with a gigabit switch.
    currently, when I'm tring to run the VI without the clock source, there is this error:
    niUSRP initiate.vi<ERR>The reference clock PPL did not lock within the alloted time.
    Thank you in advance.

    Sorry for the late reply, I did not have access to the lab over the weekend. 
    Yes I am uing HW configuration 1.  i set my IPs for the Txs and Rxs (4 NI 2921 boards), set the symbol rate, and appropriate IQ sampling rate. I then set the Tx element 1 Ref Frequency Source and timbase clock to internal. and for element 2 to be MIMO. I do the same for the Rx element 1 and element 2 as mentioned in the white paper. I set an appropriate carrier freq according to my machine (shown in snapshot below)
    I then run the code, and the error shown in the picture shows up. Apparently, the error code is not recognized. I also show a picture of the error recorded on the front panel (which is the actual error, that needs to looked at). I then re-wire the error out in the block diagram to be connected to the last block in the chain 'Calculate BER VI' (shown in the 3rd picture below) which was previously not the case. Now i rerun the VI, and the error showing up in the block diagram is gone but the error mentioned on the front panel is still there (which is normal becuase i have not changed anything important in the block diagram). 
    I look up this error 'Error -107411864 - A stream command was issued in the past' and find this NI-known issues document: http://www.ni.com/product-documentation/52445/en/ 
    And I see this error there. ID number 467209 (corresponding to the above error) . In this it states:
    This error occurs when you set Timebase Clock Source to PpsIn and do not provide a timebase clock source to the PPS IN port.
    If you set Timebase Clock Source to PpsIn and do not provide a timebase clock source to PPS IN, the USRP device will revert back to its internal timebase clock source. This may result in error -1074118649 "A stream command was issued in the past."
    Since I have not even setup the configuration on the front panel using the Ref_in and PPS_in (i have actually set them to internal) why am i still getting this error. 
    I also looked at the ID number '466351' in the same list (right below the prev one) and find out that also seems to be fine since not all of the follwing conditions are being met:
    The slave device has a GPSDO.
    The niUSRP Set Time VI is called only on the master.
    The timestamp is applied immediately.
    as mentioned in the description. 
    And since, there is a clear conflict between the white paper configuration designed for this 2x2 scheme (HW configuration 1) and the actual HW configuration corresponding to this same white paper (HW configuration 2), how can i expect the code to run without the Refi_in and PPS_in for all 4 devices (for sync between Transmitters and Recievers) which seems to important for this code to run properly. 
    I do not understand this error either 'A stream command was issued in the past' since i have not found a soultion to it online. 
    Now can you elaborate on what seems to be a conflict and elaborate on this error, which has been reported on other threads as well but the NI people do not seem to bother to respond as to why this is so.

  • How to let new thread to access EJB

    I start new thread in Servlet class and I want this thread to call EJB business method but I get following error:
    javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:"
    Probablly because thread has no credentials and so on. I know this concept violates J2EE specs but I don't know how to make timer to call business mathod every N minutes (I use J2EE 1.3 so I can't use Tiemr EJB).
    I suspect that this new thread has no credentials and no role. What happens if I set run-as some role in servlet? As I saw new thread still has no credentials and role.
    Can anyone suggest me how can I set credentials to new thread so it can call EJB business method or how to implement timer service in J2EE 1.3.

    I start new thread in Servlet class and I want this
    thread to call EJB business method but I get
    following error:
    javax.naming.NameNotFoundException: Name comp/env/ejb
    not found in context "java:"It may happen because you'r new thread doesnt have information (JNDI environment) about EJB references.
    Can anyone suggest me how can I set credentials to
    new thread I guess it's server specific.
    so it can call EJB business method or how
    to implement timer service in J2EE 1.3.Don't use EJB reference. Lookup EJB by it's global JNDI name.

  • WLS Container Threads LOCKED

    Apologize for this cross-post but I posted in in probably wrong group
    Found several WLS Jrockit Threads LOCKED. We are using jrockit81sp2rp1_141_06
    System got HUNG
    All MUXERS are LOCKED show SocketResetException that seems funny ?
    Thanks
    Harish
    [enablersthreaddump.txt]

    Hi,
    I'm also facing the same problem, but my server is WLI 8.1 SP2. When we restarted the server for couple of times, it started working fine. but why it is coming? also restarting production server is not a possible solution.
    Any one has answers?
    Thanks,
    Chandra. T

  • Spawning threads from within a UnicastRemoteObject

    I have a question regarding spawning threads from within a class that extends UnicastRemoteObject. Would it be okay to spawn new thread(s) in the constructor/ remote methods of the class that extends UnicastRemoteObject .? Are there any pitfalls to doing so? Is it against the suggested practice of writing RMI server code?
    rajkumar

    You can do anything you like in the Class that extends URO.
    The classic problem of doing anything within a constructor is that the object under construction may not be available to the threads you are spawning. That is, since the object is not fully constructed, any fields the new threads need may not be available. There have been discussions on this subject in the forums before. You might give a look and see.

  • To contact 3rd party application from within EJB container

    What are the possible options to communicate with an external application from within EJB container? Options that I can think of are
    - RMI
    - JMS
    - Socket communication
    - HTTP
    - any other option???
    And if anyone can give the pros & cons of the different approaches, based on their experiences it will be great.

    Hi,
    There is one more.
    Web Services which is much powerful than any other.
    Ofcourse for this also u have to use socket communication and http protocol.
    SOAP(Simple Object Access Protocol).. I think u got it..
    I prefer SOAP as it has many adavantages over RMI and other.
    Thanks,
    All the best.
    What are the possible options to communicate with an
    external application from within EJB container?
    Options that I can think of are
    - RMI
    - JMS
    - Socket communication
    - HTTP
    - any other option???
    And if anyone can give the pros & cons of the
    different approaches, based on their experiences it
    will be great.

  • "MIMO Cable link did not lock within alloted time" error in USRP 2922

    Hi,
    I am running Prof Heath courseware experiments, specifically lab 2.1, on USRP 2922 and I have come through this error:
    "niUSRP Initiate.vi<ERR>The MIMO cable link did not lock within the alloted time." with error code "-1074118624". I don't understand the error and don't know what to do noting that I'm not using anything related to MIMO and I don't have a MIMO cable in the first place.
    Can someone help me with that? Thanks!
    Solved!
    Go to Solution.

    Here I am attaching screenshots for the top_rx.vi (1.jpg and 2.jpg) showing the hardware parameters and the modulation parameters respectively and a screenshot for the receiver.vi (the subvi, 3.jpg) where the problem occurs.
    And yes, I've been able to run other examples: the vi for the first experiment ran smoothly.
    Attachments:
    1.JPG ‏235 KB
    2.JPG ‏263 KB
    3.JPG ‏246 KB

  • I see an icon to the left of the battery, it looks like a lock within a circle. any ideas what it might be and how to remove it?

    I see an icon to the left of the battery, it looks like a lock within a circle. any ideas what it might be and how to remove it?

    ycr61 wrote:
    I see an icon to the left of the battery, it looks like a lock within a circle. any ideas what it might be and how to remove it?
    It is the orientation lock. To de-activate, double click the home button and scroll to the left until you see the same lock within a circle. Tap it to turn off the lock
    Stedman

  • Thread Locking Exception

    Hi All,
    Many times while working on MDM via MDM API's I received Thread Locking Exception. This Exception is so severe that it leads MDM Data Manager in  hanged state and get resolved only by restarting the server. Sometimes I do not get this exception but Data Manager gets hanged, even I am unable to open Console also. Please answer this question.
    Thanks ..
    Vibha

    Hello All,
    Still we haven't able to resolve this issue. We already have SR with oracle. So many logs were captured.
    Below is the snippet of seedSchedulerdata.log
    ${work.dir}Entered Validate methodExiting Validate method------------------------------------------------------------
    Start seeding task
    job name--> Password Expiration Task
    schTaskName--> Password Expiration Task
    task class name--> com.thortech.xl.schedule.tasks.tcTskPasswordExpiration
    task job disable--> 0
    task frequency--> DAILY
    task maxRetries--> 5
    task retryCount--> 0
    task paramName--> Email Definition Name
    task paramValue--> Password Expired
    task paramTpe--> String
    Updating Job :Password Expiration Task with keys
    java.lang.Exception: Unable to seed scheduler data due to configuration problems. Contact System Administrator
         at oracle.iam.scheduler.seed.SeedSchedulerData.startSeeding(SeedSchedulerData.java:770)
         at oracle.iam.scheduler.seed.SeedSchedulerData.main(SeedSchedulerData.java:113)
    If any of them faced such issue please help.
    Thanks
    DK

  • Thread lock

    Dear Moderator,
    I wanted to know the answers of some questions which were asked to me during interview. So I posted those questions in the Forum on 1st December. But today when I logged in to check the answers, I found the thread locked. Can you please let me know  on what basis a thread is locked.
    Regards,
    D. Mallick
    Moved from Test and Playground forum.
    Edited by: kishan P on Dec 3, 2010 11:22 PM

    I can remember moving one of them which several forum members where complaining about (understandably).
    I mean... I can imagine encountering a thread called "questions" even although it is a meaninglessly stupid subject title, but what are we to find usefull in answers ??
    Get some fresh air over the weekend. You have some reading to do next week.
    Cheers,
    Julius

  • SAML assertion exceptions within EJB

    Okay, I'll try to keep this simple:<br /><br />We are implementing the standard LC Java API's for rendering forms (using the FormsServiceClient) and then transforming the rendered content to PDF/A using the outputClient. Since we have a lot of simultaneous requests the logic is implemented within a stateless session EJB. <br /><br />I instantiate the ServiceClientFactory within the EJB's init() method and then store the ServiceClientFactory reference as a class variable so that on subsequent business method invocations, the same ServiceClientFactory object can be reused (without going throug the overhead of instantiating one on each req). (Note that on each request, I create a new FormsServiceClient or OutputClient using the SAME ServiceClientFactory object). I have some questions/concerns:<br /><br />1) Is this form of reuse of the ServiceClientFactory object okay?<br /><br />2) We keep getting the following error:<br />><i>" <Warning> <com.adobe.idp.common.errors.exception.IDPLoggedException> <000000> <UserM:GENERIC_WARNING: [Thread Hashcode: 668113225] | [AuthenticationManagerBean] errorCode:12804 errorCodeHEX:0x3204 message:Could not validate SAML Token --- Assertion is not valid. Current time is greater than NOTonOrAfter time specified in the Assertion>"</i><br /><br />After a simple restart of the EJB, the error goes away. How can this be fixed? What's causing this?<br /><br />Any help would be much appreciated!

    PROBLEM
    Using the same instance of ServiceClientFactory to remotely invoke the services exposed by the LiveCycle container can lead to
    exception related to assertion expiry
    Solution
    To handle the timeout use the ThrowHandler mechanism provided by the ServiceClientFactory framework
    Detailed explanation
    LiveCycle provides a client sdk for java based client to invoke its services remotely.
    An invocation involves Creation of a ServiceClientFactory instance Setting the user credential in thefactory instance Pass that factory to a service client or use that to create InvocationRequest directly
    Use the client to make the actual request.
    For more details refer to Invoking
    LiveCycle ES Using the Java API .
    A ServiceClientFactory instance once created is valid for a ceratin
    period of time which is by default 120 min. if the same instance is used to invoke beyond this period then it would lead to an exception stating that
    the session has expired [com.adobe.idp.um.api.impl.AuthenticationManagerImpl]
    errorCode:16421 errorCodeHEX:0x4025 message:Could not validate SAML
    Token --- Assertion has expired and hence not valid for user
    [administrator@DefaultDom]. Its valid till time [Thu Oct 22
    17:07:53 IST
    2009] was found to be before the current time [Thu Oct
    22 17:58:18 IST 2009]
    This is not an issue if the ServiceClientFactory instance is used for short duration. However if you are going to perform a long
    running task like converting large number of documents to pdf ,applying policies to them etc then it would be an issue.
    Session Expiry
    Before fxing the issue some info on what is session expiry.
    When you use a ServiceClientFactory instance to invoke the service following fow happens
    You set the credentials in the properties and invoke theservice
    LiveCycle on server side validates the credentials and issues a Context. It is sort of a ticket which can be reused later instead of the actual credentials.
    Upon receiving the response from the server the ServiceClientFactory instance deletes its own copy of credentials and instead stores the Context For later invocations this Context instance is passed instead of the user credentials
    This whole fow is done to ensure that user's credentials are not sent for each remote call thus improving the security.
    For more information on Context refer to
    User Identity in LiveCycle .
    Solution
    To fx this issue you would have to re authenticate to LiveCycle and get the Context reissued. the best way to do that is to make use of the ThrowHandler provided by the ServiceClientFactory framework
    STEP1 -  Create a Throwhandler
    * This ThrowHandler caches the user credentials and uses them
    to refresh the Context in the
    * ServiceClientFactory upon expiry.
    private static class SimpleTimeoutThrowHandler implements
    ThrowHandler {
    private String username;
    private String password;
    public SimpleTimeoutThrowHandler(String username, String
    password) {
    this.username = username;
    this.password = password;
    public boolean handleThrowable(Throwable t, ServiceClient
    sc,
    ServiceClientFactory scf, MessageDispatcher md,
    InvocationRequest ir, int numTries) throws
    DSCException {
    if(timeoutError(t)){
    //The call to AuthenticationManager do not require
    authentication so the default properties
    //are suffcient
    AuthenticationManager am =
    new
    AuthenticationManagerServiceClient(ServiceClientFactory.createInstance(getDefaultPropertie s()));
    AuthResult ar = null;
    try {
    ar =
    am.authenticate(username,password.getBytes());
    } catch (UMException e) {
    throw new IllegalStateException(e);
    Context ctx = new Context();
    ctx.initPrincipal(ar);
    //Refresh the ServiceClientFactory instance with
    the new context
    scf.setContext(ctx);
    logger.info("Refreshed the context associated with
    ServiceCLientFactory");
    //Now tell SCF to try the invocation again
    return true;
    //Check so that we do not wrap the exception again
    if(t instanceof DSCException)
    throw (DSCException)t;
    if(t instanceof RuntimeException)
    throw (RuntimeException)t;
    // how is it possible to get this far?
    throw new IllegalStateException(t);
    private boolean timeoutError(Throwable t) {
    if(!(t.getCause() instanceof UMException)){
    return false;
    UMException ue = (UMException) t.getCause();
    //Check that UMException is due to the
    assertion/context expiry
    if(UMConstants.ErrorCodes.E_TOKEN_INVALID ==
    ue.getErrCode()){
    return true;
    return false;
    This ThrowHandler would be invoked by the ServiceClientFactory upon receiving any exception. The handler would then determine if its a timeout related exception and then would refresh the Context associated with the factory instance and tells it to retry the invocation.
    STEP - 2 Register the handler
    ServiceClientFactory.installThrowHandler(new
    SimpleTimeoutThrowHandler(username, password));
    Note: The handler should be registered only once in the application
    STEP 3 - Perform your invocation
    Following sample would try to apply policies on all the fles present in a directory
    Properties p = getDefaultProperties();
    p.setProperty(DSC_CREDENTIAL_USERNAME, username);
    p.setProperty(DSC_CREDENTIAL_PASSWORD, password);
    ServiceClientFactory scf =
    ServiceClientFactory.createInstance(p);
    //Now do some long running operation
    String inputDirName ="path-to-input-dir";
    String outDirName = "path-to-out-dir";
    String policyName = "the-policy-name";
    File inDir = new File(inputDirName);
    File outDir = new File(outDirName);
    RightsManagementClient rmClient = new
    RightsManagementClient(scf);
    DocumentManager docManager = rmClient.getDocumentManager();
    //Iterate over all the pdf in the inDir and apply the
    policies. If this takes a
    for(File pdfFile : inDir.listFiles()){
    Document inDoc = new Document(pdfFile, false);
    Document securedDoc = docManager.applyPolicy(inDoc,
    pdfFile.getName(), null, policyName, null, null);
    securedDoc.copyToFile(new
    File(outDir,pdfFile.getName()));
    Now the invocation would complete even if it takes a long time. if any session expiry occurs then our ThrowHandler would take care of that.
    here's a sample:
    TimeOutSample.zip

  • Any way to get CPU-seconds for process or a thread from within my app?

    I'm trying to guage the work by different processes within our application. I'd like to be able to get the number of CPU-seconds before a long task and then again after the task finishes and compute the difference. I'm sure I could poll the % CPU every second and try estimate the value, but I don't think it would be very accurate.
    Is there a MBean or some other way to access the CPU-seconds for the process?
    It would even be better if I could get this at the thread level (which seems possible since JRA recordings can show the 'running' time on a graph drawn in milliseconds).
    Thanks
    -Bill

    We are considering making this available through a MBean in our upcoming R28 release.Do you have a program I can participate in to get beta or pre-releases of new JRockit versions? The purpose would be to do preliminary performance testing so we can get official releases to our development team more quickly once they are formally released.
    I'm also hoping to find cumulative disk i/o bytes and cumulative network i/o bytes on a thread or even at the JVM levelI don't think we have that in JRockit today... What would you use it for?The use would be for performance monitoring. In a large system or a busy system, the effect of code changes can be hard to measure just based on clock time or traditional measurements like % CPU or bytes/sec at a specific instant. Knowing how much 'work' is getting done (together with the clock time) gives a better picture.
    I like cumulative numbers like cpu-sec and # of bytes because I only need two measures (before and after) instead of continuous polling and summing. Some of my processes get created on their own threads, so I could potentially get these measures of work on my customer's production systems with a lot of other activity going on. By comparing samples over time, we can tell if processes are running longer due to 'more work' or due to resource bottlenecks.
    I think it could be useful on shared threads too even though i don't know yet if I can see which threads specific requests are using.
    -Bill

  • Weblogic threads locked

    We are noticing performance issue with our production environment. Production environment has a cluster of 6 weblogic instances and the server hangs very often and entire system go down. I have attached thread dump collected from one of the weblogic server. Any idea where is the issue? can you help please.
    "ExecuteThread: '19' for queue: 'weblogic.kernel.Default'" daemon prio=5 tid=0x04f92f38 nid=0xb8c runnable [0x0713e000..0x0713fd94]
         at java.lang.Throwable.fillInStackTrace(Native Method)
         - waiting to lock <0x164ec610> (a java.lang.ClassNotFoundException)
         at java.lang.Throwable.<init>(Throwable.java:217)
         at java.lang.Exception.<init>(Exception.java:59)
         at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:65)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         - locked <0x173b3428> (a sun.misc.Launcher$AppClassLoader)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         - locked <0x173b3428> (a sun.misc.Launcher$AppClassLoader)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
         - locked <0x173c1900> (a weblogic.utils.classloaders.GenericClassLoader)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
         - locked <0x17387ed8> (a weblogic.utils.classloaders.GenericClassLoader)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
         - locked <0x17dc9028> (a weblogic.utils.classloaders.GenericClassLoader)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
         - locked <0x17db3a88> (a weblogic.utils.classloaders.ChangeAwareClassLoader)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:224)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:41)
         - locked <0x17db3a88> (a weblogic.utils.classloaders.ChangeAwareClassLoader)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         - locked <0x17db3a88> (a weblogic.utils.classloaders.ChangeAwareClassLoader)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:141)
         at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:197)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:171)
         at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:112)
         at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerMethod(BaseDeserializerFactory.java:201)
         at org.apache.axis.encoding.ser.BaseDeserializerFactory.getGetDeserializer(BaseDeserializerFactory.java:289)
         at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:171)
         at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:115)
         at org.apache.axis.encoding.ser.SimpleDeserializerFactory.getDeserializerAs(SimpleDeserializerFactory.java:107)
         at org.apache.axis.encoding.DeserializationContextImpl.getDeserializer(DeserializationContextImpl.java:452)
         at org.apache.axis.encoding.DeserializationContextImpl.getDeserializerForType(DeserializationContextImpl.java:467)
         at org.apache.axis.message.MessageElement.getValueAsType(MessageElement.java:571)
         at com.axeda.sdk.webservices.handlers.LoginHandler.findLogin(LoginHandler.java:153)
         at com.axeda.sdk.webservices.handlers.LoginHandler.handleRequest(LoginHandler.java:99)
         at com.axeda.sdk.webservices.handlers.LoginHandler.invoke(LoginHandler.java:78)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:287)
         at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

    Try setting the 'Inactive connection timeout' value on the jdbc data source. Looks like your data source hangs. Also would be a good idea to set the 'test connections on reserve' on with test table sql.

  • Usage of Singleton within EJB Containter, recommended or not?

    Hi,
    in various articles I came across a statement that it is not a good practice to use the Singleton Pattern within the EJB Container. I recognize the problem when scaling an application to more application servers, which introduces the problem that every of this applications has a dedicated ClassLoader, so the sharing of the Singleton between this instances can be very complicated. I'm interrested in knowing if there are other issues that prevent the usage of the Singleton Pattern?
    Regarding scaling an application, can somebody share some expierences in scaling an application on oc4j? What problems may arise?
    thx in advance
    --hery                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    in various articles I came across a statement that it is not a good practice to use the Singleton Pattern within the EJB Container. I recognize the problem when scaling an application to more application servers, which introduces the problem that every of this applications has a dedicated ClassLoader, so the sharing of the Singleton between this instances can be very complicated. I'm interrested in knowing if there are other issues that prevent the usage of the Singleton Pattern?
    Regarding scaling an application, can somebody share some expierences in scaling an application on oc4j? What problems may arise?
    thx in advance
    --hery                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Fresh Install of Aperture v1 - Serial No Not Valid

    I have migrated to a new iMac and want to install Aperture v1.0 Retail and then use v2.0 upgrade. The v1.0 serial number is not recognised as valid - I have double/triple checked the typing. This is a full retail copy of v1. Any assistance appreciate

  • Title in Dialog

    I create a Dialog window, extends a JDialog. But when I set the title of the window, the pack() method don't set the size of the window to see entirely the title. Can someone give me a solution to see entirely the titre ? Thank you for your help. Mar

  • Mobile Facebook photo upload problem

    Everytime I try to post a video or photo via mobile facebook a message pops up saying that the photo cannot be uploaded at this time. It asks if I want to save this photo and try to upload it again later. Help, thanks..

  • Photos page does not display photos in some browsers

    Hi All: I published my "Photos" page, http://web.mac.com/funkyoldude/ It appears to work fine on Opera v. 9.24, Firefox v.2.0.0.7, and Safari v. 2.0.4. It does not display my photos on Mac IE v. 5.2, AOL v.10.3, and Mozilla v. 1.7.13 On these browser

  • The need to install Arch over network?

    When I install Arch, I need to connect to network and use pacstrap to get the packages according to the relative wiki pages. Could I install Arch without network connection? Which command I can use to do that, say, pacman? Why don't we provide a CD s