You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by ellirael <el...@mail.ru> on 2015/05/18 15:29:11 UTC
Problem with JPA,JNDI after installing CXF feature
After installing CXF feature I met some problem with datasource recognition
from bundle that uses JPA and registers servet.
javax.naming.NoInitialContextException: Unable to find the
InitialContextFactory org.eclipse.jetty.jndi.InitialContextFactory.
at
org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:148)
at
org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at
org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:64)
at
org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
at
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
The same DataSource works nice when I inject dao service that uses the same
datasource in my command bundle. After command invocation servlets starts to
work properly.
The problem seems to occur for JPA bundles only. There is some sort of
InitialContextFactory replacement.
--
View this message in context: http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Problem with JPA,JNDI after installing CXF feature
Posted by jb...@nanthrax.net.
It could be interesting to check if installing the CXF feature doesn't
install a new JNDI ContextFactory that cross the jndi feature one.
I will check as soon as I have some time.
Regards
JB
On 2015-05-27 22:46, Christian Schneider wrote:
> Can you post your code somewhere? I would be especially interested in
> how you define the DataSource.
>
> In the mean time you can have a look at some of my examples:
> This is about JPA and DataSources:
> http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
> [2]
>
> and this about CXF:
> http://liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi
> [3]
>
> I don´t have a tutorial for both at the same time but used in in
> production systems several times. So it should be no problem.
>
> Christian
>
> 2015-05-18 15:29 GMT+02:00 ellirael <el...@mail.ru>:
>
>> After installing CXF feature I met some problem with datasource
>> recognition
>> from bundle that uses JPA and registers servet.
>>
>> javax.naming.NoInitialContextException: Unable to find the
>> InitialContextFactory org.eclipse.jetty.jndi.InitialContextFactory.
>> at
>>
> org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:148)
>> at
>>
> org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49)
>> at
>>
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
>> at
>>
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
>> at
>> javax.naming.InitialContext.init(InitialContext.java:242)
>> at
>> javax.naming.InitialContext.<init>(InitialContext.java:216)
>> at
>>
> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:64)
>> at
>>
> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
>> at
>>
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
>> at
>>
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
>> at
>>
> org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
>> at
>>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
>>
>> The same DataSource works nice when I inject dao service that uses
>> the same
>> datasource in my command bundle. After command invocation servlets
>> starts to
>> work properly.
>>
>> The problem seems to occur for JPA bundles only. There is some sort
>> of
>> InitialContextFactory replacement.
>>
>> --
>> View this message in context:
>>
> http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429.html
>> [1]
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>
> --
>
> --
> Christian Schneider
> http://www.liquid-reality.de [4]
>
> Open Source Architect
> http://www.talend.com [5]
>
> Links:
> ------
> [1]
> http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429.html
> [2]
> http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
> [3]
> http://liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi
> [4]
> https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de
> [5]
> https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com
Re: Problem with JPA,JNDI after installing CXF feature
Posted by ellirael <el...@mail.ru>.
I use pax jdbc and define my ds in config file. Built-in jdbc scope doesn't
provide for some reason Jta enabled datasources.
--
View this message in context: http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429p4040614.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Problem with JPA,JNDI after installing CXF feature
Posted by Christian Schneider <ch...@die-schneider.net>.
Can you post your code somewhere? I would be especially interested in how
you define the DataSource.
In the mean time you can have a look at some of my examples:
This is about JPA and DataSources:
http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
and this about CXF:
http://liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi
I don´t have a tutorial for both at the same time but used in in production
systems several times. So it should be no problem.
Christian
2015-05-18 15:29 GMT+02:00 ellirael <el...@mail.ru>:
> After installing CXF feature I met some problem with datasource recognition
> from bundle that uses JPA and registers servet.
>
> javax.naming.NoInitialContextException: Unable to find the
> InitialContextFactory org.eclipse.jetty.jndi.InitialContextFactory.
> at
>
> org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:148)
> at
>
> org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:49)
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
> at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
> at javax.naming.InitialContext.init(InitialContext.java:242)
> at javax.naming.InitialContext.<init>(InitialContext.java:216)
> at
>
> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:64)
> at
>
> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
> at
>
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
> at
>
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
> at
>
> org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
> at
>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
>
> The same DataSource works nice when I inject dao service that uses the same
> datasource in my command bundle. After command invocation servlets starts
> to
> work properly.
>
> The problem seems to occur for JPA bundles only. There is some sort of
> InitialContextFactory replacement.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
--
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
Re: Problem with JPA,JNDI after installing CXF feature
Posted by ellirael <el...@mail.ru>.
Thanks Achim. I will.
--
View this message in context: http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429p4040602.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Problem with JPA,JNDI after installing CXF feature
Posted by Achim Nierbeck <bc...@googlemail.com>.
Yes,
take a look at one of my sample projects:
https://github.com/ANierbeck/JavaLand-Microservices/tree/master/service-proxy
https://github.com/ANierbeck/karaf-enterprise-sample
https://github.com/ANierbeck/Camel-Pax-Exam-Demo
regards, Achim
2015-05-27 12:05 GMT+02:00 ellirael <el...@mail.ru>:
> Is there any successful projects using blueprint and cхf in karaf? I have
> some problems intergrating cxf into karaf.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429p4040595.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master
Re: Problem with JPA,JNDI after installing CXF feature
Posted by ellirael <el...@mail.ru>.
Is there any successful projects using blueprint and cхf in karaf? I have
some problems intergrating cxf into karaf.
--
View this message in context: http://karaf.922171.n3.nabble.com/Problem-with-JPA-JNDI-after-installing-CXF-feature-tp4040429p4040595.html
Sent from the Karaf - User mailing list archive at Nabble.com.