[ 
https://issues.apache.org/jira/browse/OPENJPA-2052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13733635#comment-13733635
 ] 

Scott Parkerson commented on OPENJPA-2052:
------------------------------------------

I also use Aries Transaction Support, and the problem is that the AuditCallback 
never ever gets created in the first place. I just traced this out using 
OpenJPA 2.2.2, Karaf 2.3.0, and Aries 1.0.0. The problem is that with the 
container-based transaction manager, only the "beforeCommit()" method is 
getting called in the AuditManager. This code checks for the existence of the 
callback, which, had afterBegin() ever been called, it would have created one. 
As such, 

                        AuditCallback cb = _saved.get(event.getSource());

returns null, and thus the audit() callback method never gets called in the 
first place.

FWIW, Classloading is not the issue, because I'm using the default AuditLogger, 
which is provided by OpenJPA. Also, OSGi Classloading hasn't been a problem for 
us with OpenJPA in the past, as we are using our own UpdateManager plugin, 
which is loaded the same way that the AuditPlugin would be loaded, which works 
(although you do have to supply the appropriate Export-Package OSGi metadata 
for the package that contains your plugin).
                
> New audit log functionality does not work in OSGi
> -------------------------------------------------
>
>                 Key: OPENJPA-2052
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2052
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: osgi
>            Reporter: Bengt Rodehav
>
> The new audit functionality is not yet part of a released version of OpenJPA. 
> I've been testing 2.2.0-SNAPSHOT.
> I've tested the Auditor functionality using normal (non-OSGi) unit tests and 
> so far it seems to work. However, when trying the same functionality in OSGi 
> (Karaf/Felix and also Felix using Pax-Exam), OpenJPA fails to find my Auditor 
> class. Timothy Ward (on the Aries mailing list) suggested that it seems like 
> OpenJPA is using its own class loader to load my Auditor class (which of 
> course will not work). OpenJPA needs to use the class loader of the bundle 
> containing the persistence.xml to load my Auditor class. I also believe this 
> is the problem.
> This has been discussed on both Aries and OpenJPA's mailing list:
> http://openjpa.208410.n2.nabble.com/Auditor-and-OSGi-td6759170.html#a6769605
> http://www.mail-archive.com/[email protected]/msg00320.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to