Subsequent EJB server-calls within one Thread?

Hi all,
will all subsequent EJB calls within the server be executed within the same Thread? I didn't find an exact spec of this.
The context is that i have remote and local stateless session beans and i want to share the timestamp at which the initial service call took place. So i thought about setting a ThreadLocal variable by an Interceptor and read this in every bean.
Maybe there is a better way to do this?
Thanks in advance,
Andreas

I'm not sure why you make each car a Thread when you later come along to create ActionThreads to do the work. It seems to me as if there is at least one Thread too many.
Nonetheless, this peace of code is most likely not a good implementation of what you are trying to do:
sleeping = true;
while (sleeping) {
  try {
    car.sleep(0);
  catch (InterruptedException ex)  {}
}The reasons being:
You are working with several concurrent Threads acting upon the same Cars, the master Thread, the Cars themselves and the ActionThreads. So you will need some synchronization to ensure consistency. You are using none! If you were, a call to sleep() would block the monitor of your Car instance.
You are using the while loop to implement busy waiting. A bad choice by itself, it might lock your VM totally if this Thread gets a high priority for some reason. What you actually want to use is a wait()-notify-pair jointly with proper synchronization.
http://java.sun.com/docs/books/tutorial/essential/threads/multithreaded.html

Similar Messages

  • New To Iplanet app server.Can some one help me getting started by delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with iplanet docs..didnt quite get it. thanx

     

    Hi,
    What is that you are trying to accomplish ? Is it deployment or
    trying to develop applications ? Are you getting any errors ? If so,
    please post them to help you. I think the documentation is the best place
    for you to begin with.
    Regards & Happy New Year
    Raj
    Arif Khan wrote:
    New To Iplanet app server.Can some one help me getting started by
    delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with
    iplanet docs..didnt quite get it. thanx
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • How can connect different ejb server in one client program

    hi , every
    i want to make connect ejb server into one client program.
    for that , but i try to change PROVIDER_URL property , it's not correct
    who solve this problem for novice? :(

    You need to create separate initialContext to each of the different servers
    and lookup up the different ejbs.
    -Sabha
    "inking" <[email protected]> wrote in message
    news:[email protected]..
    hi , every
    i want to make connect ejb server into one client program.
    for that , but i try to change PROVIDER_URL property , it's not correct
    who solve this problem for novice? :(

  • How many users one EJB server can handle?

    How many concurrent users can be served by one EJB server? After which point claster of servers should be created?
    I know that it depends on application, but can someone estimate some rough average?
    Real numbers from working application are very welcome.

    Specify the application server name, people would help if you tell the app server name.

  • If I have an EntityBean that mappes to two tables within one database, when I create that EJB, whoes reponsibilty to generate the primary key in database table? The RDBMS or EJB?

    If I have an EntityBean that mappes to two tables within one database, when I create
    that EJB, whoes reponsibilty to generate the primary key in database table? The
    RDBMS or EJB?
    Thanks,
    JW

    Refer to http://e-docs.bea.com/wls/docs81/faq/ejb.html/#257430
    "Jingwei Zhang" <[email protected]> wrote:
    >
    If I have an EntityBean that mappes to two tables within one database,
    when I create
    that EJB, whoes reponsibilty to generate the primary key in database
    table? The
    RDBMS or EJB?
    Thanks,
    JW

  • Load multiple views in one server call

    Hello,
    We are developing SAPUI5 application with Master & Detail page pattern. On detail page, we have 7 tabs so to make it more manageable we have created 7 different views, one for each tab instead of writing all the code in one view.  And one extra view which hold the tab and 7 views.
    Now code is easy to maintain as we can go to specific view and do the changes instead of searching in one big view. But there is a new problem now, it take lot of time to load the detail section. It makes separate server call to load each view.  Earlier it was loading detail section with one server round trip but now it is making 8 server round trips ( one for every view ).
    So the question is, is there any way to load multiple views in single server trip?
    Regards,
    Vikram

    You can do so but then at the time of defining the viewset you need to ensure the rowspan and colspan correctly to fit the first and the second view. More over the configuration also needs to be maintained correctly.
    Regards,
    Harshit

  • BMP EJB Load and Store is calling only one time calling in a loop

    Loop Iterating two times but ejb load and store is calling only one time.
    Application deployed in 0c4j 10.1.2.0.0 container.

    This sounds more like a Teststand quesstion. You might want to post it there.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Direct calls within the oracle application server to the IIS using reverse

    trying to direct calls within the oracle application server to the IIS using reverse proxy. I am having problems...
    What is trying to be achieved is a call to the 3rd party web server (IIS with Oracle SSO plug-in) that will be invoked from the OAS.
    Any suggestions

    First you might get more response if you move your question to following forum:
    Oracle Application Server - General
    Second, I didn't quite understand your question. Can you pl. clarify it bit more? What exactly do you mean by invoking IIS from OAS (I am assuming by OAS you mean OC4J here)?
    Thanks
    Shail

  • Independent stateful calls from different threads on one destination

    Hello SAP-Experts,
    i'm dealing with the problem on the Web AS to guarantee some independent stateful call sequences for different calling threads.
    One application running on a WAS (the WAS-app) is called by different clients to pass some data. The WAS-app has to distribute the data to another system by using one RFC-destination.
    As i have understood i have to guarantee thread-safe sessions for stateful calls from different thread by implementing a custom SessionReferenceProvider that binds the session to the thread. I have done this.
    My problem is to register my custom SessionReferenceProvider to the WAS environment. By trying i get the following error:
    [java.lang.IllegalStateException: SessionReferenceProvider already registered [com.sap.engine.sessionmgmt.jco.applib.impl.SessionReferenceProviderImpl]]
    Does anyone can tell me how to register the custom SessionReferenceProvider on a WAS?
    Thanks and greetings
    Robert

    Hi Robert,
    You can first try stopping a Java application named sessionmgmtjcoapplib from Star&Stop, then register yours sessionReferenceProvider again.
    Jian

  • EJB call from one domain to another, authentication problem

    Two Weblogic servers. WLS A and WLS B. Different domains. Trust relationship between the domains can't be established.
    I have an EJB in WLS B and there is a Web Application deployed to WLS A. There are method-permission declarations in the EJB descriptor xml.
    Step 1. User authenticates to Servlet in Web Application (WLS A). Authentication is done with Http Basic Authentication.
    Step 2. Servlet makes a JNDI lookup to get a handle to the EJB. Handle can not be fetched with the authentication information which was provided by user to servlet. This means that I need to specify a different username and password, which should be used for authentication at WLS B.
    Step 3. After getting a handle to the EJB Servlet calls a method of the EJB.
    Everything seems extremely simple. And it should be. But no.
    At step 2 servlet propagates authentication information from WLS A to WLS B. This authentication information is valid only inside WLS A, not in WLS B. Result: SecurityException: Invalid Subject.
    Setting SECURITY_PRINCIPAL and SECURITY_CREDENTIALS to InitialContext while creating it still results in propagation of authentication information. Same exception.
    So I tried something else.
    Tthe code doing the JNDI lookups and EJB calls was wrapped inside Security.runAs(new Subject(), ....) -block. Authentication information is no longer propagated to WLS B. So JNDI lookup succeeds, excellent!
    But we only got one step further. Now we still need to make the call to EJB method at step 3.
    Now that EJB method call results in Security Violation: User: <anonymous> has insufficient permission to access my method.
    It's a bit strange, because username and password (for WLS B) were provided for InitialContext while creating it. If the password is invalid, the InitialContext can't be created. So it seems that atleast the username and password ARE checked at WLS B.
    Any help and/or suggestions would be highly appreciated.
    Here is a misc list of some misc wondering:
    -Step 2. Should we make the JNDI lookup to JNDI tree of WLS A instead of WLS B. If we do so, then we should use ejb-ref's at web.xml. This was also quickly tested with no results.
    -Would run-as-identity (or some similar element) help? Maybe we could set up some Credential Mapper to WLS A, which would provide username/password when making calls to EJB's of WLS B. Documentation about Credential Mappers seems to be quite useless.

    There was a time, and it was quite some time ago when something similar was tried and it didn't meet with much success. Sure, it may not have been Domain files, it may have been something more like, say, rocks, but the general principle still applies. If you look at the XML and media parts that make up a Domain file, you can think of those pieces as analogous to the atoms in your average run-of-the-mill rock. Though the atoms in two given average run-of-the-mill rocks may seem quite similar, and cracking them open reveals innards that are almost entirely, but not quite, the same, it's still quite difficult to make one whole rock out of the two.
    Now, some say alchemists might be able to accomplish this quite daunting task, but, until a study of use for Domain files (perhaps XMLchemy?) is initiated and studied most earnestly, we shall probably remain unable to bring about the union of one Domain file and another. Or were we talking about the rocks? (You can't melt Domain files, can you? The thought just hit me is all...)
    How's that for a long answer?

  • SWING GUI is getting hangged when ever i send a server call

    Hi,
    Can any one help me
    Using swings im making a server call i.e. to EJBs
    When ever im sending a server call GUI is getting hangged

    From your description it sounds like you are running some lenghty task on the event-dispatching thread. That will manifest itself as a hanging GUI. You can read more about it here:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

  • EJB lookup from another EJB server

    Hi people,
    I have two application servers on two different computers. One
    of them contains an EJB, which I need to access from another EJB
    server. I know that I can achieve this using RMI, but will then
    security and transaction contexts be propagated to the called
    EJB?
    Sincerely,
    Sergei Batiuk.

    Here is the solution posted on another forum:
    [email protected] Dec 8, 6:03 am show options
    Newsgroups: ibm.software.websphere.studio
    From: [email protected]
    Date: 8 Dec 2004 06:03:04 -0800
    Local: Wed, Dec 8 2004 6:03 am
    Subject: Re: EJB lookup on from one server to another does not work
    Eric,
    I dealt with this same problem trying to run 2 local servers (websphere
    test servers), using 2 separate WSAD 5.1.2 workspaces. Running on 1
    server I have an application that contains an EJB, and running on the
    other server is an application that uses an access bean to make a
    remote call to my EJB, running on my other server. I too repeately
    received the "NameNotFoundException" when trying to lookup my EJB home
    reference.
    What you have to do to get around this is to modify the server
    configuration of the application that contains the EJB that you are
    attempting to call remotely. You must open the the server.wsi file for
    the server that is running the EJB and go to the "Configuration" tab.
    You must check the "Enable administrative console". Once this is
    complete, start your server. When it is started, right click on the
    server, and select "run administrative console". In the admin console,
    select
    servers -> application servers -> <your server> -> end points ->
    bootstrap address. For "host" you must change "localhost" to either
    your ip address or computer name (ive only tried my ip, but your
    computer name should work too). When building your properties to get
    the initial context, make sure you use
    "env.put(Context.PROVIDER_URL, "corbaloc:iiop:<the ip or computer name
    listed as the bootstrap host of server running ejb>:<the port listed as
    the bootstrap port of server running ejb, which is 2809 in your case>
    Restart your server and things should work.

  • Weblogic EJB server and COM integration, help needed!

     

    Hi, but can I call COM from EJB?
    We tried J-Integra, it doesn't work. Do you know any other way to do it?
    thanks
    Charles
    "Damian Mehers" <[email protected]> wrote:
    You might want to take a look at the J-Integra pure Java-COM bridge which
    allows access to Java objects (including EJBs) running anywhere from COM
    clients such as VB.
    Doc: http://www.linar.com/jintegra/doc/
    Evaluation download: http://www.linar.com/
    Weblogic example:
    http://www.linar.com/jintegra/doc/javafromcom/weblogic.html
    Regards,
    Damian
    Damian Mehers.
    Linar Ltd. +44 (0)7050 669643 http://www.linar.com/
    J-Integra - the world's only pure Java-COM bridge
    "Pete" <[email protected]> wrote in message
    news:8dq5nc$eto$[email protected]..
    Hello all,
    I am soliciting opinions on how to implement this system:
    We have one portion of the system created, Java Client communicating with
    a Java server (EJB) running on Weblogic. There is another application inthe
    company that has expressed interest in using some of the logic containedin
    our
    servers, this application, however, is written in VB. I understand that
    Weblogic has a
    mechanism that will allow java programs to call COM functions. Is there a
    way to
    export a COM interface from a generic Java application? I was not able to
    find anything
    about that in the weblogic documentation, maybe I missed something?...
    As the VB app has no communication to our server as of yet, CORBA isanother
    option for us.
    I also know that Weblogic has CORBA support and we could port our
    communication mechanism
    to use that. I believe one would need to pay extra for that over and above
    their standard EJB server.
    The question then becomes, would we need any features of the EJB server?
    How does RMI-IIOP fit into this whole mess?
    Any opinions?
    Thanks for any tips,
    -Pete

  • Error while calling ejb service call from BPM service

    Hi,
    We are using the Oracle 11.1.1.5.0
    We are calling ejb service call from BPM service to update the data to Oracle database.
    We are getting the below error when we executing the ejb service call from BPM Service.
    <Error> <EJB> <BEA-010026> <Exception occurred du
    ring commit of transaction Name=[EJB oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliver
    yBean.handleCallback(java.lang.String,java.lang.String,java.lang.String,int,bool
    ean)],Xid=BEA1-45B91984D57960994897(30845116),Status=Rolled back. [Reason=javax.
    transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a p
    articipant in two-phase commit. To force this participation, set the GlobalTrans
    actionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhas
    eCommit for the Data Source = EBSConnection],numRepliesOwedMe=0,numRepliesOwedOt
    hers=0,seconds since begin=1,seconds left=60,XAServerResourceInfo[SOADataSource_
    base_domain]=(ServerResourceInfo[SOADataSource_base_domain]=(state=rolledback,as
    signed=soa_server1),xar=SOADataSource,re-Registered = false),XAServerResourceInf
    o[ArCnTaskForms@EBSConnection@EBSConnection_base_domain]=(ServerResourceInfo[ArC
    nTaskForms@EBSConnection@EBSConnection_base_domain]=(state=rolledback,assigned=s
    oa_server1),xar=weblogic.jdbc.wrapper.JTSEmulateXAResourceImpl@fa5476,re-Registe
    red = false),SCInfo[base_domain+soa_server1]=(state=rolledback),properties=({web
    logic.jdbc.remote.EBSConnection=t3://192.168.10.114:8001, weblogic.transaction.n
    ame=[EJB oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliveryBean.handleCallback(java.la
    ng.String,java.lang.String,java.lang.String,int,boolean)]}),local properties=({w
    eblogic.jdbc.jta.SOADataSource=[ No XAConnection is attached to this TxInfo ]}),
    OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=soa
    server1+192.168.10.114:8001+basedomain+t3+, XAResources={eis/tibjms/Queue, eis
    /activemq/Queue, WLStore_base_domain_BPMJMSFileStore, WLStore_base_domain__WLS_s
    oa_server1, eis/fioranomq/Topic, eis/jbossmq/Queue, eis/Apps/Apps, eis/websphere
    mq/Queue, eis/AQ/aqSample, WLStore_base_domain_SOAJMSFileStore, eis/aqjms/Queue,
    WSATGatewayRM_soa_server1_base_domain, eis/sunmq/Queue, eis/pramati/Queue, SSCo
    nnectionDS_base_domain, eis/tibjms/Topic, eis/tibjmsDirect/Queue, eis/wls/Queue,
    eis/tibjmsDirect/Topic, EDNDataSource_base_domain, eis/wls/Topic, eis/aqjms/Top
    ic, RL3TST_base_domain, ArCnTaskForms@EBSConnection@EBSConnection_base_domain, S
    OADataSource_base_domain, WLStore_base_domain_UMSJMSFileStore_auto_2},NonXAResou
    rces={})],CoordinatorURL=soa_server1+192.168.10.114:8001+base_domain+t3+): weblo
    gic.transaction.RollbackException: Could not prepare resource 'ArCnTaskForms@EBS
    Connection@EBSConnection_base_domain
    JDBC driver does not support XA, hence cannot be a participant in two-phase comm
    it. To force this participation, set the GlobalTransactionsProtocol attribute to
    LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source
    = EBSConnection
    at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
    TransactionImpl.java:1881)
    at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:345)
    at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:239)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocal
    Object.java:622)
    at weblogic.ejb.container.internal.BaseLocalObject.__WL_postInvokeTxRetr
    y(BaseLocalObject.java:455)
    at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(Sess
    ionLocalMethodInvoker.java:52)
    at oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliveryBean_of8dk6_ICubeDelivery
    LocalBeanImpl.handleCallback(Unknown Source)
    at com.collaxa.cube.engine.dispatch.message.instance.CallbackDeliveryMes
    sageHandler.handle(CallbackDeliveryMessageHandler.java:47)
    at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(Dispatc
    hHelper.java:140)
    at com.collaxa.cube.engine.dispatch.BaseDispatchTask.process(BaseDispatc
    hTask.java:88)
    at com.collaxa.cube.engine.dispatch.BaseDispatchTask.run(BaseDispatchTas
    k.java:64)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.transaction.xa.XAException: JDBC driver does not support XA, he
    nce cannot be a participant in two-phase commit. To force this participation, se
    t the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended)
    or EmulateTwoPhaseCommit for the Data Source = EBSConnection
    at weblogic.jdbc.wrapper.JTSXAResourceImpl.prepare(JTSXAResourceImpl.jav
    a:83)
    at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
    sourceInfo.java:1327)
    at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
    sourceInfo.java:513)
    at weblogic.transaction.internal.ServerSCInfo$1.run(ServerSCInfo.java:36
    8)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
    gWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    .>
    <12 Oct, 2012 12:34:40 PM IST> <Error> <oracle.soa.bpel.engine.dispatch> <BEA-00
    0000> <failed to handle message
    javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot
    be a participant in two-phase commit. To force this participation, set the Globa
    lTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateT
    woPhaseCommit for the Data Source = EBSConnection
    at weblogic.jdbc.wrapper.JTSXAResourceImpl.prepare(JTSXAResourceImpl.jav
    a:83)
    at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
    sourceInfo.java:1327)
    at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
    sourceInfo.java:513)
    at weblogic.transaction.internal.ServerSCInfo$1.run(ServerSCInfo.java:36
    8)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
    gWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    >
    <12 Oct, 2012 12:34:40 PM IST> <Error> <oracle.soa.bpel.engine.dispatch> <BEA-00
    0000> <Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    error while attempting to process the message "com.collaxa.cube.engine.dispatch.
    message.instance.CallbackDeliveryMessage"; the reported exception is: Error comm
    itting transaction:; nested exception is: javax.transaction.xa.XAException: JDBC
    driver does not support XA, hence cannot be a participant in two-phase commit.
    To force this participation, set the GlobalTransactionsProtocol attribute to Log
    gingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = EB
    SConnection
    This error contained an exception thrown by the message handler.
    Check the exception trace in the log (with logging level set to debug mode).
    ORABPEL-05002
    Message handle error.
    error while attempting to process the message "com.collaxa.cube.engine.dispatch.
    message.instance.CallbackDeliveryMessage"; the reported exception is: Error comm
    itting transaction:; nested exception is: javax.transaction.xa.XAException: JDBC
    driver does not support XA, hence cannot be a participant in two-phase commit.
    To force this participation, set the GlobalTransactionsProtocol attribute to Log
    gingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = EB
    SConnection
    This error contained an exception thrown by the message handler.
    Check the exception trace in the log (with logging level set to debug mode).
    at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(Dispatc
    hHelper.java:207)
    at com.collaxa.cube.engine.dispatch.BaseDispatchTask.process(BaseDispatc
    hTask.java:88)
    at com.collaxa.cube.engine.dispatch.BaseDispatchTask.run(BaseDispatchTas
    k.java:64)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:662)
    >
    Could any body help on this issue.It is little bit urgent for us to resolve.
    Thanks in advance.

    Thanks Sudipto Desmukh,
    The link is helpful me to resolve this issue.
    Thanks,
    Narasimha E

  • Change a UI text field from within a Thread

    My program has a thread that's busy churning away. It's a runnable called from within my classes main. The UI element is built by a method in the class.
    If I try to report something from within the thread by doing a myText.setText("success"); I get a crash:
    Exception in thread "Thread-1" org.eclipse.swt.SWTException: Invalid thread access
    followed by a bunch of SWT.error messages related to that line. The field myText is defined globally for the class.
    What is a good way to be able to write stuff to a UI from within a thread? I could do it when the extended Thread was defined within my main() by creating a runnable also in my main() that got called through a syncExec. But I want to keep the main simple.

    edit Noticed you're working with SWT
    #

Maybe you are looking for