You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by yperey <ya...@nagra.com> on 2013/10/14 14:39:01 UTC
Eclipselink + Karaf + Oracle JDBC: Help required
Hello guys,
I'm trying to create an application running on Karaf 2.3.3 with the
following modules
* Promotion Apis
* Promotion Persistence
* Promotion Oracle Datasource
Seems quite simple huh ? but in fact I got some issues making it working.
*Karaf 2.3.3 configuration*
I've installed manually the following features and modules:
>features:install webconsole
>features:install jndi
>features:install transaction
>features:install jpa
Install the oracle JDBC driver uploaded on our own nexus repository:
>osgi:install -s wrap:mvn:com.oracle/ojdbc6/11.2.0
Install Eclipselink needed modules
>osgi:install -s mvn:org.eclipse.persistence/javax.persistence/2.1.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.5.0
*Promotion Apis module*
Sources:
-Promotion.java (interface)
-PromotionPersistenceService (interface)
pom.xml
<project xmlns="htp://maven.apache.org/POM/4.0.0"
xmlns:xsi="htp://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="htp://maven.apache.org/POM/4.0.0
htp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test.oms</groupId>
<artifactId>OMS</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.test.oms.promotion.api</groupId>
<artifactId>promotion.apis</artifactId>
<name>OMS :: PROMOTION APIS</name>
<description>The Promotion APIs</description>
<packaging>bundle</packaging>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${source.java.compliancy.version}</source>
<target>${target.java.compliancy.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.test.oms.promotion.api,com.test.oms.promotion.persistence</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
*Promotion Oracle Datasource module*
Sources: None
Ressources: OSGI-INF/blueprint/blueprint.xml
<blueprint xmlns="htp://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="oracleDataSource" class="oracle.jdbc.pool.OracleDataSource">
<property name="URL" value="jdbc:oracle:thin:@localhost:1521:orcl"/>
<property name="user" value="test"/>
<property name="password" value="test"/>
</bean>
<service interface="javax.sql.DataSource" ref="oracleDataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/oracleds"/>
<entry key="datasource.name" value="OracleDS"/>
</service-properties>
</service>
</blueprint>
pom.xml
<project xmlns="htp://maven.apache.org/POM/4.0.0"
xmlns:xsi="htp://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="htp://maven.apache.org/POM/4.0.0
htp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test.oms</groupId>
<artifactId>OMS</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.test.oms.promotion.datasource</groupId>
<artifactId>promotion.datasource.oracle</artifactId>
<name>OMS :: ORACLE DATASOURCE</name>
<description>The Oracle datasource for the OMS project</description>
<packaging>bundle</packaging>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${source.java.compliancy.version}</source>
<target>${target.java.compliancy.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Blueprint>OSGI-INF/blueprint/*.xml</Bundle-Blueprint>
<Import-Package>javax.sql,oracle.jdbc.pool</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
</dependencies>
</project>
*Promotion Persistence module*
Sources:
- PromotionImpl.java (implementation class)
- PromotionPersistenceServiceImpl (implementation class)
Resources:
- META-INF/persistence.xml
<persistence xmlns="htp://java.sun.com/xml/ns/persistence"
xmlns:xsi="htp://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="htp://java.sun.com/xml/ns/persistence
htp://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="oms" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>
osgi:service/jdbc/oracleds
</non-jta-data-source>
<class>com.test.oms.promotion.impl.PromotionImpl</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation"
value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode"
value="database"/>
<property name="eclipselink.weaving" value="false"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.logger"
value="bt.service.persistence.jpa.eclipselink.EclipseLinkSessionLogger"/>
</properties>
</persistence-unit>
</persistence>
- OSGI-INF/blueprint/blueprint.xml
<blueprint xmlns="htp://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:jpa="htp://aries.apache.org/xmlns/jpa/v1.0.0"
xmlns:tx="htp://aries.apache.org/xmlns/transactions/v1.0.0"
default-activation="lazy">
<bean id="PromotionPersistenceService"
class="com.test.oms.promotion.persistence.PromotionPersistenceServiceImpl">
<tx:transaction method="*" value="Required" />
<jpa:context property="entityManager" unitname="oms" />
</bean>
<service ref="PromotionPersistenceService"
interface="com.test.oms.promotion.persistence.PromotionPersistenceService"
/>
</blueprint>
pom.xml:
<project xmlns="htp://maven.apache.org/POM/4.0.0"
xmlns:xsi="htp://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="htp://maven.apache.org/POM/4.0.0
htp://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.nagra.oms</groupId>
<artifactId>OMS</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.nagra.oms.promotion.persistence</groupId>
<artifactId>promotion.persistence</artifactId>
<name>OMS :: PROMOTION PERSISTENCE</name>
<description>The persistence part for the promotion</description>
<packaging>bundle</packaging>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${source.java.compliancy.version}</source>
<target>${target.java.compliancy.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Blueprint>OSGI-INF/blueprint/*.xml</Bundle-Blueprint>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
<Import-Package>javax.persistence;version="[2.1.0,2.2.0)",
com.nagra.oms.promotion.api,
com.nagra.oms.promotion.persistence</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.test.oms.promotion.api</groupId>
<artifactId>promotion.apis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</project>
*Deployment*
Once the modules compiled (successfully), I'm trying to deploy them within
Karaf.
>osgi:install -s
mvn:com.test.oms.promotion.api/promotion.apis/0.0.1-SNAPSHOT
OK
>osgi:install -s
mvn:com.test.oms.promotion.datasource/promotion.datasource.oracle/0.0.1-SNAPSHOT
OK
>osgi:install -s
mvn:com.test.oms.promotion.persistence/promotion.persistence/0.0.1-SNAPSHOT
NOK
This module cannot start immediately as it is waiting on another service to
be available (GracePeriod):
2013-10-11 10:45:07,738 | INFO | l Console Thread | BlueprintExtender
| nt.container.BlueprintExtender$3 282 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | Destroying BlueprintContai
ner for bundle promotion.persistence
2013-10-11 10:45:07,741 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:07,741 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:07,752 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:19,932 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:19,944 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:19,945 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:19,947 | WARN | l Console Thread | container
| er.impl.PersistenceBundleManager 570 | 94 -
org.apache.aries.jpa.container - 1.0.0 | There are no providers ava
ilable.
2013-10-11 10:45:19,956 | INFO | rint Extender: 3 | BlueprintContainerImpl
| container.BlueprintContainerImpl 344 | 7 -
org.apache.aries.blueprint.core - 1.1.0 | Bundle promotion.persisten
ce is waiting for dependencies
[(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=oms))(objectClass=javax.persistence.EntityManagerFactory))]
Does annyone has an idea on what is going on here ? What am I missing ?
I would really appreciate your help on this topic,
Regards,
--
View this message in context: http://karaf.922171.n3.nabble.com/Eclipselink-Karaf-Oracle-JDBC-Help-required-tp4029928.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: karaf v 3.0.0.RC2 release with felix v 4.2.1?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It will be very soon. I gonna upgrade to the new Aries Blueprint CM
release tonight. I identified a couple of blocking issues that we have
to fix. I think we can plan 3.0.0.GA for next week.
Regards
JB
On 10/18/2013 12:29 AM, Andrei Pozolotin wrote:
> Jean-Baptiste:
>
> great; is there any time frame for 3.0.0.GA?
>
> Thank you,
>
> Andrei
>
> -------- Original Message --------
> Subject: Re: karaf v 3.0.0.RC2 release with felix v 4.2.1?
> From: Jean-Baptiste Onofré <jb...@nanthrax.net>
> To: dev@karaf.apache.org
> Date: Thu 17 Oct 2013 05:26:12 PM CDT
>> Hi Andrei,
>>
>> Karaf trunk (3.0.0-SNAPSHOT) already uses Felix Framework 4.2.1.
>>
>> It will be included in the first 3.0.0.GA.
>>
>> Regards
>> JB
>>
>> On 10/17/2013 11:44 PM, Andrei Pozolotin wrote:
>>> Hello.
>>>
>>> I am curious if there are any plans to do a karaf v 3.0.0.RC2
>>> release with felix v 4.2.1?
>>>
>>> Thank you,
>>>
>>> Andrei
>>>
>>>
>>
>
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: karaf v 3.0.0.RC2 release with felix v 4.2.1?
Posted by Andrei Pozolotin <an...@gmail.com>.
Jean-Baptiste:
great; is there any time frame for 3.0.0.GA?
Thank you,
Andrei
-------- Original Message --------
Subject: Re: karaf v 3.0.0.RC2 release with felix v 4.2.1?
From: Jean-Baptiste Onofré <jb...@nanthrax.net>
To: dev@karaf.apache.org
Date: Thu 17 Oct 2013 05:26:12 PM CDT
> Hi Andrei,
>
> Karaf trunk (3.0.0-SNAPSHOT) already uses Felix Framework 4.2.1.
>
> It will be included in the first 3.0.0.GA.
>
> Regards
> JB
>
> On 10/17/2013 11:44 PM, Andrei Pozolotin wrote:
>> Hello.
>>
>> I am curious if there are any plans to do a karaf v 3.0.0.RC2
>> release with felix v 4.2.1?
>>
>> Thank you,
>>
>> Andrei
>>
>>
>
Re: karaf v 3.0.0.RC2 release with felix v 4.2.1?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Andrei,
Karaf trunk (3.0.0-SNAPSHOT) already uses Felix Framework 4.2.1.
It will be included in the first 3.0.0.GA.
Regards
JB
On 10/17/2013 11:44 PM, Andrei Pozolotin wrote:
> Hello.
>
> I am curious if there are any plans to do a karaf v 3.0.0.RC2
> release with felix v 4.2.1?
>
> Thank you,
>
> Andrei
>
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
karaf v 3.0.0.RC2 release with felix v 4.2.1?
Posted by Andrei Pozolotin <an...@gmail.com>.
Hello.
I am curious if there are any plans to do a karaf v 3.0.0.RC2
release with felix v 4.2.1?
Thank you,
Andrei
Re: Eclipselink + Karaf + Oracle JDBC: Help required
Posted by nseb <se...@hotmail.com>.
For the JTA transaction ,
you need add in persistence.xml :
<properties>
<property name="eclipselink.target-server"
value="com.jeet.domain.base.service.repository.jpa.OSGiTSServer" />
</properties>
And I attached my classes which is a copy of the osgi adapter eclipselnk
which apparently is no longer maintained
OSGiTSWrapper.java
<http://karaf.922171.n3.nabble.com/file/n4029959/OSGiTSWrapper.java>
OSGiTSServer.java
<http://karaf.922171.n3.nabble.com/file/n4029959/OSGiTSServer.java>
--
View this message in context: http://karaf.922171.n3.nabble.com/Solved-Eclipselink-Karaf-Oracle-JDBC-Help-required-tp4029928p4029959.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Eclipselink + Karaf + Oracle JDBC: Help required
Posted by yperey <ya...@nagra.com>.
Thanks nseb, you are right.
In fact there are several errors there. The first one is to try to use the
EclipseLink 2.5.0 packages within Karaf as it would require the
javax.persistence package 2.1.0 (JPA implementation) which would enter in
conflict with the already existing one (Aries) which implements the 2.0
version of the JPA specification.
So first correction uninstall the specified Eclipselink needed packages:
>osgi:install -s mvn:org.eclipse.persistence/javax.persistence/2.1.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.5.0
>osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.5.0
and install these one instead:
osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.4.2
osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.4.2
osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.4.2
osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.4.2
osgi:install -s
mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.4.2
Then an Eclipselink adaptor has to be created to register manually an OSGI
service to specify the ExclipseLink's persistence provider implementation
(thanks to lbu:
[url]htp://karaf.922171.n3.nabble.com/Karaf-OSGi-Web-Service-with-EclipseLink-No-Persistence-provider-td4028199.html[/url])
and finally I was having a package import/export issue as the API of the
service was in the same package but from another bundle as the
implementation class.
These three points have solved my issue.
--
View this message in context: http://karaf.922171.n3.nabble.com/Eclipselink-Karaf-Oracle-JDBC-Help-required-tp4029928p4029950.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
Re: Eclipselink + Karaf + Oracle JDBC: Help required
Posted by nseb <se...@hotmail.com>.
Hi,
I have done full tests with different JPA provider, it fau tUse EclipseLink
or OpenJPA 2.4.2. EclipseLink 2.5.0 does not yet work with the aries shipped
karaf release.
--
View this message in context: http://karaf.922171.n3.nabble.com/Eclipselink-Karaf-Oracle-JDBC-Help-required-tp4029928p4029948.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.