[deepamehta-devel] Question about "org.neo4j.graphdb.NotInTransactionException" when creating TopicType

Jörg Richter jri at deepamehta.de
Fri Sep 12 21:39:21 CEST 2014


Hi Martin,

On Sep 12, 2014, at 19:08, Martin Tippmann wrote:

> SEVERE: Handling PLUGIN_ACTIVATED event from "de.deepamehta.webbrowser" for plugin "Freifunk API Data" failed
> java.lang.RuntimeException: Activation of plugin "Freifunk API Data" failed
> [...]
> Caused by: org.neo4j.graphdb.NotInTransactionException
> [...]

Indeed transaction handling in DM 4.4-SNAPSHOT has changed against DM 4.3. The Core Service methods (as invoked e.g. via the dms object) do not create their own transaction anymore.

If your code is invoked via a resource method (= invoked via a HTTP request), be it directly or indirectly, just annotate the resource method with @Transactional. This will create a transaction on a per-request basis.

However, if your code is NOT invoked via a HTTP request -- e.g. when you are in a migration or in a test -- you must create the transaction manually, as Malte mentioned. That is, ONE transaction wrapping your entire migration (resp. test) code. Hint: calling tx.failure() is not necessary.

This ticket (and its comments) explain the new transaction handling of upcoming DM 4.4.:
https://trac.deepamehta.de/ticket/698

DM 4.4 will contain considerable API changes against DM 4.3. You possibly will have less adaption work when jumping on the 4.4-SNAPSHOT train right now (master branch).

Cheers,
Jörg



More information about the devel mailing list