Transaction propagation via plain Java classes?

          Hello,
          I have a question on transaction propagation in the following scenario:
          1. a method of EJB1 with setting "Required" is invoked.
          2. the method creates a plain Java class and invokes a method of the class
          3. the class's method invokes a method of EJB2 with setting "Required".
          Is my understanding of EJB spec correct, when I assume that the transaction created
          when the first EJB method was called will be propagated through the plain Java
          class (supposedly via association with current thread), so the second EJB will
          participate in the same transaction?
          Thank you in advance,
          Sergey
          

Yup, current transaction is associated with the current thread.
          Sergey <[email protected]> wrote:
          > Hello,
          > I have a question on transaction propagation in the following scenario:
          > 1. a method of EJB1 with setting "Required" is invoked.
          > 2. the method creates a plain Java class and invokes a method of the class
          > 3. the class's method invokes a method of EJB2 with setting "Required".
          > Is my understanding of EJB spec correct, when I assume that the transaction created
          > when the first EJB method was called will be propagated through the plain Java
          > class (supposedly via association with current thread), so the second EJB will
          > participate in the same transaction?
          > Thank you in advance,
          > Sergey
          Dimitri
          

Similar Messages

  • Running a plain java class in command prompt which uses third party jars

    i have to run a simple java class. its actually a process which is running in the background. Now to run this java file i have created a batch file. my problem is that this java file uses around 100 jar files. when i try to run this java file (actually .class file) it gives me no class defination found error for this java(class) file. What can be the problem. My java home is set....how to solve this problem

    i have to run a simple java class
    my problem is that this java file uses around 100 jar filesThese two statements are contradictory.
    it gives me no class defination found error for this java(class) file. What can be the problemThe class is not on the classpath.
    how to solve this problemEnsure all classes are on the classpath.
    I bet if your searched this forum (or even read the java tutorial) you'd find something .

  • Connecting to an Https Server via a Java class.

    I have written a class that needs to make an HTTPS connection
    to a Server.(Servlet called Receive_Https_Data).
    For a test purpose I configured Tomcat with SSL,created a server
    certificate,and imported this certificate in the jre/lib/security file,
    so that we trick the client(ie the Java class) into accepting this certificate.
    So now when I make an https connection from the Java class
    ,I send some data to this servlet and receive a response.
    This works fine.
    Now I need to send data over https to a Server which has a valid certificate
    issued by a CA.
    Now,how do I make my Java Class Client accept this certificate?
    How do I import a valid certificate in the jre/lib/security file?
    I am not a browser but a Java class.? Has anyone understood my question?
    Attached is my Java class where in I am connecting to a dummy servlet over
    https:
    I am using jdk1.3 and Tomcat 3.2.4.
    public class HttpsSender
    private static String sURL="localhost";
    This method is uses https to transfer data securely.
    public static String ec(String sMess)
    String response=null;
    try {
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
    URL url;
    String uri = "https://" + sURL + ":8443/DUMMYSERVLET/servlet/Recieve_Https_Data";
    url = new URL(uri);
    HttpsURLConnection hpCon=null;
    try {
    KeyManager[] km = null;
    TrustManager[] tm = {new RelaxedX509TrustManager()};
    SSLContext sslContext = SSLContext.getInstance("SSL");
    sslContext.init(null, tm, new java.security.SecureRandom());
    SSLSocketFactory sslSF = sslContext.getSocketFactory();
    hpCon = (HttpsURLConnection)url.openConnection();
    hpCon.setSSLSocketFactory(sslSF);
    }catch(Exception e){}
    hpCon.setRequestMethod("POST");
    hpCon.setDoOutput(true);
    hpCon.setDoInput(true);
    /** Transfer Data over https */
    DataOutputStream dos = new DataOutputStream(hpCon.getOutputStream());
    dos.writeUTF(sMess);
    /* Response from the Https Servlet.*/
    DataInputStream dis = new DataInputStream(hpCon.getInputStream());
    try {
    response = dis.readUTF();
    }finally
    dos.close();
    dis.close();
    }catch(IOException e)
    System.out.println("Error in Client " + e);
    return response;
    } // End of Method Encrypt.

    hey i have same problem , cud u figure out how to solve this???

  • Any difference in creating a web service from a java class or session bean?

    Hi,
    The JDeveloper tutorial at http://www.oracle.com/technology/obe/obe1013jdev/10131/devdepandmanagingws/devdepandmanagingws.htm demonstrates creating a web service from a plain java class. I'm wondering:
    - Is it possible to create a web service from a stateless session bean instead of a java class? If so, what's the proper way to do this in JDeveloper? When I tried doing so in JDeveloper 10.1.3.0.4 (SU5) using the J2EE Web Service wizard, the wizard did not list the session bean in the Component To Publish dropdown (it does list any java classes available in the project). I can proceed by manually typing in the name of the session bean. After the wizard completes though, the @Stateless annotation that had been in my session bean class code is removed and replaced by a @WebService annotation. The end result is that it looks like it made no difference whether I had tried to create the web service from a session bean or plain java class as the annotations in the resulting web service code are the same (although if I had started from a session bean, the class for the web service still implements the Local/Remote EJB interface that the session bean originally implemented).
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean? I'm creating the web service from scratch so I also need to either build the java class or stateless session bean the web service would be based on from scratch too.
    Thanks for any ideas about this.

    Hi,
    EJB Session beans (EJB 3.0) are deployed as WebServices by annotating the class with @WebService and the methds with @WebMethod (both tags require you to add the JSR-181 library to your project (available in the JDeveloper list of libraries)). Unlike the J2E WebService, the EJB session bean service is turned into a WebService upon deployment. This means you obtain teh WSDL file after deployment
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean?
    The difference is that EJB Session bean based web services are integrated with the J2EE container, which means that they can leverage container services like transaction handling, data sources, security, JMS etc.
    Frank

  • Bean works slow than a Java class

    Hi,
    I am trying to zip a file using beans that gets the parameters from jsp. I tried the same block of code as a Plain java class it does the zip action very fast but the same code when executed with bean does the zip action very slow, can some body tell what would be the problem.
    thanks.

    With other words, the network speed/bandwidth is the bottleneck.
    A decent HDD can reach 70MB/s. A 10Mbit network won't go any faster than 10MB/s. Upgrade to 100Mbit, 1Gbit or optic fiber.

  • Running Java classes via .cmd files

    Hi. I've a few Java classes which need to be executed every so often. I've wrote a .cmd file:
    G:
    cd G:\j2sdk1.4.2\bin
    java utils.verifier
    When it executes it successfully runs the java class but I want the cmd window to stay open? becuase when the cmd file finishes runnning it closes the window. How do I make it stay open? Could I slightly modify my verifier class to request some input, so it keeps the window open?Thanks

    Alternatively, you can tweak the cmd rather than pausing it.
    Check cmd/? for more info, I believe it was /K option

  • How to compile a java class via SQL?

    Hello,
    What is the pl/sql command-line syntax for compiling a java class uploaded to the database?
    I'm looking for a command i can use to compile some java code manually similar to:
    ALTER TRIGGER SCHEMA.TRG_MYTRIGGER COMPILE;
    Thanks

    could try dynamic code generation, cglib, asm, eg
    http://68.142.231.85/myresults/mycache?u=http%3A%2F%2F
    www2.sys-con.com%2FITSG%2Fvirtualcd%2FJava%2Farchives%
    2F0702%2Frichards&docid=FToU9dUOIw4HRHa%2F26Zi5Q&.intl
    =us&.done=http%3A%2F%2Fmyweb.yahoo.com%2Fmyweb%3Fei%3D
    UTF-8%26tag%3Dcode%2Bgenerationhmmmm, yes, bytecode generation is so much simpler, isn't it :-)

  • Business logic in a Java Class

    Hi,
    In case of RPC web services why it is necessary to have a stateless
    session bean ? can i have a simple java class instead ?
    thanks and regards
    Vedant

    Hi Vedant,
    WLS 6.1 does not currently support using POJOs (Plain Old Java Objects) as a service
    implementation. I think the reasoning behind this was that WebLogic Web Services
    where designed to "complement" Web Services technology, using "stateless" J2EE
    components and J2EE packaging (i.e. war file, ear file). Seeing as the principle
    network protocol for them (the web services' technologies) is HTTP, which is inturn
    stateless ;-) There's also the factor that J2EE provides enterprise-level capabilities
    (i.e. scalability, transactions, failover, clustering, etc.), that just aren't
    there with a POJO. To me, this is a bit different than the approach being taken
    with Java-based SOAP implementations, like Apache SOAP, that support using POJOs,
    but don't take into consideration the "enterprise-level" aspects (or architectual
    needs/best practices) for Web Services. If you think about the following requirements
    for a given SOAP service, you'll see how using "lightweight" J2EE components has
    merit 1) will be called thousands of times per second, and 2) must have <3 sec
    avg response time, and 3) must have 99.9% uptime/availablity, and 3) must transparently
    failover to another instance of the SOAP service on failure.
    Regards,
    Mike Wooten
    "Vedant" <[email protected]> wrote:
    Hi,
    In case of RPC web services why it is necessary to have a stateless
    session bean ? can i have a simple java class instead ?
    thanks and regards
    Vedant

  • Difference b/w Java Class and Bean class

    hi,
    can anybody please tell me the clear difference between ordinary java class and java Bean class. i know that bean is also a java class but i donno the exact difference between the both.
    can anybody please do help me in understanding the concept behind the bean class.
    Thank u in advance.
    Regards,
    Fazlina

    While researching this question, I came across this answer by Kim Fowler. I think it explains it better than any other answer I have seen in the forum.
    Many thanks Kim
    Hi
    Luckily in the java world the definition of components is a little
    less severe than when using COM (I also have, and still occasionaly
    do, worked in the COM world)
    Firstly there are two definitions that need to be clarified and
    separated: JavaBean and EnterpriseJavaBean (EJB)
    EJB are the high end, enterprise level, support for distributed
    component architectures. They are roughly equivalent to the use of MTS
    components in the COM/ COM+ world. They can only run within an EJB
    server and provide support, via the server, for functionality such as
    object pooling, scalability, security, transactions etc. In order to
    hook into this ability EJB have sets of interfaces that they are
    required to support
    JavaBeans are standard Java Classes that follow a set of rules:
    a) Hava a public, no argument constructor
    b) follow a naming patterns such that all accessor and modifier
    functions begin with set/ get or is, e.g.
    public void setAge( int x)
    public int getAge()
    The system can then use a mechanism known as 'reflection/
    introspection' to determine the properties of a JavaBean, literally
    interacting with the class file to find its method and constructor
    signatures, in the example above the JavaBean would end with a single
    property named 'age' and of type 'int' The system simply drops the
    'set' 'get' or 'is' prefix, switches the first letter to lower case
    and deduces the property type via the method definition.
    Event support is handled in a similar manner, the system looks for
    methods similar to
    addFredListener(...)
    addXXXListener
    means the JavaBean supports Fred and XXX events, this information is
    particularly useful for Visual builder tools
    In addition there is the abiliity to define a "BeanInfo' class that
    explicitly defines the above information giving the capability to hide
    methods, change names etc. this can also be used in the case where you
    cannot, for one reason or another, use the naming patterns.
    Finally the JavaBean can optionally - though usually does - support
    the Serializable interface to allow persistence of state.
    As well as standard application programming, JavaBeans are regularly
    used in the interaction between Servlets and JSP giving the java
    developer the ability to ceate ojbect using standard java whilst the
    JSP developer can potentially use JSP markup tags to interact in a
    more property based mechanism. EJB are heaviliy used in Enterprise
    application to allow the robust distribution of process
    HTH.
    Kim

  • JTA transaction propagation

              Can I just confirm that if a method in an EJB has a JTA transactional context specified
              by container-managed transaction demarcation, then the transaction context will be
              propagated to any method that it calls in any other Java class. I just wanted to
              be sure because we have all our SQL handling in separate Data Access classes whose
              methods are called from the EJBs.
              Thanks
              

    Yes. Make sure that you are using a Transactional DataSource or the WebLogic JTS Driver to
              access the connection pool...
              Dave wrote:
              > Can I just confirm that if a method in an EJB has a JTA transactional context specified
              > by container-managed transaction demarcation, then the transaction context will be
              > propagated to any method that it calls in any other Java class. I just wanted to
              > be sure because we have all our SQL handling in separate Data Access classes whose
              > methods are called from the EJBs.
              > Thanks
              

  • How to get all permissions on server level and project collection level via tfs java sdk?

    i need to list project-collection level's permission and project level's permission on my project. now i have connected to tfs and i have got project collection list and user list via tfs java sdk. but i can't find the way to get the permission name list
    and permission list. how can i do to get that?
    i have checked the database, and find that the actions have some discrepancies with the tbl_securityaction'data.
    Can anyone give me some advice on that?
    davy

    David, Thanks for your reply.
    I have test the code above, but still get error. here is my code:
    final TFSTeamProjectCollection tpc = SnippetSettings.connectToTFS();
    final DefaultClientFactory factory = new DefaultClientFactory();
    final IIdentityManagementService2 ims = (IIdentityManagementService2)factory.newClient(IIdentityManagementService2.class, tpc);
    final String scopeId = null;
    final String[] propertyNameFilters = null;
    TeamFoundationIdentity[] appGroups = ims.listApplicationGroups(scopeId, ReadIdentityOptions.EXTENDED_PROPERTIES, propertyNameFilters, IdentityPropertyScope.BOTH);
    error message:
    java.lang.NullPointerException
    at com.microsoft.tfs.core.clients.webservices.IdentityManagementService2.listApplicationGroups(IdentityManagementService2.java:92).
    davy

  • Problem with cfobject calling java class

    hi there,
    i have a small java class that takes 2 arguments in
    (fileToRead & fileToWrite) and everything runs fine when i run
    the class from the command line...
    C:\>java csvParser fileToRead fileToWrite
    however when i try to instantiate the class via cfobject like
    so :
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.init(#tmpfile#, "text.xml")>
    it continuously throws the following error at me :
    Unable to find a constructor for class csvParser that accepts
    parameters of type ( java.lang.String, java.lang.String ).
    any ideas ast to what i may be missing here...startin to
    drive me batty.

    C:\>java csvParser fileToRead fileToWrite
    Suggests you passed arguments as args[0] and args[1] to the
    method
    public static void main(String[] args)
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.init(#tmpfile#, "text.xml")>
    Suggests the code for the class CSVParser has the following
    constructor definition:
    private String s1, s2;
    CSVParser (String s1, String s2) {
    this.s1=s1;
    this.s2=s2;
    This seems unlikely, in view of
    "everything runs fine when i run the class from the command
    line". One possibility is to convert the
    public static void main method into, for example, the public
    method
    doThemFiles(String s1, String s2), not forgetting to include
    the return-type in its signature. You could then run
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.doThemFiles("#tmpfile#", "text.xml")>

  • Facing problem to Use a custom Java class in UCCX

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin-top:0in;
    mso-para-margin-right:0in;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0in;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
    Hi,
    We are using Communication manager 7.0.1 and UCCX version 7.0.1(Cisco Unified CCX Premium).  We are trying to call a Custom Java class file from UCCX scripting. We have followed the steps mentioned in the guide (How-To: Using a custom Java class in UCCX 5.x (SOAP Example)). See below link.
    http://www.avholloway.com/vtools/ipcc/custom-java/soap/
    After completed all the steps we have got the variable type SimpleSOAP at script but we did not found it to object constructors or object attributes (plz find the attached screenshots). We will appreciate if you plz guide us to solve the issue.
    Thanks
    Fakhrul
    LEADS Corporation Ltd.

    Hello, Fakhrul.
    I'm sorry to see you were not able to find the information or help you were looking for here in the Contact Center community forum.
    You may be able to find more help through the Cisco Developer Network.
    Also, you might want to consider engaging Cisco Advanced Services via your account team to assist with UCCX custom scripting.
    Thank you, and good luck.
    -Paulo

  • Error Invoking Java class from Stored proc

    We are getting this error while calling a stored procedure that invokes a
    static function of a java class from inside Oracle 8.1.7.
    ORA-29516: Aurora assertion failure: Java thread deadlock detected
    ORA-06512: at "APPS.SERVICECONSUMERINVOKE", line 0
    ORA-06512: at line 40
    In a Toad SQL Window, when I execute the stored procedure that invokes the
    java function, it executes successfully on the first attempt. When I try to
    execute it again on the same SQL Window, it gives the above error. The java
    class is part of a package and indirectly makes a JMS request-reply call
    via other helper classes.
    The same package works fine from other web containers and
    unlike the Oracle JVM Aurora, the JVMs don't detect a deadlock.
    Why does the Aurora throw an error?

    Did you try issusing a commit and then trying again in Toad SQL Window?
    The advice is to contact support:
    ORA-29516: Aurora assertion failure: string
    Cause: An internal error occurred in the Aurora module.
    Action: Contact Oracle Worldwide Support.

  • Alert message from java class

    I have a java class (event handler) that does some server-side processing. During the mid-way of processing, I do a condition
    check. If it fails the condition, I would like to pop up an alert message (yes/no confirm) on the JSP that invoked this handler class. If I click, yes I should be able to proceed with the rest of server-side processing, else I return to the same jsp. Can somebody guide me with this java and javascript interation?

    If the server processing involved only in data processing in DBMS you can do something like this.
    Your processing places all the messages that need to be displayded in a queue.
    The messages can be in three types
    1 - Error Message - (Enqueuing a error message should also result in an exception)
    2 - Alert message (Messages to be displayed with only a OK button)
    3 - Confirmation button (Yes/No, Ok/Cancel)
    after the server processing is orver the client read the content in the message queue and display them appropriatly.
    if it found a error message in the queue it should abort the transaction by executing a rollback
    if it found a alert message just display it
    If it found a confirmation message it should be displayed the transaction should be rolled back or commited based on the users respond
    if the user decided to rollback in such cases rest of the messages should be ignored.
    Above approach can be used only if you can rollback the entire operation at the end of it

Maybe you are looking for

  • Accounts Payable Rapid Mart Performance Issue

    We are currently running the SAP AP Rapid Mart 3.2 and facing a performance issue on the SAP side for the data flows: DF_VendFinDocFactOpenDelta_SAP and DF_VendFinDocFactClearDelta_SAP.  These data flows pull from the same tables and one of them bein

  • ADAPTER.SOAP_EXCEPTION : soap fault: No such operation

    Hi Experts, I have done File to Webservice scenario. When I am trying to execute the scenario I am getting the following error. <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnd

  • Report for Location Product hierachy creation

    Anyone knows a report which can automate the location product hierarchy? (Assuming Location hierarchy and product hierarchy exists). The screen where I could maintain the hierarchy do have the generation capability.  We are looking for similar featur

  • Missing license keys in adminui.  Has anyone experienced this before?

    We have recently installed LiveCycle server into our Test environment.  However, for some reason when we go Home > About, no licenses show up.  We do not experience this in our other env (DEV, APOC) where liveCycle was installed.  Here is a screensho

  • Create ms document for schema via exisitng db table

    Hi Is there a way to create a docuemtation (MS word table ) for my db table? We have table created in the db & the management wants some kind of doc in MS Word format to describe the schema. What will be the best way to do this? Also is there a way t