karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yperey <yann.pe...@nagra.com>
Subject Eclipselink + Karaf + Oracle JDBC: Help required
Date Mon, 14 Oct 2013 12:39:01 GMT
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.

Mime
View raw message