Skip to main content
Siva_Sogalapalli
Community Advisor
Community Advisor
Oct 13, 2017 7:44 AM UTC
Solved

Maven dependencies for Transaction & OSGiUtils

Hi All,

I'm following below forms resource and referring PDF Generator Service section on the page.

AEM 6.2 Forms Help | Using AEM Document Services Programmatically

I see the below piece of code. But I couldn't find package names/dependencies for Transaction & OSGiUtils class. 

Transaction tx = OSGiUtils.getTransactionManager().getTransaction();

    // Begin transaction

    if (tx == null)

        OSGiUtils.getTransactionManager().begin();

Please advise.

Thanks

Siva

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Oct 17, 2017 7:33 PM UTC

Here is the information i got back from ENG.

OSGIUtils is an internal class which is not exposed but Transaction manager is a public java class which can be imported directly. It can be used directly and no forms dependency should be required for the same.

Transaction tx = OSGiUtils.getTransactionManager().getTransaction();

    // Begin transaction

    if (tx == null)

    OSGiUtils.getTransactionManager().begin();

Should be changed to

import javax.transaction.TransactionManager;

import javax.transaction.Transaction;

TransactionManager tmx = new TransactionManager();

Transaction tx = tmx.getTransaction();

    // Begin transaction

    if (tx == null)

    tmx.begin();

15 replies

smacdonald2008
Level 10
Oct 16, 2017 7:01 PM UTC

Looks like this JAR does not expose this API either.

Translate
smacdonald2008
Level 10
Oct 16, 2017 7:05 PM UTC

This looks like the POM dep for this API:

<!-- https://mvnrepository.com/artifact/javax.transaction/transaction-api -->

<dependency>

    <groupId>javax.transaction</groupId>

    <artifactId>transaction-api</artifactId>

    <version>1.1-rev-1</version>

    <scope>provided</scope>

</dependency>

https://mvnrepository.com/artifact/javax.transaction/transaction-api/1.1-rev-1

It would have been much easier if the PDF Gen code example showed all import statements as we do in HELPX articles.

Translate
vaibhavs7024655
Level 3
Oct 17, 2017 3:10 PM UTC

This is a Livecycle internal api for which the fully qualifed package is: com.adobe.aemds.bedrock.internal.OSGiUtils

​But not sure if it is a part of Uber jar or not.

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Oct 17, 2017 7:33 PM UTC

Here is the information i got back from ENG.

OSGIUtils is an internal class which is not exposed but Transaction manager is a public java class which can be imported directly. It can be used directly and no forms dependency should be required for the same.

Transaction tx = OSGiUtils.getTransactionManager().getTransaction();

    // Begin transaction

    if (tx == null)

    OSGiUtils.getTransactionManager().begin();

Should be changed to

import javax.transaction.TransactionManager;

import javax.transaction.Transaction;

TransactionManager tmx = new TransactionManager();

Transaction tx = tmx.getTransaction();

    // Begin transaction

    if (tx == null)

    tmx.begin();

Translate
Oct 24, 2019 10:32 PM UTC

Is this issue ever resolved? I tried this piece of code

import javax.transaction.TransactionManager;

import javax.transaction.Transaction;

TransactionManager tmx = new TransactionManager();Maven dependencies for Transaction &amp; OSGiUtils​

Transaction tx = tmx.getTransaction();

    // Begin transaction

    if (tx == null)

    tmx.begin();

Still there is error saying, Cannot instantiate the type TransactionManager

Translate