On 11/30/2015 12:33 PM, Christian Schneider wrote:
No idea why the namespace handler does not seem to be present.

You can look through the bundles with la -s and check if the transaction blueprint 2.0.0 bundle is present.

karaf@root()> la -s | grep transaction

 31 | Active   |  80 | 1.2                     | javax.transaction-api

 59 | Active   |  80 | 1.1.1                   | 
org.apache.aries.transaction.blueprint

 60 | Active   |  80 | 2.0.0                   | 
org.apache.aries.transaction.blueprint

 61 | Active   |  80 | 1.3.0                   | 
org.apache.aries.transaction.manager


You can then do bundle:service -p <id> to see which services it offers. It should offer the correct blueprint namespace handler.

karaf@root()> bundle:services -p 60

Apache Aries Transaction Blueprint (60) provides:

-------------------------------------------------

objectClass = [org.osgi.service.blueprint.container.BlueprintContainer]

osgi.blueprint.container.symbolicname = org.apache.aries.transaction.blueprint

osgi.blueprint.container.version = 2.0.0

service.bundleid = 60

service.id = 201

service.scope = singleton

----

objectClass = [org.apache.aries.blueprint.NamespaceHandler]

osgi.service.blueprint.compname = nsHandler

osgi.service.blueprint.namespace = 
http://aries.apache.org/xmlns/transactions/v2.0.0

service.bundleid = 60

service.id = 273

service.scope = bundle


That all looks good.

If just the EntityManager is missing then maybe the DataSource is not present or the persistence unit bundle is not correctly identified. You should see in the log if a persistence unit is found in a bundle and what it is waiting for.

I am deploying the datasource as a bundle & seems to be registered fine:

karaf@root()> service:list javax.sql.DataSource

[javax.sql.DataSource]

----------------------

 osgi.jndi.service.name = hearsayNoJTA

 osgi.service.blueprint.compname = hearsay-ds-no-jta

 service.bundleid = 268

 service.id = 269

 service.scope = bundle

Provided by :

 Hearsay :: Datasource (268)

[javax.sql.DataSource]

----------------------

 osgi.jndi.service.name = hearsayJTA

 osgi.service.blueprint.compname = hearsay-ds-jta

 service.bundleid = 268

 service.id = 270

 service.scope = bundle

Provided by :

 Hearsay :: Datasource (268)


The persistence.xml file has the following:

  <persistence-unit name="hearsay" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=hearsayJTA)</jta-data-source>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=hearsayNoJTA)</non-jta-data-source>


I think this configuration all lines up, so I am leaning towards the "persistence unit bundle is not correctly identified" idea. The dao impl bundle finally fails with the following exception:

2015-11-30 12:25:48,287 | ERROR | rint Extender: 2 | BlueprintContainerImpl         
  | 39 - org.apache.aries.blueprint.core - 1.4.5 | Unable to start blueprint 
container for bundle hearsay-dao-jpa/0.0.46.SNAPSHOT due to unresolved dependencies 
[(&(osgi.unit.name=hearsay)(objectClass=javax.persistence.EntityManager))]

java.util.concurrent.TimeoutException

    at 
org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:343)[39:org.apache.aries.blueprint.core:1.4.5]

    at 
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[39:org.apache.aries.blueprint.core:1.4.5]


Is there something else I should be looking for?

Thanks,
Jason

Reply via email to