You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "munishgupta.asr" <mu...@gmail.com> on 2019/01/02 13:45:15 UTC
DB transaction failure with KARAF 4.2.0 (injecting entity manager
through blueprint)
Hi All,
after KARAF upgrade to 4.2.0, for our DBManager bundle, I am facing this
exception.
java.lang.IllegalStateException: Need active coordination
at
org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:81)
~[?:?]
at org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38)
~[?:?]
at com.sun.proxy.$Proxy62.createQuery(Unknown Source) ~[?:?]
at Proxy8d7fb7c9_9f56_4f0b_b369_f8f7bec85215.createQuery(Unknown Source)
~[?:?]
at
com.good.server.docs.managerdb.actors.DataStoreConfigurationImpl.fetch(DataStoreConfigurationImpl.java:39)
~[289:com.good.server.docs:1.5.3.SNAPSHOT]
Earlier with KARAF 3.0.0, Our bluePrint.xml file was like this (injecting
entity manager)
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
<bean id="dataStoreConfiguration"
class="com.good.server.docs.managerdb.actors.DataStoreConfigurationImpl">
<jpa:context unitname="DataStoreRecord" property="entityManager"/>
<tx:transaction method="*" value="Required"/>
</bean>
</blueprint>
)
After ugprade, I realised that nameSpaceHandler version (1.0.0) of JPA is no
more supported and i changed the versions. based on some old posts here in
forums, I removed <Jpa:context> and <tx:transaction> tags and changed it to
<jpa:enable /> and <tx:enable /> and kept is outside the bean definitions.
now my blueprint looks like this.
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v2.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
<jpa:enable />
<tx:enable />
</blueprint>
now my bundles are coming up, but during transaction it throws the exception
as mentioned above.
Can you please suggest something to unblock me?
Regards
Munish
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: DB transaction failure with KARAF 4.2.0 (injecting entity
manager through blueprint)
Posted by "munishgupta.asr" <mu...@gmail.com>.
Hi JB,
Thanks for giving pointers. I tried it and now my DB connectivity is working
fine. it is able to locate datasource and doing database transactions
properly.
But I have issues with few of the tables where model class is having
classname different than tablename.
example
@Entity
@Table(name = "ConfigParameters")
public class parameter{
}
it is working fine where model classname and tablename is same.
example
@Entity
@Table(name = "ConfigParameter")
public class ConfigParameter{
}
Same code was working fine earlier with openJpa 2.4.2 and KARAF 3.X.
Can you please suggest?
Regards
Munish
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: DB transaction failure with KARAF 4.2.0 (injecting entity manager
through blueprint)
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
yes this one.
Regards
JB
On 03/01/2019 04:18, munishgupta.asr wrote:
> Hi JB,
>
> Which example exactly I should refer. I was trying with this one.
>
> https://github.com/apache/karaf/tree/master/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa
>
> Are you talking about the same?
>
> Regards
> Munish
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: DB transaction failure with KARAF 4.2.0 (injecting entity
manager through blueprint)
Posted by "munishgupta.asr" <mu...@gmail.com>.
Hi JB,
Which example exactly I should refer. I was trying with this one.
https://github.com/apache/karaf/tree/master/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa
Are you talking about the same?
Regards
Munish
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: DB transaction failure with KARAF 4.2.0 (injecting entity manager
through blueprint)
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
What features did you install ?
The provided example works fine in Karaf, so a feature is probably
missing in your case.
Regards
JB
On 02/01/2019 14:45, munishgupta.asr wrote:
> Hi All,
>
> after KARAF upgrade to 4.2.0, for our DBManager bundle, I am facing this
> exception.
>
> java.lang.IllegalStateException: Need active coordination
> at
> org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:81)
> ~[?:?]
> at org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38)
> ~[?:?]
> at com.sun.proxy.$Proxy62.createQuery(Unknown Source) ~[?:?]
> at Proxy8d7fb7c9_9f56_4f0b_b369_f8f7bec85215.createQuery(Unknown Source)
> ~[?:?]
> at
> com.good.server.docs.managerdb.actors.DataStoreConfigurationImpl.fetch(DataStoreConfigurationImpl.java:39)
> ~[289:com.good.server.docs:1.5.3.SNAPSHOT]
>
> Earlier with KARAF 3.0.0, Our bluePrint.xml file was like this (injecting
> entity manager)
> <blueprint default-activation="eager"
> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
> <bean id="dataStoreConfiguration"
>
> class="com.good.server.docs.managerdb.actors.DataStoreConfigurationImpl">
> <jpa:context unitname="DataStoreRecord" property="entityManager"/>
> <tx:transaction method="*" value="Required"/>
> </bean>
> </blueprint>
> )
> After ugprade, I realised that nameSpaceHandler version (1.0.0) of JPA is no
> more supported and i changed the versions. based on some old posts here in
> forums, I removed <Jpa:context> and <tx:transaction> tags and changed it to
> <jpa:enable /> and <tx:enable /> and kept is outside the bean definitions.
> now my blueprint looks like this.
>
> <blueprint default-activation="eager"
> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0"
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v2.0.0"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
>
> <jpa:enable />
> <tx:enable />
> </blueprint>
>
> now my bundles are coming up, but during transaction it throws the exception
> as mentioned above.
> Can you please suggest something to unblock me?
>
> Regards
> Munish
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com