Hi Luca, thanks for the immediate reply. Meanwhile I tried with dbcp (using servicemix wrapper: org.apache.servicemix.bundles.commons-dbcp-1.4_3.jar and commons-pool) and got it running with a similar bean definition using "org.apache.commons.dbcp.BasicDataSource" and it works as well.
Thanks for pointing out the direction to look to. Regards, Michael 2012/10/5 lb <[email protected]> > Hi Michael, > that is a tricky part.. At the beginning I tried to use something like: > > <bean id="contextWithProps"> > <jpa:context property="em"> > <map> > <entry key="one" value="eins" /> > <entry key="two" value="zwo" /> > </map> > </jpa:context></bean> > > But it looks like aries has some troubles (there should be a post in the > mailing list about that). > The easy solution is to delegate the connection pooling to an additional > library so you can ave a bundle that export a DataSource: > > <bean id="DS" class="com.jolbox.bonecp.BoneCPDataSource" > destroy-method="close"> > <property name="driverClass" > value="${db.class}"/> > <property name="jdbcUrl" > value="${db.url}"/> > <property name="username" > value="${db.usr}"/> > <property name="password" > value="${db.pwd}"/> > <property name="minConnectionsPerPartition" > value="${pool.min}"/> > <property name="maxConnectionsPerPartition" > value="${pool.max}"/> > <property name="acquireIncrement" > value="${pool.partitions}"/> > <property name="partitionCount" > value="${pool.inc}"/> > <property name="idleConnectionTestPeriodInSeconds" > value="${connection.idle.test.period}"/> > <property name="connectionTestStatement" > value="${connection.idle.test.query}"/> > <property name="acquireRetryDelayInMs" > value="${connection.acquire.delay}"/> > <property name="acquireRetryAttempts" > value="${connection.acquire.attempts}"/> > </bean> > > <service ref="DS" interface="javax.sql.DataSource"> > <service-properties> > <entry key="osgi.jndi.service.name" value="jdbc/DS"/> > </service-properties> > </service> > > Then in the persistence.xml you can use the DS trough Aries JNDI: > > <persistence-unit name="TheUnitName" transaction-type="RESOURCE_LOCAL"> > > <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> > <non-jta-data-source>osgi:service/javax.sql.DataSource/( > osgi.jndi.service.name=jdbc/DS)</non-jta-data-source> > <class>x.y.z</class> > <exclude-unlisted-classes>true</exclude-unlisted-classes> > <properties> > <property > name="eclipselink.logging.level" value="FINEST"/> > <property > name="eclipselink.logging.parameters" value="true"/> > <property > name="eclipselink.logging.timestamp" value="false"/> > <property > name="eclipselink.logging.session" value="false"/> > <property > name="eclipselink.logging.thread" value="false"/> > <property > name="eclipselink.logging.exceptions" value="true"/> > <property > name="eclipselink.session.include.descriptor.queries" value="true"/> > </properties> > </persistence-unit> > > Not the best and flexible solution, but it is the best one I0ve found so > far. > > Ciao, > Luca > > > > On Fri, Oct 5, 2012 at 2:49 PM, Michael Täschner <[email protected]>wrote: > >> Hi LB, >> >> sorry to come back to this topic again but I have another questions. How >> can I manage the eclipselink pool settings to make them configurable at >> runtime (exchanging blueprint.xml would be an option). Right now I have >> configured them with compile-time filter in persistence.xml. Any other >> option possible ? >> >> EclipseLink Pool config: >> <property name="eclipselink.jdbc.read-connections.min" >> value="${jdbc.read-connections.min}" /> >> <property name="eclipselink.jdbc.read-connections.max" >> value="${jdbc.read-connections.max}" /> >> <property name="eclipselink.jdbc.read-connections.shared" >> value="${jdbc.read-connections.shared}" /> >> <property name="eclipselink.jdbc.write-connections.min" >> value="${jdbc.write-connections.min}" /> >> <property name="eclipselink.jdbc.write-connections.max" >> value="${jdbc.write-connections.max}" /> >> >> >> Thanks and Regards, >> Michael >> >> >> 2012/9/11 lb <[email protected]> >> >>> Hi, >>> to make Aries 0.3 to work with EclipseLink (on karaf 2.1.7) I had to >>> export the service via blueprint as: >>> >>> <blueprint >>> xmlns = "http://www.osgi.org/xmlns/blueprint/v1.0.0" >>> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" >>> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" >>> xmlns:cm = " >>> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"> >>> >>> <bean >>> id = "ELINK_PP" >>> class = "org.eclipse.persistence.jpa.PersistenceProvider" >>> scope = "prototype"/> >>> >>> <service interface="javax.persistence.spi.PersistenceProvider" >>> ref="ELINK_PP"> >>> <service-properties> >>> <entry >>> key ="javax.persistence.provider" >>> value="org.eclipse.persistence.jpa.PersistenceProvider"/> >>> </service-properties> >>> </service> >>> </blueprint> >>> >>> Not the best way I think, but it works :-) >>> >>> >>> On Mon, Sep 10, 2012 at 9:16 PM, Charles Moulliard <[email protected]>wrote: >>> >>>> This message is related to the fact that Aries JPA is not able to find >>>> the JPA service from OSGI service >>>> >>>> >>>> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.aries.jpa/org.apache.aries.jpa.container/0.3/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java >>>> See line 556 >>>> >>>> Can you check if EclipseLink well register an OSGI service with >>>> Interface name = "javax.persistence.provider" ? >>>> >>>> >>>> On Mon, Sep 10, 2012 at 3:20 PM, Michael Täschner < >>>> [email protected]> wrote: >>>> >>>>> Update, >>>>> >>>>> I installed the EclipseLink JPA OSGi bundle >>>>> (org.eclipse.persistence.osgi) containing persistenceProvider >>>>> implementation as declared in persistence.xml: >>>>> "<provider>org.eclipse.persistence.jpa.osgi.PersistenceProvider</provider>". >>>>> >>>>> Now the aries error message "There are no suitable providers for the >>>>> provider class name org.eclipse.persistence.jpa.osgi.PersistenceProvider >>>>> and version range null" turned into "There are no providers available" : >>>>> 2012-09-10 15:14:19,279 | WARN | Event Dispatcher | >>>>> container | 239 - org.apache.aries.jpa.container - >>>>> 0.3.0 | There are no providers available. >>>>> 2012-09-10 15:14:19,281 | WARN | Event Dispatcher | >>>>> container | 239 - org.apache.aries.jpa.container - >>>>> 0.3.0 | There are no providers available. >>>>> 2012-09-10 15:14:19,303 | INFO | rint Extender: 3 | >>>>> BlueprintContainerImpl | 9 - org.apache.aries.blueprint - 0.3.2 >>>>> | >>>>> Bundle org.example.osgi.dao is waiting for dependencies >>>>> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name >>>>> =Customers))(objectClass=javax.persistence.EntityManagerFactory))] >>>>> >>>>> Yet still no idea, why it can't find the provider ? It is declared in >>>>> persistence.xml >>>>> >>>>> Any idea ? >>>>> >>>>> Thanks and Regards, >>>>> Michael >>>>> >>>>> >>>>> 2012/9/10 Michael Täschner <[email protected]> >>>>> >>>>>> Well, according to osgi:list they are also started (the previous >>>>>> output was from features:list): >>>>>> karaf@root> list -t 0 | grep JPA >>>>>> [ 195] [Active ] [ ] [ ] [ 30] Apache Geronimo >>>>>> JSR-317 JPA 2.0 Spec API (1.1) >>>>>> [ 196] [Active ] [ ] [ ] [ 30] Aries JPA >>>>>> Container API (0.3.0) >>>>>> [ 197] [Active ] [Created ] [ ] [ 30] Aries JPA >>>>>> Container blueprint integration for Aries blueprint (0.3.0) >>>>>> [ 198] [Active ] [ ] [ ] [ 30] Aries JPA >>>>>> Container (0.3.0) >>>>>> [ 199] [Active ] [ ] [ ] [ 30] Aries JPA >>>>>> Container Managed Contexts (0.3.0) >>>>>> >>>>>> [ 209] [Active ] [ ] [ ] [ 80] EclipseLink JPA >>>>>> (2.0.0.v20091127-r5931) >>>>>> >>>>>> karaf@root> list -t 0 | grep JNDI >>>>>> [ 72] [Active ] [ ] [ ] [ 30] Jetty :: JNDI >>>>>> Naming (7.5.4.v20111024) >>>>>> [ 175] [Active ] [ ] [ ] [ 30] Apache Aries >>>>>> JNDI API (0.3.0) >>>>>> [ 176] [Active ] [ ] [ ] [ 30] Apache Aries >>>>>> JNDI Core (0.3.0) >>>>>> [ 177] [Active ] [ ] [ ] [ 30] Apache Aries >>>>>> JNDI RMI Handler (0.3.0) >>>>>> [ 178] [Active ] [ ] [ ] [ 30] Apache Aries >>>>>> JNDI URL Handler (0.3.0) >>>>>> [ 179] [Active ] [ ] [ ] [ 30] Apache Aries >>>>>> JNDI Support for Legacy Runtimes (0.3.0) >>>>>> >>>>>> >>>>>> Regards, >>>>>> Michael >>>>>> >>>>>> 2012/9/10 Charles Moulliard <[email protected]> >>>>>> >>>>>>> They are installed but not started. >>>>>>> >>>>>>> >>>>>>> On Mon, Sep 10, 2012 at 1:47 PM, Michael Täschner < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hi, >>>>>>>> yes, I installed Aries JPA and JNDI features via console: >>>>>>>> [installed ] [0.3 ] jpa >>>>>>>> karaf-enterprise-2.2.9 OSGi Persistence Container >>>>>>>> [installed ] [0.3 ] jndi >>>>>>>> karaf-enterprise-2.2.9 OSGi Service Registry JNDI access >>>>>>>> >>>>>>>> Anything else required ? >>>>>>>> >>>>>>>> Regards, >>>>>>>> Michael >>>>>>>> >>>>>>>> >>>>>>>> 2012/9/10 Charles Moulliard <[email protected]> >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Have you also installed Aries JPA feature as you need it ? >>>>>>>>> >>>>>>>>> Regards, >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Sep 10, 2012 at 1:33 PM, Michael Täschner < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> I am trying to get Aries JPA running with EclipseLink (2.0.3) in >>>>>>>>>> Karaf container. DataSource is implemented as blueprint file and >>>>>>>>>> referenced >>>>>>>>>> via Aries JNDI in persistence.xml. >>>>>>>>>> >>>>>>>>>> The bundles start ok (OSGi) but the bluepint for the DAO does not >>>>>>>>>> get initialized ("Failure"). There are also entries in the log ("not >>>>>>>>>> suitable providers") for which I have not found any info in google: >>>>>>>>>> 2012-09-10 11:25:02,070 | INFO | raf-2.2.9/deploy | >>>>>>>>>> fileinstall | 6 - org.apache.felix.fileinstall >>>>>>>>>> - 3.2.4 >>>>>>>>>> | Started bundle: >>>>>>>>>> blueprint:file:/D:/work/karaf/apache-karaf-2.2.9/deploy/datasource_blueprint.xml >>>>>>>>>> 2012-09-10 11:25:07,178 | INFO | raf-2.2.9/deploy | >>>>>>>>>> fileinstall | 6 - org.apache.felix.fileinstall >>>>>>>>>> - 3.2.4 >>>>>>>>>> | Uninstalled >>>>>>>>>> D:\work\karaf\apache-karaf-2.2.9\deploy\org.eclipse.equinox.console_1.0.0.v20120522-1841.jar >>>>>>>>>> 2012-09-10 13:06:19,558 | WARN | raf-2.2.9/deploy | >>>>>>>>>> container | 198 - >>>>>>>>>> org.apache.aries.jpa.container - >>>>>>>>>> 0.3.0 | There are no suitable providers for the provider class name >>>>>>>>>> org.eclipse.persistence.jpa.osgi.PersistenceProvider and version >>>>>>>>>> range null. >>>>>>>>>> 2012-09-10 13:06:19,584 | INFO | raf-2.2.9/deploy | >>>>>>>>>> fileinstall | 6 - org.apache.felix.fileinstall >>>>>>>>>> - 3.2.4 >>>>>>>>>> | Installed >>>>>>>>>> D:\work\karaf\apache-karaf-2.2.9\deploy\dao-1.0.0-SNAPSHOT.jar >>>>>>>>>> 2012-09-10 13:06:19,825 | WARN | Refresh Packages | >>>>>>>>>> container | 198 - >>>>>>>>>> org.apache.aries.jpa.container - >>>>>>>>>> 0.3.0 | There are no suitable providers for the provider class name >>>>>>>>>> org.eclipse.persistence.jpa.osgi.PersistenceProvider and version >>>>>>>>>> range null. >>>>>>>>>> 2012-09-10 13:06:19,863 | WARN | raf-2.2.9/deploy | >>>>>>>>>> container | 198 - >>>>>>>>>> org.apache.aries.jpa.container - >>>>>>>>>> 0.3.0 | There are no suitable providers for the provider class name >>>>>>>>>> org.eclipse.persistence.jpa.osgi.PersistenceProvider and version >>>>>>>>>> range null. >>>>>>>>>> 2012-09-10 13:06:19,879 | WARN | raf-2.2.9/deploy | >>>>>>>>>> container | 198 - >>>>>>>>>> org.apache.aries.jpa.container - >>>>>>>>>> 0.3.0 | There are no suitable providers for the provider class name >>>>>>>>>> org.eclipse.persistence.jpa.osgi.PersistenceProvider and version >>>>>>>>>> range null. >>>>>>>>>> 2012-09-10 13:06:19,879 | INFO | raf-2.2.9/deploy | >>>>>>>>>> fileinstall | 6 - org.apache.felix.fileinstall >>>>>>>>>> - 3.2.4 >>>>>>>>>> | Started bundle: >>>>>>>>>> file:/D:/work/karaf/apache-karaf-2.2.9/deploy/dao-1.0.0-SNAPSHOT.jar >>>>>>>>>> 2012-09-10 13:06:19,992 | INFO | rint Extender: 1 | >>>>>>>>>> BlueprintContainerImpl | 9 - org.apache.aries.blueprint - >>>>>>>>>> 0.3.2 | >>>>>>>>>> Bundle org.example.osgi.dao is waiting for dependencies >>>>>>>>>> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name >>>>>>>>>> =Customers))(objectClass=javax.persistence.EntityManagerFactory))] >>>>>>>>>> 2012-09-10 13:11:20,028 | ERROR | rint Extender: 1 | >>>>>>>>>> BlueprintContainerImpl | 9 - org.apache.aries.blueprint - >>>>>>>>>> 0.3.2 | >>>>>>>>>> Unable to start blueprint container for bundle org.example.osgi.dao >>>>>>>>>> due to >>>>>>>>>> unresolved dependencies >>>>>>>>>> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))( >>>>>>>>>> osgi.unit.name >>>>>>>>>> =Customers))(objectClass=javax.persistence.EntityManagerFactory))] >>>>>>>>>> java.util.concurrent.TimeoutException >>>>>>>>>> at >>>>>>>>>> org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:293)[9:org.apache.aries.blueprint:0.3.2] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_31] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_31] >>>>>>>>>> at java.lang.Thread.run(Thread.java:662)[:1.6.0_31] >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> bundles: >>>>>>>>>> karaf@root> list >>>>>>>>>> START LEVEL 100 , List Threshold: 50 >>>>>>>>>> ID State Blueprint Spring Level Name >>>>>>>>>> [ 54] [Active ] [ ] [ ] [ 80] Apache >>>>>>>>>> Felix Declarative Services (1.6.1.SNAPSHOT) >>>>>>>>>> [ 55] [Active ] [ ] [ ] [ 80] Sun >>>>>>>>>> Microsystems' JDBC Driver for MySQL (5.1.20) >>>>>>>>>> [ 173] [Active ] [ ] [ ] [ 50] Apache CXF >>>>>>>>>> Compatibility Bundle Jar (2.6.1) >>>>>>>>>> [ 203] [Active ] [Created ] [ ] [ 80] >>>>>>>>>> datasource_blueprint.xml (0.0.0) >>>>>>>>>> [ 204] [Active ] [ ] [ ] [ 80] >>>>>>>>>> eclipselink_feature.xml (0.0.0) >>>>>>>>>> [ 205] [Active ] [ ] [ ] [ 80] Java >>>>>>>>>> Persistence API 2.0 (2.0.3.v201010191057) >>>>>>>>>> [ 206] [Active ] [ ] [ ] [ 80] EclipseLink >>>>>>>>>> ANTLR (2.0.0.v20091127-r5931) >>>>>>>>>> [ 207] [Active ] [ ] [ ] [ 80] EclipseLink >>>>>>>>>> ASM (2.0.0.v20091127-r5931) >>>>>>>>>> [ 208] [Active ] [ ] [ ] [ 80] EclipseLink >>>>>>>>>> Core (2.0.0.v20091127-r5931) >>>>>>>>>> [ 209] [Active ] [ ] [ ] [ 80] EclipseLink >>>>>>>>>> JPA (2.0.0.v20091127-r5931) >>>>>>>>>> [ 212] [Active ] [Failure ] [ ] [ 80] dao >>>>>>>>>> (1.0.0.SNAPSHOT) >>>>>>>>>> >>>>>>>>>> Any hint would be welcome. >>>>>>>>>> >>>>>>>>>> Thanks and Regards, >>>>>>>>>> Michael >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Charles Moulliard >>>>>>>>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>>>>>>>> Twitter : @cmoulliard >>>>>>>>> Blog : http://cmoulliard.blogspot.com >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Charles Moulliard >>>>>>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>>>>>> Twitter : @cmoulliard >>>>>>> Blog : http://cmoulliard.blogspot.com >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Charles Moulliard >>>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>>> Twitter : @cmoulliard >>>> Blog : http://cmoulliard.blogspot.com >>>> >>>> >>>> >>> >> >
