You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Bengt Rodehav <be...@rodehav.com> on 2012/10/22 11:25:42 UTC

"The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
problem regarding datasources. I get the following in my log:

*2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
           | l.ManagedPersistenceUnitInfoImpl   50 | The
org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
container will not offer any DataSourceFactory integration.*

It's only an INFO message but it seems fatal to me because later on I
cannot find my datasource when I try to use it. I publish a data source
(for Derby) using Blueprint. I use the following features from the
karaf-enterprise descriptor:

- transaction
- jpa
- jndi

When I execute "exports | grep -i org.osgi.service.jdbc" on the command
line I get an empty result.

It seems like this package is needed for Aries JPA Container. What bundle
should export it?

/Bengt

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Just a small update about my problems...

The reason why the datasource service could not be found was that I had
referred to it (in persistence.xml) using the wrong class:

*    <jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/filetransferhistoryjta)</jta-data-source>*
*    <non-jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/filetransferhistorynojta)</non-jta-data-source>*

If I change the "jta-data-source" to XADataSouce (which I register the
service with) it works:

*    <jta-data-source>osgi:service/javax.sql.XADataSource/(
osgi.jndi.service.name=jdbc/filetransferhistoryjta)</jta-data-source>*
*    <non-jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/filetransferhistorynojta)</non-jta-data-source>*

Not sure when and how this problem was introduced. Maybe aries-jpa used to
ignore the fact that a "jta-data-source" could not be found (the
"non-jta-data-source" could still be found) and that changed when I
upgraded to the latest Aries (when I upgraded to Karaf 2.3.0).

However, I still have a strange problem when starting my custom Karaf
server - it seems to be stuck waiting for keyboard input. When I hit a key
in the console, Karaf is reinitialized and then things start to work. Will
describe that in a separate thread.

/Bengt




2012/10/24 Bengt Rodehav <be...@rodehav.com>

> That's great news!
>
>
> 2012/10/24 Jean-Baptiste Onofré <jb...@nanthrax.net>
>
>> Thanks Bengt, it's a good idea, I gonna work on it.
>>
>> Regards
>> JB
>>
>>
>> On 10/24/2012 08:53 AM, Bengt Rodehav wrote:
>>
>>> Done:
>>>
>>> https://issues.apache.org/**jira/browse/ARIES-950<https://issues.apache.org/jira/browse/ARIES-950>
>>>
>>> /Bengt
>>>
>>> 2012/10/24 Charles Moulliard <ch007m@gmail.com <mailto:ch007m@gmail.com
>>> >>
>>>
>>>
>>>     Don't think that some commands exist but that should be interesting
>>>     to have a jndi query command. Feel free to open a ticket for Aries
>>>     project
>>>
>>>
>>>     On Tue, Oct 23, 2012 at 3:56 PM, Bengt Rodehav <bengt@rodehav.com
>>>     <ma...@rodehav.com>> wrote:
>>>
>>>         Hello Michael,
>>>
>>>         I don't know what the best practice is. Are there any existing
>>>         Karaf commands (in either Karaf or Aries community) that
>>>         concerns Aries components?
>>>
>>>         /Bengt
>>>
>>>
>>>         2012/10/23 Michael Täschner <m.taeschner@gmail.com
>>>         <ma...@gmail.com>**>
>>>
>>>
>>>             Hi Bengt,
>>>
>>>             regarding the "jndi" command. I guess this should be
>>>             requested at the Aries guys ? Or another karaf component for
>>>             enriching Aries JNDI.
>>>
>>>             Regards,
>>>             Michael
>>>
>>>
>>>             2012/10/22 Bengt Rodehav <bengt@rodehav.com
>>>             <ma...@rodehav.com>>
>>>
>>>
>>>                 Thanks for checking Charles. Do you know if there is a
>>>                 simple way to check if jndi can resolve a query? If not,
>>>                 then a "jndi" command would be a great add-on to Karaf.
>>>
>>>                 /Bengt
>>>
>>>                 2012/10/22 Charles Moulliard <ch007m@gmail.com
>>>                 <ma...@gmail.com>>
>>>
>>>
>>>                     This is correct
>>>
>>>
>>>                     On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav
>>>                     <bengt@rodehav.com <ma...@rodehav.com>>
>>> wrote:
>>>
>>>                         Achim, no Grace Period for any of the bundles.
>>>
>>>                         Charles, "headers 151" gives me the following:
>>>
>>>                         /Connect :: filetransfer-history-domain (151)/
>>>                         /-----------------------------**---------------/
>>>                         /Manifest-Version = 1.0/
>>>                         /Bnd-LastModified = 1350893282476/
>>>                         /Tool = Bnd-0.0.357/
>>>                         /Meta-Persistence = META-INF/persistence.xml/
>>>                         /Built-By = berodeha/
>>>                         /Implementation-Version = 2.3-SNAPSHOT/
>>>                         /Build-Jdk = 1.6.0_32/
>>>                         /Implementation-Title = Digia Connect/
>>>                         /Created-By = Apache Maven Bundle Plugin/
>>>                         /
>>>                         /
>>>                         /Bundle-Name = Connect ::
>>>                         filetransfer-history-domain/
>>>                         /Bundle-SymbolicName =
>>>                         se.digia.connect.services.**
>>> filetransfer.history-domain/
>>>                         /Bundle-Version = 2.3.0.SNAPSHOT/
>>>                         /Bundle-ManifestVersion = 2/
>>>                         /
>>>                         /
>>>                         /Import-Package =/
>>>                         /
>>>                         javax.persistence;resolution:=**
>>> optional;version=1.1,/
>>>                         /
>>>                         javax.persistence.metamodel;**
>>> resolution:=optional;version=**1.1,/
>>>                         /
>>>                         javax.validation.constraints;**
>>> resolution:=optional;version=**1.0,/
>>>                         /
>>>                         org.apache.openjpa.enhance;**
>>> resolution:=optional;version=**2.1,/
>>>                         /
>>>                         org.apache.openjpa.util;**
>>> resolution:=optional;version=**2.1,/
>>>                         /
>>>                         se.digia.connect.filetransfer.**history.domain;/
>>>                         /                resolution:=optional;/
>>>                         /                version=2.3,/
>>>                         /
>>>                         se.digia.connect.util.**persistence;resolution:=
>>> **optional;version=2.3/
>>>                         /Export-Package =/
>>>                         /
>>>                         se.digia.connect.filetransfer.**history.domain;/
>>>                         /                uses:="org.apache.openjpa.**
>>> util,/
>>>                         /
>>>                         se.digia.connect.util.**persistence,/
>>>                         /
>>>                         javax.validation.constraints,/
>>>                         /
>>>                         org.apache.openjpa.enhance,/
>>>                         /                        javax.persistence,/
>>>                         /
>>>                         javax.persistence.metamodel";/
>>>                         /                version=2.3.0.SNAPSHOT/
>>>
>>>                         I think this is correct. Also, this has worked
>>>                         for quite some time on Karaf 2.2.8 (which had an
>>>                         older Aries version).
>>>
>>>                         /Bengt
>>>
>>>
>>>                         2012/10/22 Charles Moulliard <ch007m@gmail.com
>>>                         <ma...@gmail.com>>
>>>
>>>
>>>                             Have you added Meta-Persistence metadata in
>>>                             the MANIFEST file ? I have created a ticket
>>>                             to provide a more end user message on the
>>>                             console
>>>                             (https://issues.apache.org/**
>>> jira/browse/ARIES-945 <https://issues.apache.org/jira/browse/ARIES-945>)
>>>
>>>
>>>                             On Mon, Oct 22, 2012 at 2:09 PM, Bengt
>>>                             Rodehav <bengt@rodehav.com
>>>                             <ma...@rodehav.com>> wrote:
>>>
>>>                                 Thanks for your reply Charles,
>>>
>>>                                 Your're right I don't need the
>>>                                 DataSourceFactory. I mistakenly thought
>>>                                 that the info message was connected to
>>>                                 the problem with not finding the data
>>>                                 source via JNDI. Since everything has
>>>                                 worked before (using Karaf 2.2.8) I
>>>                                 assumed that the feature descriptor   in
>>>                                 Karaf 2.3.0 lacked a bundle (that
>>>                                 exported the org.osgi.service.jdbc
>>>                                 package). That's why I thought it was a
>>>                                 Karaf problem and not an Aries problem.
>>>
>>>                                 So, I probably do not need the
>>>                                 org.osgi.service.jdbc package - it was a
>>>                                 false lead. Still, I do have problems
>>>                                 finding the data source via jndi. I get:
>>>
>>>                                 /
>>>                                 2012-10-22 13:36:23,428 | ERROR |
>>>                                 y/api/getEntries | container
>>>                                             |
>>>                                 ntainer.unit.impl.**JndiDataSource   85
>>> |
>>>                                 The DataSource
>>>                                 osgi:service/javax.sql.**DataSource/(
>>> osgi.jndi.service.**name <http://osgi.jndi.service.name>
>>>                                 <http://osgi.jndi.service.name**
>>> >=jdbc/filetransferhistoryjta)
>>>
>>>                                 required by bundle
>>>                                 se.digia.connect.services.**
>>> filetransfer.history-domain/2.**3.0.SNAPSHOT
>>>                                 could not be found.
>>>                                 javax.naming.**NameNotFoundException:
>>>                                 osgi:service/javax.sql.**DataSource/"(
>>> osgi.jndi.**service.name <http://osgi.jndi.service.name>
>>>                                 <http://osgi.jndi.service.name**
>>> >=jdbc/filetransferhistoryjta)**"
>>>
>>>                                 at
>>>                                 org.apache.aries.jndi.url.**
>>> ServiceRegistryContext.lookup(**ServiceRegistryContext.java:**
>>> 113)[139:org.apache.aries.**jndi.url:1.0.0]
>>>                                 at
>>>                                 org.apache.aries.jndi.url.**
>>> ServiceRegistryContext.lookup(**ServiceRegistryContext.java:**
>>> 144)[139:org.apache.aries.**jndi.url:1.0.0]
>>>                                 at
>>>                                 org.apache.aries.jndi.**
>>> DelegateContext.lookup(**DelegateContext.java:161)[137:**
>>> org.apache.aries.jndi.core:1.**0.0]
>>>                                 at
>>>                                 javax.naming.InitialContext.**
>>> lookup(InitialContext.java:**392)[:1.6.0_32]
>>>                                 at
>>>                                 org.apache.aries.jpa.**
>>> container.unit.impl.**JndiDataSource.getDs(**
>>> JndiDataSource.java:65)[134:**org.apache.aries.jpa.**container:1.0.0]
>>>                                 at
>>>                                 org.apache.aries.jpa.**
>>> container.unit.impl.**DelayedLookupDataSource.**getConnection(**
>>> DelayedLookupDataSource.java:**36)[134:org.apache.aries.jpa.**
>>> container:1.0.0]
>>>                                 at
>>>                                 org.apache.openjpa.lib.jdbc.**
>>> DelegatingDataSource.**getConnection(**DelegatingDataSource.java:137)**
>>> [142:org.apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.lib.jdbc.**
>>> DecoratingDataSource.**getConnection(**DecoratingDataSource.java:112)**
>>> [142:org.apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.**
>>> schema.DataSourceFactory.**installDBDictionary(**
>>> DataSourceFactory.java:239)[**142:org.apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.conf.**
>>> JDBCConfigurationImpl.**getConnectionFactory(**
>>> JDBCConfigurationImpl.java:**733)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.conf.**
>>> JDBCConfigurationImpl.**getDataSource(**JDBCConfigurationImpl.java:**
>>> 872)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.**
>>> kernel.JDBCStoreManager.**getDataSource(**JDBCStoreManager.java:179)[**
>>> 142:org.apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.**
>>> kernel.JDBCStoreManager.**setContext(JDBCStoreManager.**
>>> java:162)[142:org.apache.**openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.jdbc.**
>>> kernel.JDBCStoreManager.**setContext(JDBCStoreManager.**
>>> java:148)[142:org.apache.**openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> DelegatingStoreManager.**setContext(**DelegatingStoreManager.java:**
>>> 79)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> BrokerImpl.initialize(**BrokerImpl.java:369)[142:org.**
>>> apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> BrokerImpl.initialize(**BrokerImpl.java:323)[142:org.**
>>> apache.openjpa:2.1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> AbstractBrokerFactory.**initializeBroker(**AbstractBrokerFactory.java:**
>>> 229)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> AbstractBrokerFactory.**newBroker(**AbstractBrokerFactory.java:**
>>> 213)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.kernel.**
>>> DelegatingBrokerFactory.**newBroker(**DelegatingBrokerFactory.java:**
>>> 156)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.**persistence.**
>>> EntityManagerFactoryImpl.**createEntityManager(**
>>> EntityManagerFactoryImpl.java:**227)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.openjpa.**persistence.**
>>> EntityManagerFactoryImpl.**createEntityManager(**
>>> EntityManagerFactoryImpl.java:**60)[142:org.apache.openjpa:2.**1.1]
>>>                                 at
>>>                                 org.apache.aries.jpa.**container.impl.**
>>> CountingEntityManagerFactory.**createEntityManager(**
>>> CountingEntityManagerFactory.**java:71)[134:org.apache.aries.**
>>> jpa.container:1.0.0]
>>>                                 at
>>>                                 org.apache.aries.jpa.**
>>> container.context.transaction.**impl.**JTAPersistenceContextRegistry.**
>>> getCurrentPersistenceContext(**JTAPersistenceContextRegistry.**
>>> java:152)[135:org.apache.**aries.jpa.container.context:1.**0.1]
>>>                                 at
>>>                                 org.apache.aries.jpa.**
>>> container.context.transaction.**impl.JTAEntityManager.**
>>> getPersistenceContext(**JTAEntityManager.java:87)[135:**
>>> org.apache.aries.jpa.**container.context:1.0.1]
>>>                                 at
>>>                                 org.apache.aries.jpa.**
>>> container.context.transaction.**impl.JTAEntityManager.**
>>> getCriteriaBuilder(**JTAEntityManager.java:391)[**
>>> 135:org.apache.aries.jpa.**container.context:1.0.1]
>>>                                 ...
>>>                                 /
>>>
>>>                                 But the data source seem to be published
>>>                                 as a service, the command "ls | grep -A
>>>                                 4 -B 4 javax.sql.DataSource" gives me
>>>                                 the following output:
>>>
>>>                                 /Connect ::
>>>                                 filetransfer-history-**datasource (153)
>>>                                 provides:/
>>>                                 /-----------------------------**
>>> -----------------------------/
>>>                                 /javax.sql.XADataSource/
>>>                                 /javax.sql.DataSource/
>>>                                 /org.osgi.service.blueprint.**
>>> container.BlueprintContainer/
>>>
>>>                                 I then execute "ls 153" and get:
>>>
>>>                                 /
>>>                                 Connect ::
>>>                                 filetransfer-history-**datasource (153)
>>>                                 provides:
>>>                                 ------------------------------**
>>> ----------------------------
>>>                                 objectClass = javax.sql.XADataSource
>>>                                 osgi.jndi.service.name
>>>                                 <http://osgi.jndi.service.name**> =
>>>                                 jdbc/filetransferhistoryjta
>>>                                 osgi.service.blueprint.**compname =
>>>                                 derbyXADataSource
>>>                                 service.id <http://service.id> = 493
>>>
>>>                                 ----
>>>                                 objectClass = javax.sql.DataSource
>>>                                 osgi.jndi.service.name
>>>                                 <http://osgi.jndi.service.name**> =
>>>                                 jdbc/filetransferhistorynojta
>>>                                 osgi.service.blueprint.**compname =
>>>                                 derbyDataSource
>>>                                 service.id <http://service.id> = 494
>>>
>>>                                 ----
>>>                                 objectClass =
>>>                                 org.osgi.service.blueprint.**
>>> container.BlueprintContainer
>>>                                 osgi.blueprint.container.**symbolicname
>>> =
>>>                                 se.digia.connect.services.**
>>> filetransfer.h/
>>>                                 istory-datasource
>>>                                 /
>>>                                 osgi.blueprint.container.**version =
>>>                                 2.3.0.SNAPSHOT
>>>                                 service.id <http://service.id> = 495
>>>                                 /
>>>
>>>                                 To me it looks like the service is
>>>                                 provided with the correct properties.
>>>                                 Maybe it's a jndi problem? I was hoping
>>>                                 there was a "jndi" command in the Karaf
>>>                                 shell that I could use to see what can
>>>                                 be resolved via jndi but I can't find
>>>                                 such a command.
>>>
>>>                                 I've actually encountered another
>>>                                 strange problem. On startup everything
>>>                                 looks fine. But when I try to access the
>>>                                 webconsole - it's not there. I then
>>>                                 start to type "list" in the Karaf shell.
>>>                                 But as soon as I type the "l" I get the
>>>                                 following message in the console:
>>>
>>>                                 /karaf@root> lError executing command:
>>>                                 read() with timeout cannot be called as
>>> no/
>>>
>>>                                 /n-blocking operation is disabled/
>>>                                 /        __ __                  ____/
>>>                                 /       / //_/____ __________ _/ __//
>>>                                 /      / ,<  / __ `/ ___/ __ `/ /_/
>>>                                 /     / /| |/ /_/ / /  / /_/ / __//
>>>                                 /    /_/ |_|\__,_/_/   \__,_/_//
>>>                                 /
>>>                                 /
>>>                                 /  Apache Karaf (2.3.0)/
>>>                                 /
>>>                                 /
>>>                                 /Hit '<tab>' for a list of available
>>>                                 commands/
>>>                                 /and '[cmd] --help' for help on a
>>>                                 specific command./
>>>                                 /Hit '<ctrl-d>' or 'osgi:shutdown' to
>>>                                 shutdown Karaf./
>>>
>>>
>>>                                 Note that the "Karaf" logo had already
>>>                                 been shown so it's shown twice. Also, in
>>>                                 the log I get:
>>>
>>>                                 /2012-10-22 13:28:27,999 | ERROR |
>>>                                 Thread-6         | FeaturesServiceImpl
>>>                                             |
>>>                                 s.internal.**FeaturesServiceImpl$2 1143
>>> |
>>>                                 Error installing boot features/
>>>
>>>                                 /java.lang.**NullPointerException/
>>>                                 /at
>>>                                 org.apache.felix.framework.**
>>> BundleWiringImpl.**findClassOrResourceByDelegatio**
>>> n(BundleWiringImpl.java:1432)[**org.apache.felix.framework-4.**
>>> 0.3.jar:]/
>>>                                 /at
>>>                                 org.apache.felix.framework.**
>>> BundleWiringImpl.access$400(**BundleWiringImpl.java:72)[org.**
>>> apache.felix.framework-4.0.3.**jar:]/
>>>                                 /at
>>>                                 org.apache.felix.framework.**
>>> BundleWiringImpl$**BundleClassLoader.loadClass(**
>>> BundleWiringImpl.java:1843)[**org.apache.felix.framework-4.**0.3.jar:]/
>>>                                 /at
>>>                                 java.lang.ClassLoader.**
>>> loadClass(ClassLoader.java:**247)[:1.6.0_32]/
>>>                                 /at
>>>                                 org.apache.karaf.features.**
>>> internal.FeaturesServiceImpl.**installFeatures(**
>>> FeaturesServiceImpl.java:525)[**20:org.apache.karaf.features.**
>>> core:2.3.0]/
>>>                                 /at
>>>                                 org.apache.karaf.features.**
>>> internal.FeaturesServiceImpl$**2.run(FeaturesServiceImpl.**
>>> java:1141)[20:org.apache.**karaf.features.core:2.3.0]/
>>>                                 /2012-10-22 13:28:28,002 | ERROR |
>>>                                 Thread-6         | FeaturesServiceImpl
>>>                                             |
>>>                                 res.internal.**FeaturesServiceImpl 1227
>>> |
>>>                                 Error persisting FeaturesService state/
>>>
>>>                                 /java.lang.**IllegalStateException:
>>>                                 Invalid BundleContext./
>>>                                 /at
>>>                                 org.apache.felix.framework.**
>>> BundleContextImpl.**checkValidity(**BundleContextImpl.java:514)[**
>>> org.apache.felix.framework-4.**0.3.jar:]/
>>>                                 /at
>>>                                 org.apache.felix.framework.**
>>> BundleContextImpl.getDataFile(**BundleContextImpl.java:491)[**
>>> org.apache.felix.framework-4.**0.3.jar:]/
>>>                                 /at
>>>                                 org.apache.karaf.features.**
>>> internal.FeaturesServiceImpl.**saveState(FeaturesServiceImpl.**
>>> java:1215)[20:org.apache.**karaf.features.core:2.3.0]/
>>>                                 /at
>>>                                 org.apache.karaf.features.**
>>> internal.FeaturesServiceImpl$**2.run(FeaturesServiceImpl.**
>>> java:1146)[20:org.apache.**karaf.features.core:2.3.0]/
>>>
>>>
>>>                                 If I don't press a key in the shell, I
>>>                                 never get these messages but then the
>>>                                 web service will never install. It's as
>>>                                 if the installation is hung, waiting for
>>>                                 something.
>>>
>>>                                 Do you or anyone have any clue as to
>>>                                 what is happening. I am in the process
>>>                                 of upgrading my custom distribution of
>>>                                 Karaf from 2.2.8 to 2.3.0 so I might
>>>                                 have done something very wrong but right
>>>                                 now I have no clue as to where I should
>>>                                 look further,
>>>
>>>                                 /Bengt
>>>
>>>
>>>                                 2012/10/22 Charles Moulliard
>>>                                 <ch007m@gmail.com <mailto:
>>> ch007m@gmail.com>>
>>>
>>>
>>>                                     Bengt,
>>>
>>>                                     This package is not required by
>>>                                     Aries JPA as resolution is optional :
>>>
>>>                                     org.osgi.service.jdbc;**
>>> resolution:=optional,
>>>
>>>                                     When the Aries JPA Container
>>>                                     /**ManagedPersistenceUnitInfoImpl
>>>                                     /class is called, Aries does a check
>>>
>>>                                     to verify if the OSGI service is
>>>                                     provided. If this is not the case,
>>>                                     the info is displayed in the log and
>>>                                     Aries JPA Container continues to
>>>                                     load the JPA Container based on your
>>>                                     config (persistence.xml, datasource,
>>>                                     ...). If you are using JPA, you
>>>                                     shouldn't use the DataSourceFactory.
>>>
>>>                                     These links could help you to
>>>                                     configure your project
>>>
>>>                                     /http://stackoverflow.com/**
>>> questions/11861414/openjpa-in-**osgi-not-finding-mysql-jdbc-**
>>> connector-bundle/<http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle/>
>>>                                     /http://aries.apache.org/**
>>> modules/jpaproject.html/<http://aries.apache.org/modules/jpaproject.html/>
>>>                                     /
>>>                                     /
>>>
>>>                                     Regards,
>>>
>>>                                     Charles
>>>
>>>                                     On Mon, Oct 22, 2012 at 11:25 AM,
>>>                                     Bengt Rodehav <bengt@rodehav.com
>>>                                     <ma...@rodehav.com>> wrote:
>>>
>>>                                         I'm trying to upgrade fro Karaf
>>>                                         2.2.8 to Karaf 2.3.0 and have
>>>                                         run into a problem regarding
>>>                                         datasources. I get the following
>>>                                         in my log:
>>>
>>>                                         /2012-10-22 10:52:59,563 | INFO
>>>
>>>                                           | Thread-7         | container
>>>                                                                 |
>>>                                         l.**
>>> ManagedPersistenceUnitInfoImpl
>>>                                            50 | The
>>>                                         org.osgi.service.jdbc package is
>>>                                         unavailable. As a result the
>>>                                         Aries JPA container will not
>>>                                         offer any DataSourceFactory
>>>                                         integration./
>>>
>>>
>>>                                         It's only an INFO message but it
>>>                                         seems fatal to me because later
>>>                                         on I cannot find my datasource
>>>                                         when I try to use it. I publish
>>>                                         a data source (for Derby) using
>>>                                         Blueprint. I use the following
>>>                                         features from the
>>>                                         karaf-enterprise descriptor:
>>>
>>>                                         - transaction
>>>                                         - jpa
>>>                                         - jndi
>>>
>>>                                         When I execute "exports | grep
>>>                                         -i org.osgi.service.jdbc" on the
>>>                                         command line I get an empty
>>> result.
>>>
>>>                                         It seems like this package is
>>>                                         needed for Aries JPA Container.
>>>                                         What bundle should export it?
>>>
>>>                                         /Bengt
>>>
>>>
>>>
>>>
>>>                                     --
>>>                                     Charles Moulliard
>>>                                     Apache Committer / Sr. Enterprise
>>>                                     Architect (RedHat)
>>>                                     Twitter : @cmoulliard | Blog :
>>>                                     http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>                             --
>>>                             Charles Moulliard
>>>                             Apache Committer / Sr. Enterprise Architect
>>>                             (RedHat)
>>>                             Twitter : @cmoulliard | Blog :
>>>                             http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>                     --
>>>                     Charles Moulliard
>>>                     Apache Committer / Sr. Enterprise Architect (RedHat)
>>>                     Twitter : @cmoulliard | Blog :
>>>                     http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>     --
>>>     Charles Moulliard
>>>     Apache Committer / Sr. Enterprise Architect (RedHat)
>>>     Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
That's great news!

2012/10/24 Jean-Baptiste Onofré <jb...@nanthrax.net>

> Thanks Bengt, it's a good idea, I gonna work on it.
>
> Regards
> JB
>
>
> On 10/24/2012 08:53 AM, Bengt Rodehav wrote:
>
>> Done:
>>
>> https://issues.apache.org/**jira/browse/ARIES-950<https://issues.apache.org/jira/browse/ARIES-950>
>>
>> /Bengt
>>
>> 2012/10/24 Charles Moulliard <ch007m@gmail.com <ma...@gmail.com>>
>>
>>
>>     Don't think that some commands exist but that should be interesting
>>     to have a jndi query command. Feel free to open a ticket for Aries
>>     project
>>
>>
>>     On Tue, Oct 23, 2012 at 3:56 PM, Bengt Rodehav <bengt@rodehav.com
>>     <ma...@rodehav.com>> wrote:
>>
>>         Hello Michael,
>>
>>         I don't know what the best practice is. Are there any existing
>>         Karaf commands (in either Karaf or Aries community) that
>>         concerns Aries components?
>>
>>         /Bengt
>>
>>
>>         2012/10/23 Michael Täschner <m.taeschner@gmail.com
>>         <ma...@gmail.com>**>
>>
>>
>>             Hi Bengt,
>>
>>             regarding the "jndi" command. I guess this should be
>>             requested at the Aries guys ? Or another karaf component for
>>             enriching Aries JNDI.
>>
>>             Regards,
>>             Michael
>>
>>
>>             2012/10/22 Bengt Rodehav <bengt@rodehav.com
>>             <ma...@rodehav.com>>
>>
>>
>>                 Thanks for checking Charles. Do you know if there is a
>>                 simple way to check if jndi can resolve a query? If not,
>>                 then a "jndi" command would be a great add-on to Karaf.
>>
>>                 /Bengt
>>
>>                 2012/10/22 Charles Moulliard <ch007m@gmail.com
>>                 <ma...@gmail.com>>
>>
>>
>>                     This is correct
>>
>>
>>                     On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav
>>                     <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>>
>>                         Achim, no Grace Period for any of the bundles.
>>
>>                         Charles, "headers 151" gives me the following:
>>
>>                         /Connect :: filetransfer-history-domain (151)/
>>                         /-----------------------------**---------------/
>>                         /Manifest-Version = 1.0/
>>                         /Bnd-LastModified = 1350893282476/
>>                         /Tool = Bnd-0.0.357/
>>                         /Meta-Persistence = META-INF/persistence.xml/
>>                         /Built-By = berodeha/
>>                         /Implementation-Version = 2.3-SNAPSHOT/
>>                         /Build-Jdk = 1.6.0_32/
>>                         /Implementation-Title = Digia Connect/
>>                         /Created-By = Apache Maven Bundle Plugin/
>>                         /
>>                         /
>>                         /Bundle-Name = Connect ::
>>                         filetransfer-history-domain/
>>                         /Bundle-SymbolicName =
>>                         se.digia.connect.services.**
>> filetransfer.history-domain/
>>                         /Bundle-Version = 2.3.0.SNAPSHOT/
>>                         /Bundle-ManifestVersion = 2/
>>                         /
>>                         /
>>                         /Import-Package =/
>>                         /
>>                         javax.persistence;resolution:=**
>> optional;version=1.1,/
>>                         /
>>                         javax.persistence.metamodel;**
>> resolution:=optional;version=**1.1,/
>>                         /
>>                         javax.validation.constraints;**
>> resolution:=optional;version=**1.0,/
>>                         /
>>                         org.apache.openjpa.enhance;**
>> resolution:=optional;version=**2.1,/
>>                         /
>>                         org.apache.openjpa.util;**
>> resolution:=optional;version=**2.1,/
>>                         /
>>                         se.digia.connect.filetransfer.**history.domain;/
>>                         /                resolution:=optional;/
>>                         /                version=2.3,/
>>                         /
>>                         se.digia.connect.util.**persistence;resolution:=*
>> *optional;version=2.3/
>>                         /Export-Package =/
>>                         /
>>                         se.digia.connect.filetransfer.**history.domain;/
>>                         /                uses:="org.apache.openjpa.**
>> util,/
>>                         /
>>                         se.digia.connect.util.**persistence,/
>>                         /
>>                         javax.validation.constraints,/
>>                         /
>>                         org.apache.openjpa.enhance,/
>>                         /                        javax.persistence,/
>>                         /
>>                         javax.persistence.metamodel";/
>>                         /                version=2.3.0.SNAPSHOT/
>>
>>                         I think this is correct. Also, this has worked
>>                         for quite some time on Karaf 2.2.8 (which had an
>>                         older Aries version).
>>
>>                         /Bengt
>>
>>
>>                         2012/10/22 Charles Moulliard <ch007m@gmail.com
>>                         <ma...@gmail.com>>
>>
>>
>>                             Have you added Meta-Persistence metadata in
>>                             the MANIFEST file ? I have created a ticket
>>                             to provide a more end user message on the
>>                             console
>>                             (https://issues.apache.org/**
>> jira/browse/ARIES-945 <https://issues.apache.org/jira/browse/ARIES-945>)
>>
>>
>>                             On Mon, Oct 22, 2012 at 2:09 PM, Bengt
>>                             Rodehav <bengt@rodehav.com
>>                             <ma...@rodehav.com>> wrote:
>>
>>                                 Thanks for your reply Charles,
>>
>>                                 Your're right I don't need the
>>                                 DataSourceFactory. I mistakenly thought
>>                                 that the info message was connected to
>>                                 the problem with not finding the data
>>                                 source via JNDI. Since everything has
>>                                 worked before (using Karaf 2.2.8) I
>>                                 assumed that the feature descriptor   in
>>                                 Karaf 2.3.0 lacked a bundle (that
>>                                 exported the org.osgi.service.jdbc
>>                                 package). That's why I thought it was a
>>                                 Karaf problem and not an Aries problem.
>>
>>                                 So, I probably do not need the
>>                                 org.osgi.service.jdbc package - it was a
>>                                 false lead. Still, I do have problems
>>                                 finding the data source via jndi. I get:
>>
>>                                 /
>>                                 2012-10-22 13:36:23,428 | ERROR |
>>                                 y/api/getEntries | container
>>                                             |
>>                                 ntainer.unit.impl.**JndiDataSource   85 |
>>                                 The DataSource
>>                                 osgi:service/javax.sql.**DataSource/(
>> osgi.jndi.service.**name <http://osgi.jndi.service.name>
>>                                 <http://osgi.jndi.service.name**
>> >=jdbc/filetransferhistoryjta)
>>
>>                                 required by bundle
>>                                 se.digia.connect.services.**
>> filetransfer.history-domain/2.**3.0.SNAPSHOT
>>                                 could not be found.
>>                                 javax.naming.**NameNotFoundException:
>>                                 osgi:service/javax.sql.**DataSource/"(
>> osgi.jndi.**service.name <http://osgi.jndi.service.name>
>>                                 <http://osgi.jndi.service.name**
>> >=jdbc/filetransferhistoryjta)**"
>>
>>                                 at
>>                                 org.apache.aries.jndi.url.**
>> ServiceRegistryContext.lookup(**ServiceRegistryContext.java:**
>> 113)[139:org.apache.aries.**jndi.url:1.0.0]
>>                                 at
>>                                 org.apache.aries.jndi.url.**
>> ServiceRegistryContext.lookup(**ServiceRegistryContext.java:**
>> 144)[139:org.apache.aries.**jndi.url:1.0.0]
>>                                 at
>>                                 org.apache.aries.jndi.**
>> DelegateContext.lookup(**DelegateContext.java:161)[137:**
>> org.apache.aries.jndi.core:1.**0.0]
>>                                 at
>>                                 javax.naming.InitialContext.**
>> lookup(InitialContext.java:**392)[:1.6.0_32]
>>                                 at
>>                                 org.apache.aries.jpa.**
>> container.unit.impl.**JndiDataSource.getDs(**JndiDataSource.java:65)[134:
>> **org.apache.aries.jpa.**container:1.0.0]
>>                                 at
>>                                 org.apache.aries.jpa.**
>> container.unit.impl.**DelayedLookupDataSource.**getConnection(**
>> DelayedLookupDataSource.java:**36)[134:org.apache.aries.jpa.**
>> container:1.0.0]
>>                                 at
>>                                 org.apache.openjpa.lib.jdbc.**
>> DelegatingDataSource.**getConnection(**DelegatingDataSource.java:137)**
>> [142:org.apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.lib.jdbc.**
>> DecoratingDataSource.**getConnection(**DecoratingDataSource.java:112)**
>> [142:org.apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.**
>> schema.DataSourceFactory.**installDBDictionary(**
>> DataSourceFactory.java:239)[**142:org.apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.conf.**
>> JDBCConfigurationImpl.**getConnectionFactory(**
>> JDBCConfigurationImpl.java:**733)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.conf.**
>> JDBCConfigurationImpl.**getDataSource(**JDBCConfigurationImpl.java:**
>> 872)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.**
>> kernel.JDBCStoreManager.**getDataSource(**JDBCStoreManager.java:179)[**
>> 142:org.apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.**
>> kernel.JDBCStoreManager.**setContext(JDBCStoreManager.**
>> java:162)[142:org.apache.**openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.jdbc.**
>> kernel.JDBCStoreManager.**setContext(JDBCStoreManager.**
>> java:148)[142:org.apache.**openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> DelegatingStoreManager.**setContext(**DelegatingStoreManager.java:**
>> 79)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> BrokerImpl.initialize(**BrokerImpl.java:369)[142:org.**
>> apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> BrokerImpl.initialize(**BrokerImpl.java:323)[142:org.**
>> apache.openjpa:2.1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> AbstractBrokerFactory.**initializeBroker(**AbstractBrokerFactory.java:**
>> 229)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> AbstractBrokerFactory.**newBroker(**AbstractBrokerFactory.java:**
>> 213)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.kernel.**
>> DelegatingBrokerFactory.**newBroker(**DelegatingBrokerFactory.java:**
>> 156)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.**persistence.**
>> EntityManagerFactoryImpl.**createEntityManager(**
>> EntityManagerFactoryImpl.java:**227)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.openjpa.**persistence.**
>> EntityManagerFactoryImpl.**createEntityManager(**
>> EntityManagerFactoryImpl.java:**60)[142:org.apache.openjpa:2.**1.1]
>>                                 at
>>                                 org.apache.aries.jpa.**container.impl.**
>> CountingEntityManagerFactory.**createEntityManager(**
>> CountingEntityManagerFactory.**java:71)[134:org.apache.aries.**
>> jpa.container:1.0.0]
>>                                 at
>>                                 org.apache.aries.jpa.**
>> container.context.transaction.**impl.**JTAPersistenceContextRegistry.**
>> getCurrentPersistenceContext(**JTAPersistenceContextRegistry.**
>> java:152)[135:org.apache.**aries.jpa.container.context:1.**0.1]
>>                                 at
>>                                 org.apache.aries.jpa.**
>> container.context.transaction.**impl.JTAEntityManager.**
>> getPersistenceContext(**JTAEntityManager.java:87)[135:**
>> org.apache.aries.jpa.**container.context:1.0.1]
>>                                 at
>>                                 org.apache.aries.jpa.**
>> container.context.transaction.**impl.JTAEntityManager.**
>> getCriteriaBuilder(**JTAEntityManager.java:391)[**
>> 135:org.apache.aries.jpa.**container.context:1.0.1]
>>                                 ...
>>                                 /
>>
>>                                 But the data source seem to be published
>>                                 as a service, the command "ls | grep -A
>>                                 4 -B 4 javax.sql.DataSource" gives me
>>                                 the following output:
>>
>>                                 /Connect ::
>>                                 filetransfer-history-**datasource (153)
>>                                 provides:/
>>                                 /-----------------------------**
>> -----------------------------/
>>                                 /javax.sql.XADataSource/
>>                                 /javax.sql.DataSource/
>>                                 /org.osgi.service.blueprint.**
>> container.BlueprintContainer/
>>
>>                                 I then execute "ls 153" and get:
>>
>>                                 /
>>                                 Connect ::
>>                                 filetransfer-history-**datasource (153)
>>                                 provides:
>>                                 ------------------------------**
>> ----------------------------
>>                                 objectClass = javax.sql.XADataSource
>>                                 osgi.jndi.service.name
>>                                 <http://osgi.jndi.service.name**> =
>>                                 jdbc/filetransferhistoryjta
>>                                 osgi.service.blueprint.**compname =
>>                                 derbyXADataSource
>>                                 service.id <http://service.id> = 493
>>
>>                                 ----
>>                                 objectClass = javax.sql.DataSource
>>                                 osgi.jndi.service.name
>>                                 <http://osgi.jndi.service.name**> =
>>                                 jdbc/filetransferhistorynojta
>>                                 osgi.service.blueprint.**compname =
>>                                 derbyDataSource
>>                                 service.id <http://service.id> = 494
>>
>>                                 ----
>>                                 objectClass =
>>                                 org.osgi.service.blueprint.**
>> container.BlueprintContainer
>>                                 osgi.blueprint.container.**symbolicname =
>>                                 se.digia.connect.services.**
>> filetransfer.h/
>>                                 istory-datasource
>>                                 /
>>                                 osgi.blueprint.container.**version =
>>                                 2.3.0.SNAPSHOT
>>                                 service.id <http://service.id> = 495
>>                                 /
>>
>>                                 To me it looks like the service is
>>                                 provided with the correct properties.
>>                                 Maybe it's a jndi problem? I was hoping
>>                                 there was a "jndi" command in the Karaf
>>                                 shell that I could use to see what can
>>                                 be resolved via jndi but I can't find
>>                                 such a command.
>>
>>                                 I've actually encountered another
>>                                 strange problem. On startup everything
>>                                 looks fine. But when I try to access the
>>                                 webconsole - it's not there. I then
>>                                 start to type "list" in the Karaf shell.
>>                                 But as soon as I type the "l" I get the
>>                                 following message in the console:
>>
>>                                 /karaf@root> lError executing command:
>>                                 read() with timeout cannot be called as
>> no/
>>
>>                                 /n-blocking operation is disabled/
>>                                 /        __ __                  ____/
>>                                 /       / //_/____ __________ _/ __//
>>                                 /      / ,<  / __ `/ ___/ __ `/ /_/
>>                                 /     / /| |/ /_/ / /  / /_/ / __//
>>                                 /    /_/ |_|\__,_/_/   \__,_/_//
>>                                 /
>>                                 /
>>                                 /  Apache Karaf (2.3.0)/
>>                                 /
>>                                 /
>>                                 /Hit '<tab>' for a list of available
>>                                 commands/
>>                                 /and '[cmd] --help' for help on a
>>                                 specific command./
>>                                 /Hit '<ctrl-d>' or 'osgi:shutdown' to
>>                                 shutdown Karaf./
>>
>>
>>                                 Note that the "Karaf" logo had already
>>                                 been shown so it's shown twice. Also, in
>>                                 the log I get:
>>
>>                                 /2012-10-22 13:28:27,999 | ERROR |
>>                                 Thread-6         | FeaturesServiceImpl
>>                                             |
>>                                 s.internal.**FeaturesServiceImpl$2 1143 |
>>                                 Error installing boot features/
>>
>>                                 /java.lang.**NullPointerException/
>>                                 /at
>>                                 org.apache.felix.framework.**
>> BundleWiringImpl.**findClassOrResourceByDelegatio**
>> n(BundleWiringImpl.java:1432)[**org.apache.felix.framework-4.**0.3.jar:]/
>>                                 /at
>>                                 org.apache.felix.framework.**
>> BundleWiringImpl.access$400(**BundleWiringImpl.java:72)[org.**
>> apache.felix.framework-4.0.3.**jar:]/
>>                                 /at
>>                                 org.apache.felix.framework.**
>> BundleWiringImpl$**BundleClassLoader.loadClass(**
>> BundleWiringImpl.java:1843)[**org.apache.felix.framework-4.**0.3.jar:]/
>>                                 /at
>>                                 java.lang.ClassLoader.**
>> loadClass(ClassLoader.java:**247)[:1.6.0_32]/
>>                                 /at
>>                                 org.apache.karaf.features.**
>> internal.FeaturesServiceImpl.**installFeatures(**
>> FeaturesServiceImpl.java:525)[**20:org.apache.karaf.features.**
>> core:2.3.0]/
>>                                 /at
>>                                 org.apache.karaf.features.**
>> internal.FeaturesServiceImpl$**2.run(FeaturesServiceImpl.**
>> java:1141)[20:org.apache.**karaf.features.core:2.3.0]/
>>                                 /2012-10-22 13:28:28,002 | ERROR |
>>                                 Thread-6         | FeaturesServiceImpl
>>                                             |
>>                                 res.internal.**FeaturesServiceImpl 1227 |
>>                                 Error persisting FeaturesService state/
>>
>>                                 /java.lang.**IllegalStateException:
>>                                 Invalid BundleContext./
>>                                 /at
>>                                 org.apache.felix.framework.**
>> BundleContextImpl.**checkValidity(**BundleContextImpl.java:514)[**
>> org.apache.felix.framework-4.**0.3.jar:]/
>>                                 /at
>>                                 org.apache.felix.framework.**
>> BundleContextImpl.getDataFile(**BundleContextImpl.java:491)[**
>> org.apache.felix.framework-4.**0.3.jar:]/
>>                                 /at
>>                                 org.apache.karaf.features.**
>> internal.FeaturesServiceImpl.**saveState(FeaturesServiceImpl.**
>> java:1215)[20:org.apache.**karaf.features.core:2.3.0]/
>>                                 /at
>>                                 org.apache.karaf.features.**
>> internal.FeaturesServiceImpl$**2.run(FeaturesServiceImpl.**
>> java:1146)[20:org.apache.**karaf.features.core:2.3.0]/
>>
>>
>>                                 If I don't press a key in the shell, I
>>                                 never get these messages but then the
>>                                 web service will never install. It's as
>>                                 if the installation is hung, waiting for
>>                                 something.
>>
>>                                 Do you or anyone have any clue as to
>>                                 what is happening. I am in the process
>>                                 of upgrading my custom distribution of
>>                                 Karaf from 2.2.8 to 2.3.0 so I might
>>                                 have done something very wrong but right
>>                                 now I have no clue as to where I should
>>                                 look further,
>>
>>                                 /Bengt
>>
>>
>>                                 2012/10/22 Charles Moulliard
>>                                 <ch007m@gmail.com <mailto:
>> ch007m@gmail.com>>
>>
>>
>>                                     Bengt,
>>
>>                                     This package is not required by
>>                                     Aries JPA as resolution is optional :
>>
>>                                     org.osgi.service.jdbc;**
>> resolution:=optional,
>>
>>                                     When the Aries JPA Container
>>                                     /**ManagedPersistenceUnitInfoImpl
>>                                     /class is called, Aries does a check
>>
>>                                     to verify if the OSGI service is
>>                                     provided. If this is not the case,
>>                                     the info is displayed in the log and
>>                                     Aries JPA Container continues to
>>                                     load the JPA Container based on your
>>                                     config (persistence.xml, datasource,
>>                                     ...). If you are using JPA, you
>>                                     shouldn't use the DataSourceFactory.
>>
>>                                     These links could help you to
>>                                     configure your project
>>
>>                                     /http://stackoverflow.com/**
>> questions/11861414/openjpa-in-**osgi-not-finding-mysql-jdbc-**
>> connector-bundle/<http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle/>
>>                                     /http://aries.apache.org/**
>> modules/jpaproject.html/<http://aries.apache.org/modules/jpaproject.html/>
>>                                     /
>>                                     /
>>
>>                                     Regards,
>>
>>                                     Charles
>>
>>                                     On Mon, Oct 22, 2012 at 11:25 AM,
>>                                     Bengt Rodehav <bengt@rodehav.com
>>                                     <ma...@rodehav.com>> wrote:
>>
>>                                         I'm trying to upgrade fro Karaf
>>                                         2.2.8 to Karaf 2.3.0 and have
>>                                         run into a problem regarding
>>                                         datasources. I get the following
>>                                         in my log:
>>
>>                                         /2012-10-22 10:52:59,563 | INFO
>>
>>                                           | Thread-7         | container
>>                                                                 |
>>                                         l.**
>> ManagedPersistenceUnitInfoImpl
>>                                            50 | The
>>                                         org.osgi.service.jdbc package is
>>                                         unavailable. As a result the
>>                                         Aries JPA container will not
>>                                         offer any DataSourceFactory
>>                                         integration./
>>
>>
>>                                         It's only an INFO message but it
>>                                         seems fatal to me because later
>>                                         on I cannot find my datasource
>>                                         when I try to use it. I publish
>>                                         a data source (for Derby) using
>>                                         Blueprint. I use the following
>>                                         features from the
>>                                         karaf-enterprise descriptor:
>>
>>                                         - transaction
>>                                         - jpa
>>                                         - jndi
>>
>>                                         When I execute "exports | grep
>>                                         -i org.osgi.service.jdbc" on the
>>                                         command line I get an empty
>> result.
>>
>>                                         It seems like this package is
>>                                         needed for Aries JPA Container.
>>                                         What bundle should export it?
>>
>>                                         /Bengt
>>
>>
>>
>>
>>                                     --
>>                                     Charles Moulliard
>>                                     Apache Committer / Sr. Enterprise
>>                                     Architect (RedHat)
>>                                     Twitter : @cmoulliard | Blog :
>>                                     http://cmoulliard.blogspot.com
>>
>>
>>
>>
>>
>>
>>                             --
>>                             Charles Moulliard
>>                             Apache Committer / Sr. Enterprise Architect
>>                             (RedHat)
>>                             Twitter : @cmoulliard | Blog :
>>                             http://cmoulliard.blogspot.com
>>
>>
>>
>>
>>
>>
>>                     --
>>                     Charles Moulliard
>>                     Apache Committer / Sr. Enterprise Architect (RedHat)
>>                     Twitter : @cmoulliard | Blog :
>>                     http://cmoulliard.blogspot.com
>>
>>
>>
>>
>>
>>
>>
>>
>>     --
>>     Charles Moulliard
>>     Apache Committer / Sr. Enterprise Architect (RedHat)
>>     Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Bengt, it's a good idea, I gonna work on it.

Regards
JB

On 10/24/2012 08:53 AM, Bengt Rodehav wrote:
> Done:
>
> https://issues.apache.org/jira/browse/ARIES-950
>
> /Bengt
>
> 2012/10/24 Charles Moulliard <ch007m@gmail.com <ma...@gmail.com>>
>
>     Don't think that some commands exist but that should be interesting
>     to have a jndi query command. Feel free to open a ticket for Aries
>     project
>
>
>     On Tue, Oct 23, 2012 at 3:56 PM, Bengt Rodehav <bengt@rodehav.com
>     <ma...@rodehav.com>> wrote:
>
>         Hello Michael,
>
>         I don't know what the best practice is. Are there any existing
>         Karaf commands (in either Karaf or Aries community) that
>         concerns Aries components?
>
>         /Bengt
>
>
>         2012/10/23 Michael Täschner <m.taeschner@gmail.com
>         <ma...@gmail.com>>
>
>             Hi Bengt,
>
>             regarding the "jndi" command. I guess this should be
>             requested at the Aries guys ? Or another karaf component for
>             enriching Aries JNDI.
>
>             Regards,
>             Michael
>
>
>             2012/10/22 Bengt Rodehav <bengt@rodehav.com
>             <ma...@rodehav.com>>
>
>                 Thanks for checking Charles. Do you know if there is a
>                 simple way to check if jndi can resolve a query? If not,
>                 then a "jndi" command would be a great add-on to Karaf.
>
>                 /Bengt
>
>                 2012/10/22 Charles Moulliard <ch007m@gmail.com
>                 <ma...@gmail.com>>
>
>                     This is correct
>
>
>                     On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav
>                     <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>
>                         Achim, no Grace Period for any of the bundles.
>
>                         Charles, "headers 151" gives me the following:
>
>                         /Connect :: filetransfer-history-domain (151)/
>                         /--------------------------------------------/
>                         /Manifest-Version = 1.0/
>                         /Bnd-LastModified = 1350893282476/
>                         /Tool = Bnd-0.0.357/
>                         /Meta-Persistence = META-INF/persistence.xml/
>                         /Built-By = berodeha/
>                         /Implementation-Version = 2.3-SNAPSHOT/
>                         /Build-Jdk = 1.6.0_32/
>                         /Implementation-Title = Digia Connect/
>                         /Created-By = Apache Maven Bundle Plugin/
>                         /
>                         /
>                         /Bundle-Name = Connect ::
>                         filetransfer-history-domain/
>                         /Bundle-SymbolicName =
>                         se.digia.connect.services.filetransfer.history-domain/
>                         /Bundle-Version = 2.3.0.SNAPSHOT/
>                         /Bundle-ManifestVersion = 2/
>                         /
>                         /
>                         /Import-Package =/
>                         /
>                         javax.persistence;resolution:=optional;version=1.1,/
>                         /
>                         javax.persistence.metamodel;resolution:=optional;version=1.1,/
>                         /
>                         javax.validation.constraints;resolution:=optional;version=1.0,/
>                         /
>                         org.apache.openjpa.enhance;resolution:=optional;version=2.1,/
>                         /
>                         org.apache.openjpa.util;resolution:=optional;version=2.1,/
>                         /
>                         se.digia.connect.filetransfer.history.domain;/
>                         /                resolution:=optional;/
>                         /                version=2.3,/
>                         /
>                         se.digia.connect.util.persistence;resolution:=optional;version=2.3/
>                         /Export-Package =/
>                         /
>                         se.digia.connect.filetransfer.history.domain;/
>                         /                uses:="org.apache.openjpa.util,/
>                         /
>                         se.digia.connect.util.persistence,/
>                         /
>                         javax.validation.constraints,/
>                         /
>                         org.apache.openjpa.enhance,/
>                         /                        javax.persistence,/
>                         /
>                         javax.persistence.metamodel";/
>                         /                version=2.3.0.SNAPSHOT/
>
>                         I think this is correct. Also, this has worked
>                         for quite some time on Karaf 2.2.8 (which had an
>                         older Aries version).
>
>                         /Bengt
>
>
>                         2012/10/22 Charles Moulliard <ch007m@gmail.com
>                         <ma...@gmail.com>>
>
>                             Have you added Meta-Persistence metadata in
>                             the MANIFEST file ? I have created a ticket
>                             to provide a more end user message on the
>                             console
>                             (https://issues.apache.org/jira/browse/ARIES-945)
>
>
>                             On Mon, Oct 22, 2012 at 2:09 PM, Bengt
>                             Rodehav <bengt@rodehav.com
>                             <ma...@rodehav.com>> wrote:
>
>                                 Thanks for your reply Charles,
>
>                                 Your're right I don't need the
>                                 DataSourceFactory. I mistakenly thought
>                                 that the info message was connected to
>                                 the problem with not finding the data
>                                 source via JNDI. Since everything has
>                                 worked before (using Karaf 2.2.8) I
>                                 assumed that the feature descriptor   in
>                                 Karaf 2.3.0 lacked a bundle (that
>                                 exported the org.osgi.service.jdbc
>                                 package). That's why I thought it was a
>                                 Karaf problem and not an Aries problem.
>
>                                 So, I probably do not need the
>                                 org.osgi.service.jdbc package - it was a
>                                 false lead. Still, I do have problems
>                                 finding the data source via jndi. I get:
>
>                                 /
>                                 2012-10-22 13:36:23,428 | ERROR |
>                                 y/api/getEntries | container
>                                             |
>                                 ntainer.unit.impl.JndiDataSource   85 |
>                                 The DataSource
>                                 osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
>                                 <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)
>                                 required by bundle
>                                 se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT
>                                 could not be found.
>                                 javax.naming.NameNotFoundException:
>                                 osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>                                 <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)"
>                                 at
>                                 org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>                                 at
>                                 org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>                                 at
>                                 org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>                                 at
>                                 javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>                                 at
>                                 org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>                                 at
>                                 org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>                                 at
>                                 org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>                                 at
>                                 org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>                                 at
>                                 org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>                                 at
>                                 org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>                                 at
>                                 org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>                                 ...
>                                 /
>
>                                 But the data source seem to be published
>                                 as a service, the command "ls | grep -A
>                                 4 -B 4 javax.sql.DataSource" gives me
>                                 the following output:
>
>                                 /Connect ::
>                                 filetransfer-history-datasource (153)
>                                 provides:/
>                                 /----------------------------------------------------------/
>                                 /javax.sql.XADataSource/
>                                 /javax.sql.DataSource/
>                                 /org.osgi.service.blueprint.container.BlueprintContainer/
>
>                                 I then execute "ls 153" and get:
>
>                                 /
>                                 Connect ::
>                                 filetransfer-history-datasource (153)
>                                 provides:
>                                 ----------------------------------------------------------
>                                 objectClass = javax.sql.XADataSource
>                                 osgi.jndi.service.name
>                                 <http://osgi.jndi.service.name> =
>                                 jdbc/filetransferhistoryjta
>                                 osgi.service.blueprint.compname =
>                                 derbyXADataSource
>                                 service.id <http://service.id> = 493
>                                 ----
>                                 objectClass = javax.sql.DataSource
>                                 osgi.jndi.service.name
>                                 <http://osgi.jndi.service.name> =
>                                 jdbc/filetransferhistorynojta
>                                 osgi.service.blueprint.compname =
>                                 derbyDataSource
>                                 service.id <http://service.id> = 494
>                                 ----
>                                 objectClass =
>                                 org.osgi.service.blueprint.container.BlueprintContainer
>                                 osgi.blueprint.container.symbolicname =
>                                 se.digia.connect.services.filetransfer.h/
>                                 istory-datasource
>                                 /
>                                 osgi.blueprint.container.version =
>                                 2.3.0.SNAPSHOT
>                                 service.id <http://service.id> = 495
>                                 /
>
>                                 To me it looks like the service is
>                                 provided with the correct properties.
>                                 Maybe it's a jndi problem? I was hoping
>                                 there was a "jndi" command in the Karaf
>                                 shell that I could use to see what can
>                                 be resolved via jndi but I can't find
>                                 such a command.
>
>                                 I've actually encountered another
>                                 strange problem. On startup everything
>                                 looks fine. But when I try to access the
>                                 webconsole - it's not there. I then
>                                 start to type "list" in the Karaf shell.
>                                 But as soon as I type the "l" I get the
>                                 following message in the console:
>
>                                 /karaf@root> lError executing command:
>                                 read() with timeout cannot be called as no/
>                                 /n-blocking operation is disabled/
>                                 /        __ __                  ____/
>                                 /       / //_/____ __________ _/ __//
>                                 /      / ,<  / __ `/ ___/ __ `/ /_/
>                                 /     / /| |/ /_/ / /  / /_/ / __//
>                                 /    /_/ |_|\__,_/_/   \__,_/_//
>                                 /
>                                 /
>                                 /  Apache Karaf (2.3.0)/
>                                 /
>                                 /
>                                 /Hit '<tab>' for a list of available
>                                 commands/
>                                 /and '[cmd] --help' for help on a
>                                 specific command./
>                                 /Hit '<ctrl-d>' or 'osgi:shutdown' to
>                                 shutdown Karaf./
>
>                                 Note that the "Karaf" logo had already
>                                 been shown so it's shown twice. Also, in
>                                 the log I get:
>
>                                 /2012-10-22 13:28:27,999 | ERROR |
>                                 Thread-6         | FeaturesServiceImpl
>                                             |
>                                 s.internal.FeaturesServiceImpl$2 1143 |
>                                 Error installing boot features/
>                                 /java.lang.NullPointerException/
>                                 /at
>                                 org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]/
>                                 /at
>                                 org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]/
>                                 /at
>                                 org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]/
>                                 /at
>                                 java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]/
>                                 /at
>                                 org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]/
>                                 /at
>                                 org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]/
>                                 /2012-10-22 13:28:28,002 | ERROR |
>                                 Thread-6         | FeaturesServiceImpl
>                                             |
>                                 res.internal.FeaturesServiceImpl 1227 |
>                                 Error persisting FeaturesService state/
>                                 /java.lang.IllegalStateException:
>                                 Invalid BundleContext./
>                                 /at
>                                 org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]/
>                                 /at
>                                 org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]/
>                                 /at
>                                 org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]/
>                                 /at
>                                 org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]/
>
>                                 If I don't press a key in the shell, I
>                                 never get these messages but then the
>                                 web service will never install. It's as
>                                 if the installation is hung, waiting for
>                                 something.
>
>                                 Do you or anyone have any clue as to
>                                 what is happening. I am in the process
>                                 of upgrading my custom distribution of
>                                 Karaf from 2.2.8 to 2.3.0 so I might
>                                 have done something very wrong but right
>                                 now I have no clue as to where I should
>                                 look further,
>
>                                 /Bengt
>
>
>                                 2012/10/22 Charles Moulliard
>                                 <ch007m@gmail.com <ma...@gmail.com>>
>
>                                     Bengt,
>
>                                     This package is not required by
>                                     Aries JPA as resolution is optional :
>
>                                     org.osgi.service.jdbc;resolution:=optional,
>
>                                     When the Aries JPA Container
>                                     /ManagedPersistenceUnitInfoImpl
>                                     /class is called, Aries does a check
>                                     to verify if the OSGI service is
>                                     provided. If this is not the case,
>                                     the info is displayed in the log and
>                                     Aries JPA Container continues to
>                                     load the JPA Container based on your
>                                     config (persistence.xml, datasource,
>                                     ...). If you are using JPA, you
>                                     shouldn't use the DataSourceFactory.
>
>                                     These links could help you to
>                                     configure your project
>
>                                     /http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle/
>                                     /http://aries.apache.org/modules/jpaproject.html/
>                                     /
>                                     /
>
>                                     Regards,
>
>                                     Charles
>
>                                     On Mon, Oct 22, 2012 at 11:25 AM,
>                                     Bengt Rodehav <bengt@rodehav.com
>                                     <ma...@rodehav.com>> wrote:
>
>                                         I'm trying to upgrade fro Karaf
>                                         2.2.8 to Karaf 2.3.0 and have
>                                         run into a problem regarding
>                                         datasources. I get the following
>                                         in my log:
>
>                                         /2012-10-22 10:52:59,563 | INFO
>                                           | Thread-7         | container
>                                                                 |
>                                         l.ManagedPersistenceUnitInfoImpl
>                                            50 | The
>                                         org.osgi.service.jdbc package is
>                                         unavailable. As a result the
>                                         Aries JPA container will not
>                                         offer any DataSourceFactory
>                                         integration./
>
>                                         It's only an INFO message but it
>                                         seems fatal to me because later
>                                         on I cannot find my datasource
>                                         when I try to use it. I publish
>                                         a data source (for Derby) using
>                                         Blueprint. I use the following
>                                         features from the
>                                         karaf-enterprise descriptor:
>
>                                         - transaction
>                                         - jpa
>                                         - jndi
>
>                                         When I execute "exports | grep
>                                         -i org.osgi.service.jdbc" on the
>                                         command line I get an empty result.
>
>                                         It seems like this package is
>                                         needed for Aries JPA Container.
>                                         What bundle should export it?
>
>                                         /Bengt
>
>
>
>
>                                     --
>                                     Charles Moulliard
>                                     Apache Committer / Sr. Enterprise
>                                     Architect (RedHat)
>                                     Twitter : @cmoulliard | Blog :
>                                     http://cmoulliard.blogspot.com
>
>
>
>
>
>
>                             --
>                             Charles Moulliard
>                             Apache Committer / Sr. Enterprise Architect
>                             (RedHat)
>                             Twitter : @cmoulliard | Blog :
>                             http://cmoulliard.blogspot.com
>
>
>
>
>
>
>                     --
>                     Charles Moulliard
>                     Apache Committer / Sr. Enterprise Architect (RedHat)
>                     Twitter : @cmoulliard | Blog :
>                     http://cmoulliard.blogspot.com
>
>
>
>
>
>
>
>
>     --
>     Charles Moulliard
>     Apache Committer / Sr. Enterprise Architect (RedHat)
>     Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Done:

https://issues.apache.org/jira/browse/ARIES-950

/Bengt

2012/10/24 Charles Moulliard <ch...@gmail.com>

> Don't think that some commands exist but that should be interesting to
> have a jndi query command. Feel free to open a ticket for Aries project
>
>
> On Tue, Oct 23, 2012 at 3:56 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>
>> Hello Michael,
>>
>> I don't know what the best practice is. Are there any existing Karaf
>> commands (in either Karaf or Aries community) that concerns Aries
>> components?
>>
>> /Bengt
>>
>>
>> 2012/10/23 Michael Täschner <m....@gmail.com>
>>
>>> Hi Bengt,
>>>
>>> regarding the "jndi" command. I guess this should be requested at the
>>> Aries guys ? Or another karaf component for enriching Aries JNDI.
>>>
>>> Regards,
>>> Michael
>>>
>>>
>>> 2012/10/22 Bengt Rodehav <be...@rodehav.com>
>>>
>>>> Thanks for checking Charles. Do you know if there is a simple way to
>>>> check if jndi can resolve a query? If not, then a "jndi" command would be a
>>>> great add-on to Karaf.
>>>>
>>>> /Bengt
>>>>
>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>
>>>>> This is correct
>>>>>
>>>>>
>>>>> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>
>>>>>> Achim, no Grace Period for any of the bundles.
>>>>>>
>>>>>> Charles, "headers 151" gives me the following:
>>>>>>
>>>>>> *Connect :: filetransfer-history-domain (151)*
>>>>>> *--------------------------------------------*
>>>>>> *Manifest-Version = 1.0*
>>>>>> *Bnd-LastModified = 1350893282476*
>>>>>> *Tool = Bnd-0.0.357*
>>>>>> *Meta-Persistence = META-INF/persistence.xml*
>>>>>> *Built-By = berodeha*
>>>>>> *Implementation-Version = 2.3-SNAPSHOT*
>>>>>> *Build-Jdk = 1.6.0_32*
>>>>>> *Implementation-Title = Digia Connect*
>>>>>> *Created-By = Apache Maven Bundle Plugin*
>>>>>> *
>>>>>> *
>>>>>> *Bundle-Name = Connect :: filetransfer-history-domain*
>>>>>> *Bundle-SymbolicName =
>>>>>> se.digia.connect.services.filetransfer.history-domain*
>>>>>> *Bundle-Version = 2.3.0.SNAPSHOT*
>>>>>> *Bundle-ManifestVersion = 2*
>>>>>> *
>>>>>> *
>>>>>> *Import-Package =*
>>>>>> *        javax.persistence;resolution:=optional;version=1.1,*
>>>>>> *
>>>>>> javax.persistence.metamodel;resolution:=optional;version=1.1,*
>>>>>>  *
>>>>>> javax.validation.constraints;resolution:=optional;version=1.0,*
>>>>>> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,
>>>>>> *
>>>>>> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
>>>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>>>> *                resolution:=optional;*
>>>>>> *                version=2.3,*
>>>>>> *
>>>>>> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
>>>>>> *Export-Package =*
>>>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>>>> *                uses:="org.apache.openjpa.util,*
>>>>>> *                        se.digia.connect.util.persistence,*
>>>>>> *                        javax.validation.constraints,*
>>>>>> *                        org.apache.openjpa.enhance,*
>>>>>> *                        javax.persistence,*
>>>>>> *                        javax.persistence.metamodel";*
>>>>>> *                version=2.3.0.SNAPSHOT*
>>>>>>
>>>>>> I think this is correct. Also, this has worked for quite some time on
>>>>>> Karaf 2.2.8 (which had an older Aries version).
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>>
>>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>>
>>>>>>> Have you added Meta-Persistence metadata in the MANIFEST file ? I
>>>>>>> have created a ticket to provide a more end user message on the console (
>>>>>>> https://issues.apache.org/jira/browse/ARIES-945)
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>>>
>>>>>>>> Thanks for your reply Charles,
>>>>>>>>
>>>>>>>> Your're right I don't need the DataSourceFactory. I mistakenly
>>>>>>>> thought that the info message was connected to the problem with not finding
>>>>>>>> the data source via JNDI. Since everything has worked before (using Karaf
>>>>>>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>>>>>>> bundle (that exported the org.osgi.service.jdbc package). That's
>>>>>>>> why I thought it was a Karaf problem and not an Aries problem.
>>>>>>>>
>>>>>>>> So, I probably do not need the org.osgi.service.jdbc package - it
>>>>>>>> was a false lead. Still, I do have problems finding the data source via
>>>>>>>> jndi. I get:
>>>>>>>>
>>>>>>>> *
>>>>>>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>>>>>>                    | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>>>>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>>>>>>> required by bundle
>>>>>>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>>>>>>> not be found.
>>>>>>>> javax.naming.NameNotFoundException:
>>>>>>>> osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>>>>>>>> =jdbc/filetransferhistoryjta)"
>>>>>>>> at
>>>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>>>> at
>>>>>>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>>>>>>  at
>>>>>>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>>>>>>> at
>>>>>>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>>>>>>> at
>>>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>>>  at
>>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>>> ...
>>>>>>>> *
>>>>>>>>
>>>>>>>> But the data source seem to be published as a service, the command "ls
>>>>>>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following
>>>>>>>> output:
>>>>>>>>
>>>>>>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>>>>>>> *----------------------------------------------------------*
>>>>>>>> *javax.sql.XADataSource*
>>>>>>>> *javax.sql.DataSource*
>>>>>>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>>>>>>
>>>>>>>> I then execute "ls 153" and get:
>>>>>>>>
>>>>>>>> *
>>>>>>>> Connect :: filetransfer-history-datasource (153) provides:
>>>>>>>> ----------------------------------------------------------
>>>>>>>> objectClass = javax.sql.XADataSource
>>>>>>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>>>>>>> osgi.service.blueprint.compname = derbyXADataSource
>>>>>>>>  service.id = 493
>>>>>>>> ----
>>>>>>>> objectClass = javax.sql.DataSource
>>>>>>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>>>>>>> osgi.service.blueprint.compname = derbyDataSource
>>>>>>>> service.id = 494
>>>>>>>> ----
>>>>>>>> objectClass =
>>>>>>>> org.osgi.service.blueprint.container.BlueprintContainer
>>>>>>>> osgi.blueprint.container.symbolicname =
>>>>>>>> se.digia.connect.services.filetransfer.h
>>>>>>>> istory-datasource
>>>>>>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>>>>>>> service.id = 495
>>>>>>>> *
>>>>>>>>
>>>>>>>> To me it looks like the service is provided with the correct
>>>>>>>> properties. Maybe it's a jndi problem? I was hoping there was a "jndi"
>>>>>>>> command in the Karaf shell that I could use to see what can be resolved via
>>>>>>>> jndi but I can't find such a command.
>>>>>>>>
>>>>>>>> I've actually encountered another strange problem. On startup
>>>>>>>> everything looks fine. But when I try to access the webconsole - it's not
>>>>>>>> there. I then start to type "list" in the Karaf shell. But as soon as I
>>>>>>>> type the "l" I get the following message in the console:
>>>>>>>>
>>>>>>>> *karaf@root> lError executing command: read() with timeout cannot
>>>>>>>> be called as no*
>>>>>>>> *n-blocking operation is disabled*
>>>>>>>> *        __ __                  ____*
>>>>>>>> *       / //_/____ __________ _/ __/*
>>>>>>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>>>>>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>>>>>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>>>>>>> *
>>>>>>>> *
>>>>>>>> *  Apache Karaf (2.3.0)*
>>>>>>>> *
>>>>>>>> *
>>>>>>>> *Hit '<tab>' for a list of available commands*
>>>>>>>> *and '[cmd] --help' for help on a specific command.*
>>>>>>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>>>>>>
>>>>>>>> Note that the "Karaf" logo had already been shown so it's shown
>>>>>>>> twice. Also, in the log I get:
>>>>>>>>
>>>>>>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>>>>>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>>>>>>> Error installing boot features*
>>>>>>>> *java.lang.NullPointerException*
>>>>>>>> * at
>>>>>>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>>>>>>>> * at
>>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>>> *
>>>>>>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>>>>>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>>>>>>> Error persisting FeaturesService state*
>>>>>>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>>>>>>> * at
>>>>>>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>>> *
>>>>>>>> * at
>>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>>> *
>>>>>>>>
>>>>>>>> If I don't press a key in the shell, I never get these messages but
>>>>>>>> then the web service will never install. It's as if the installation is
>>>>>>>> hung, waiting for something.
>>>>>>>>
>>>>>>>> Do you or anyone have any clue as to what is happening. I am in the
>>>>>>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>>>>>>> I might have done something very wrong but right now I have no clue as to
>>>>>>>> where I should look further,
>>>>>>>>
>>>>>>>> /Bengt
>>>>>>>>
>>>>>>>>
>>>>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>>>>
>>>>>>>>> Bengt,
>>>>>>>>>
>>>>>>>>> This package is not required by Aries JPA as resolution is
>>>>>>>>> optional :
>>>>>>>>>
>>>>>>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>>>>>>
>>>>>>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>>>>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>>>>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>>>>>>> Container continues to load the JPA Container based on your config
>>>>>>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>>>>>>> the DataSourceFactory.
>>>>>>>>>
>>>>>>>>> These links could help you to configure your project
>>>>>>>>>
>>>>>>>>> *
>>>>>>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>>>>>>> *
>>>>>>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>>>>>>> *
>>>>>>>>> *
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Charles
>>>>>>>>>
>>>>>>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <bengt@rodehav.com
>>>>>>>>> > wrote:
>>>>>>>>>
>>>>>>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run
>>>>>>>>>> into a problem regarding datasources. I get the following in my log:
>>>>>>>>>>
>>>>>>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>>>>>>                        | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>>>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>>>>>>> container will not offer any DataSourceFactory integration.*
>>>>>>>>>>
>>>>>>>>>> It's only an INFO message but it seems fatal to me because later
>>>>>>>>>> on I cannot find my datasource when I try to use it. I publish a data
>>>>>>>>>> source (for Derby) using Blueprint. I use the following features from the
>>>>>>>>>> karaf-enterprise descriptor:
>>>>>>>>>>
>>>>>>>>>> - transaction
>>>>>>>>>> - jpa
>>>>>>>>>> - jndi
>>>>>>>>>>
>>>>>>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>>>>>>> command line I get an empty result.
>>>>>>>>>>
>>>>>>>>>> It seems like this package is needed for Aries JPA Container.
>>>>>>>>>> What bundle should export it?
>>>>>>>>>>
>>>>>>>>>> /Bengt
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Charles Moulliard
>>>>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Charles Moulliard
>>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Charles Moulliard
>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Charles Moulliard <ch...@gmail.com>.
Don't think that some commands exist but that should be interesting to have
a jndi query command. Feel free to open a ticket for Aries project

On Tue, Oct 23, 2012 at 3:56 PM, Bengt Rodehav <be...@rodehav.com> wrote:

> Hello Michael,
>
> I don't know what the best practice is. Are there any existing Karaf
> commands (in either Karaf or Aries community) that concerns Aries
> components?
>
> /Bengt
>
>
> 2012/10/23 Michael Täschner <m....@gmail.com>
>
>> Hi Bengt,
>>
>> regarding the "jndi" command. I guess this should be requested at the
>> Aries guys ? Or another karaf component for enriching Aries JNDI.
>>
>> Regards,
>> Michael
>>
>>
>> 2012/10/22 Bengt Rodehav <be...@rodehav.com>
>>
>>> Thanks for checking Charles. Do you know if there is a simple way to
>>> check if jndi can resolve a query? If not, then a "jndi" command would be a
>>> great add-on to Karaf.
>>>
>>> /Bengt
>>>
>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>
>>>> This is correct
>>>>
>>>>
>>>> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>
>>>>> Achim, no Grace Period for any of the bundles.
>>>>>
>>>>> Charles, "headers 151" gives me the following:
>>>>>
>>>>> *Connect :: filetransfer-history-domain (151)*
>>>>> *--------------------------------------------*
>>>>> *Manifest-Version = 1.0*
>>>>> *Bnd-LastModified = 1350893282476*
>>>>> *Tool = Bnd-0.0.357*
>>>>> *Meta-Persistence = META-INF/persistence.xml*
>>>>> *Built-By = berodeha*
>>>>> *Implementation-Version = 2.3-SNAPSHOT*
>>>>> *Build-Jdk = 1.6.0_32*
>>>>> *Implementation-Title = Digia Connect*
>>>>> *Created-By = Apache Maven Bundle Plugin*
>>>>> *
>>>>> *
>>>>> *Bundle-Name = Connect :: filetransfer-history-domain*
>>>>> *Bundle-SymbolicName =
>>>>> se.digia.connect.services.filetransfer.history-domain*
>>>>> *Bundle-Version = 2.3.0.SNAPSHOT*
>>>>> *Bundle-ManifestVersion = 2*
>>>>> *
>>>>> *
>>>>> *Import-Package =*
>>>>> *        javax.persistence;resolution:=optional;version=1.1,*
>>>>> *        javax.persistence.metamodel;resolution:=optional;version=1.1,
>>>>> *
>>>>>  *
>>>>> javax.validation.constraints;resolution:=optional;version=1.0,*
>>>>> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
>>>>> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
>>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>>> *                resolution:=optional;*
>>>>> *                version=2.3,*
>>>>> *
>>>>> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
>>>>> *Export-Package =*
>>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>>> *                uses:="org.apache.openjpa.util,*
>>>>> *                        se.digia.connect.util.persistence,*
>>>>> *                        javax.validation.constraints,*
>>>>> *                        org.apache.openjpa.enhance,*
>>>>> *                        javax.persistence,*
>>>>> *                        javax.persistence.metamodel";*
>>>>> *                version=2.3.0.SNAPSHOT*
>>>>>
>>>>> I think this is correct. Also, this has worked for quite some time on
>>>>> Karaf 2.2.8 (which had an older Aries version).
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>
>>>>>> Have you added Meta-Persistence metadata in the MANIFEST file ? I
>>>>>> have created a ticket to provide a more end user message on the console (
>>>>>> https://issues.apache.org/jira/browse/ARIES-945)
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>>
>>>>>>> Thanks for your reply Charles,
>>>>>>>
>>>>>>> Your're right I don't need the DataSourceFactory. I mistakenly
>>>>>>> thought that the info message was connected to the problem with not finding
>>>>>>> the data source via JNDI. Since everything has worked before (using Karaf
>>>>>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>>>>>> bundle (that exported the org.osgi.service.jdbc package). That's
>>>>>>> why I thought it was a Karaf problem and not an Aries problem.
>>>>>>>
>>>>>>> So, I probably do not need the org.osgi.service.jdbc package - it
>>>>>>> was a false lead. Still, I do have problems finding the data source via
>>>>>>> jndi. I get:
>>>>>>>
>>>>>>> *
>>>>>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>>>>>                  | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>>>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>>>>>> required by bundle
>>>>>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>>>>>> not be found.
>>>>>>> javax.naming.NameNotFoundException:
>>>>>>> osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>>>>>>> =jdbc/filetransferhistoryjta)"
>>>>>>> at
>>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>>>  at
>>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>>> at
>>>>>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>>>>>  at
>>>>>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>>>>>> at
>>>>>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>  at
>>>>>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>  at
>>>>>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>>>>>> at
>>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>>>>>  at
>>>>>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>>  at
>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>>  at
>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>>  at
>>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>> ...
>>>>>>> *
>>>>>>>
>>>>>>> But the data source seem to be published as a service, the command "ls
>>>>>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following
>>>>>>> output:
>>>>>>>
>>>>>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>>>>>> *----------------------------------------------------------*
>>>>>>> *javax.sql.XADataSource*
>>>>>>> *javax.sql.DataSource*
>>>>>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>>>>>
>>>>>>> I then execute "ls 153" and get:
>>>>>>>
>>>>>>> *
>>>>>>> Connect :: filetransfer-history-datasource (153) provides:
>>>>>>> ----------------------------------------------------------
>>>>>>> objectClass = javax.sql.XADataSource
>>>>>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>>>>>> osgi.service.blueprint.compname = derbyXADataSource
>>>>>>>  service.id = 493
>>>>>>> ----
>>>>>>> objectClass = javax.sql.DataSource
>>>>>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>>>>>> osgi.service.blueprint.compname = derbyDataSource
>>>>>>> service.id = 494
>>>>>>> ----
>>>>>>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>>>>>>> osgi.blueprint.container.symbolicname =
>>>>>>> se.digia.connect.services.filetransfer.h
>>>>>>> istory-datasource
>>>>>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>>>>>> service.id = 495
>>>>>>> *
>>>>>>>
>>>>>>> To me it looks like the service is provided with the correct
>>>>>>> properties. Maybe it's a jndi problem? I was hoping there was a "jndi"
>>>>>>> command in the Karaf shell that I could use to see what can be resolved via
>>>>>>> jndi but I can't find such a command.
>>>>>>>
>>>>>>> I've actually encountered another strange problem. On startup
>>>>>>> everything looks fine. But when I try to access the webconsole - it's not
>>>>>>> there. I then start to type "list" in the Karaf shell. But as soon as I
>>>>>>> type the "l" I get the following message in the console:
>>>>>>>
>>>>>>> *karaf@root> lError executing command: read() with timeout cannot
>>>>>>> be called as no*
>>>>>>> *n-blocking operation is disabled*
>>>>>>> *        __ __                  ____*
>>>>>>> *       / //_/____ __________ _/ __/*
>>>>>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>>>>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>>>>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>>>>>> *
>>>>>>> *
>>>>>>> *  Apache Karaf (2.3.0)*
>>>>>>> *
>>>>>>> *
>>>>>>> *Hit '<tab>' for a list of available commands*
>>>>>>> *and '[cmd] --help' for help on a specific command.*
>>>>>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>>>>>
>>>>>>> Note that the "Karaf" logo had already been shown so it's shown
>>>>>>> twice. Also, in the log I get:
>>>>>>>
>>>>>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>>>>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>>>>>> Error installing boot features*
>>>>>>> *java.lang.NullPointerException*
>>>>>>> * at
>>>>>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>> *
>>>>>>> * at
>>>>>>> java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>>>>>>> * at
>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>> *
>>>>>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>>>>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>>>>>> Error persisting FeaturesService state*
>>>>>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>>>>>> * at
>>>>>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>> *
>>>>>>> * at
>>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>>>>>> *
>>>>>>>
>>>>>>> If I don't press a key in the shell, I never get these messages but
>>>>>>> then the web service will never install. It's as if the installation is
>>>>>>> hung, waiting for something.
>>>>>>>
>>>>>>> Do you or anyone have any clue as to what is happening. I am in the
>>>>>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>>>>>> I might have done something very wrong but right now I have no clue as to
>>>>>>> where I should look further,
>>>>>>>
>>>>>>> /Bengt
>>>>>>>
>>>>>>>
>>>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>>>
>>>>>>>> Bengt,
>>>>>>>>
>>>>>>>> This package is not required by Aries JPA as resolution is optional
>>>>>>>> :
>>>>>>>>
>>>>>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>>>>>
>>>>>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>>>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>>>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>>>>>> Container continues to load the JPA Container based on your config
>>>>>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>>>>>> the DataSourceFactory.
>>>>>>>>
>>>>>>>> These links could help you to configure your project
>>>>>>>>
>>>>>>>> *
>>>>>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>>>>>> *
>>>>>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>>>>>> *
>>>>>>>> *
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Charles
>>>>>>>>
>>>>>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>>>>
>>>>>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run
>>>>>>>>> into a problem regarding datasources. I get the following in my log:
>>>>>>>>>
>>>>>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>>>>>                      | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>>>>>> container will not offer any DataSourceFactory integration.*
>>>>>>>>>
>>>>>>>>> It's only an INFO message but it seems fatal to me because later
>>>>>>>>> on I cannot find my datasource when I try to use it. I publish a data
>>>>>>>>> source (for Derby) using Blueprint. I use the following features from the
>>>>>>>>> karaf-enterprise descriptor:
>>>>>>>>>
>>>>>>>>> - transaction
>>>>>>>>> - jpa
>>>>>>>>> - jndi
>>>>>>>>>
>>>>>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>>>>>> command line I get an empty result.
>>>>>>>>>
>>>>>>>>> It seems like this package is needed for Aries JPA Container. What
>>>>>>>>> bundle should export it?
>>>>>>>>>
>>>>>>>>> /Bengt
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Charles Moulliard
>>>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Charles Moulliard
>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Charles Moulliard
>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>>>
>>>
>>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Hello Michael,

I don't know what the best practice is. Are there any existing Karaf
commands (in either Karaf or Aries community) that concerns Aries
components?

/Bengt

2012/10/23 Michael Täschner <m....@gmail.com>

> Hi Bengt,
>
> regarding the "jndi" command. I guess this should be requested at the
> Aries guys ? Or another karaf component for enriching Aries JNDI.
>
> Regards,
> Michael
>
>
> 2012/10/22 Bengt Rodehav <be...@rodehav.com>
>
>> Thanks for checking Charles. Do you know if there is a simple way to
>> check if jndi can resolve a query? If not, then a "jndi" command would be a
>> great add-on to Karaf.
>>
>> /Bengt
>>
>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>
>>> This is correct
>>>
>>>
>>> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>
>>>> Achim, no Grace Period for any of the bundles.
>>>>
>>>> Charles, "headers 151" gives me the following:
>>>>
>>>> *Connect :: filetransfer-history-domain (151)*
>>>> *--------------------------------------------*
>>>> *Manifest-Version = 1.0*
>>>> *Bnd-LastModified = 1350893282476*
>>>> *Tool = Bnd-0.0.357*
>>>> *Meta-Persistence = META-INF/persistence.xml*
>>>> *Built-By = berodeha*
>>>> *Implementation-Version = 2.3-SNAPSHOT*
>>>> *Build-Jdk = 1.6.0_32*
>>>> *Implementation-Title = Digia Connect*
>>>> *Created-By = Apache Maven Bundle Plugin*
>>>> *
>>>> *
>>>> *Bundle-Name = Connect :: filetransfer-history-domain*
>>>> *Bundle-SymbolicName =
>>>> se.digia.connect.services.filetransfer.history-domain*
>>>> *Bundle-Version = 2.3.0.SNAPSHOT*
>>>> *Bundle-ManifestVersion = 2*
>>>> *
>>>> *
>>>> *Import-Package =*
>>>> *        javax.persistence;resolution:=optional;version=1.1,*
>>>> *        javax.persistence.metamodel;resolution:=optional;version=1.1,*
>>>>  *
>>>> javax.validation.constraints;resolution:=optional;version=1.0,*
>>>> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
>>>> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>> *                resolution:=optional;*
>>>> *                version=2.3,*
>>>> *
>>>> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
>>>> *Export-Package =*
>>>> *        se.digia.connect.filetransfer.history.domain;*
>>>> *                uses:="org.apache.openjpa.util,*
>>>> *                        se.digia.connect.util.persistence,*
>>>> *                        javax.validation.constraints,*
>>>> *                        org.apache.openjpa.enhance,*
>>>> *                        javax.persistence,*
>>>> *                        javax.persistence.metamodel";*
>>>> *                version=2.3.0.SNAPSHOT*
>>>>
>>>> I think this is correct. Also, this has worked for quite some time on
>>>> Karaf 2.2.8 (which had an older Aries version).
>>>>
>>>> /Bengt
>>>>
>>>>
>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>
>>>>> Have you added Meta-Persistence metadata in the MANIFEST file ? I have
>>>>> created a ticket to provide a more end user message on the console (
>>>>> https://issues.apache.org/jira/browse/ARIES-945)
>>>>>
>>>>>
>>>>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>
>>>>>> Thanks for your reply Charles,
>>>>>>
>>>>>> Your're right I don't need the DataSourceFactory. I mistakenly
>>>>>> thought that the info message was connected to the problem with not finding
>>>>>> the data source via JNDI. Since everything has worked before (using Karaf
>>>>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>>>>> bundle (that exported the org.osgi.service.jdbc package). That's why
>>>>>> I thought it was a Karaf problem and not an Aries problem.
>>>>>>
>>>>>> So, I probably do not need the org.osgi.service.jdbc package - it
>>>>>> was a false lead. Still, I do have problems finding the data source via
>>>>>> jndi. I get:
>>>>>>
>>>>>> *
>>>>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>>>>                  | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>>>>> required by bundle
>>>>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>>>>> not be found.
>>>>>> javax.naming.NameNotFoundException:
>>>>>> osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>>>>>> =jdbc/filetransferhistoryjta)"
>>>>>> at
>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>>  at
>>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>> at
>>>>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>>>>  at
>>>>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>>>>> at
>>>>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>  at
>>>>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>  at
>>>>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>>>>> at
>>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>>>>  at
>>>>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>>  at
>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>  at
>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>>  at
>>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>> ...
>>>>>> *
>>>>>>
>>>>>> But the data source seem to be published as a service, the command "ls
>>>>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>>>>>>
>>>>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>>>>> *----------------------------------------------------------*
>>>>>> *javax.sql.XADataSource*
>>>>>> *javax.sql.DataSource*
>>>>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>>>>
>>>>>> I then execute "ls 153" and get:
>>>>>>
>>>>>> *
>>>>>> Connect :: filetransfer-history-datasource (153) provides:
>>>>>> ----------------------------------------------------------
>>>>>> objectClass = javax.sql.XADataSource
>>>>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>>>>> osgi.service.blueprint.compname = derbyXADataSource
>>>>>>  service.id = 493
>>>>>> ----
>>>>>> objectClass = javax.sql.DataSource
>>>>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>>>>> osgi.service.blueprint.compname = derbyDataSource
>>>>>> service.id = 494
>>>>>> ----
>>>>>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>>>>>> osgi.blueprint.container.symbolicname =
>>>>>> se.digia.connect.services.filetransfer.h
>>>>>> istory-datasource
>>>>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>>>>> service.id = 495
>>>>>> *
>>>>>>
>>>>>> To me it looks like the service is provided with the correct
>>>>>> properties. Maybe it's a jndi problem? I was hoping there was a "jndi"
>>>>>> command in the Karaf shell that I could use to see what can be resolved via
>>>>>> jndi but I can't find such a command.
>>>>>>
>>>>>> I've actually encountered another strange problem. On startup
>>>>>> everything looks fine. But when I try to access the webconsole - it's not
>>>>>> there. I then start to type "list" in the Karaf shell. But as soon as I
>>>>>> type the "l" I get the following message in the console:
>>>>>>
>>>>>> *karaf@root> lError executing command: read() with timeout cannot be
>>>>>> called as no*
>>>>>> *n-blocking operation is disabled*
>>>>>> *        __ __                  ____*
>>>>>> *       / //_/____ __________ _/ __/*
>>>>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>>>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>>>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>>>>> *
>>>>>> *
>>>>>> *  Apache Karaf (2.3.0)*
>>>>>> *
>>>>>> *
>>>>>> *Hit '<tab>' for a list of available commands*
>>>>>> *and '[cmd] --help' for help on a specific command.*
>>>>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>>>>
>>>>>> Note that the "Karaf" logo had already been shown so it's shown
>>>>>> twice. Also, in the log I get:
>>>>>>
>>>>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>>>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>>>>> Error installing boot features*
>>>>>> *java.lang.NullPointerException*
>>>>>> * at
>>>>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>>>>> *
>>>>>> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>>>>> *
>>>>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>>>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>>>>> Error persisting FeaturesService state*
>>>>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>>>>> * at
>>>>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>>>>> *
>>>>>> * at
>>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>>>>> *
>>>>>>
>>>>>> If I don't press a key in the shell, I never get these messages but
>>>>>> then the web service will never install. It's as if the installation is
>>>>>> hung, waiting for something.
>>>>>>
>>>>>> Do you or anyone have any clue as to what is happening. I am in the
>>>>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>>>>> I might have done something very wrong but right now I have no clue as to
>>>>>> where I should look further,
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>>
>>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>>
>>>>>>> Bengt,
>>>>>>>
>>>>>>> This package is not required by Aries JPA as resolution is optional :
>>>>>>>
>>>>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>>>>
>>>>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>>>>> Container continues to load the JPA Container based on your config
>>>>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>>>>> the DataSourceFactory.
>>>>>>>
>>>>>>> These links could help you to configure your project
>>>>>>>
>>>>>>> *
>>>>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>>>>> *
>>>>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>>>>> *
>>>>>>> *
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles
>>>>>>>
>>>>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>>>
>>>>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run
>>>>>>>> into a problem regarding datasources. I get the following in my log:
>>>>>>>>
>>>>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>>>>                      | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>>>>> container will not offer any DataSourceFactory integration.*
>>>>>>>>
>>>>>>>> It's only an INFO message but it seems fatal to me because later on
>>>>>>>> I cannot find my datasource when I try to use it. I publish a data source
>>>>>>>> (for Derby) using Blueprint. I use the following features from the
>>>>>>>> karaf-enterprise descriptor:
>>>>>>>>
>>>>>>>> - transaction
>>>>>>>> - jpa
>>>>>>>> - jndi
>>>>>>>>
>>>>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>>>>> command line I get an empty result.
>>>>>>>>
>>>>>>>> It seems like this package is needed for Aries JPA Container. What
>>>>>>>> bundle should export it?
>>>>>>>>
>>>>>>>> /Bengt
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Charles Moulliard
>>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Charles Moulliard
>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Charles Moulliard
>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Michael Täschner <m....@gmail.com>.
Hi Bengt,

regarding the "jndi" command. I guess this should be requested at the Aries
guys ? Or another karaf component for enriching Aries JNDI.

Regards,
Michael

2012/10/22 Bengt Rodehav <be...@rodehav.com>

> Thanks for checking Charles. Do you know if there is a simple way to check
> if jndi can resolve a query? If not, then a "jndi" command would be a great
> add-on to Karaf.
>
> /Bengt
>
> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>
>> This is correct
>>
>>
>> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>>
>>> Achim, no Grace Period for any of the bundles.
>>>
>>> Charles, "headers 151" gives me the following:
>>>
>>> *Connect :: filetransfer-history-domain (151)*
>>> *--------------------------------------------*
>>> *Manifest-Version = 1.0*
>>> *Bnd-LastModified = 1350893282476*
>>> *Tool = Bnd-0.0.357*
>>> *Meta-Persistence = META-INF/persistence.xml*
>>> *Built-By = berodeha*
>>> *Implementation-Version = 2.3-SNAPSHOT*
>>> *Build-Jdk = 1.6.0_32*
>>> *Implementation-Title = Digia Connect*
>>> *Created-By = Apache Maven Bundle Plugin*
>>> *
>>> *
>>> *Bundle-Name = Connect :: filetransfer-history-domain*
>>> *Bundle-SymbolicName =
>>> se.digia.connect.services.filetransfer.history-domain*
>>> *Bundle-Version = 2.3.0.SNAPSHOT*
>>> *Bundle-ManifestVersion = 2*
>>> *
>>> *
>>> *Import-Package =*
>>> *        javax.persistence;resolution:=optional;version=1.1,*
>>> *        javax.persistence.metamodel;resolution:=optional;version=1.1,*
>>>  *        javax.validation.constraints;resolution:=optional;version=1.0,
>>> *
>>> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
>>> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
>>> *        se.digia.connect.filetransfer.history.domain;*
>>> *                resolution:=optional;*
>>> *                version=2.3,*
>>> *
>>> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
>>> *Export-Package =*
>>> *        se.digia.connect.filetransfer.history.domain;*
>>> *                uses:="org.apache.openjpa.util,*
>>> *                        se.digia.connect.util.persistence,*
>>> *                        javax.validation.constraints,*
>>> *                        org.apache.openjpa.enhance,*
>>> *                        javax.persistence,*
>>> *                        javax.persistence.metamodel";*
>>> *                version=2.3.0.SNAPSHOT*
>>>
>>> I think this is correct. Also, this has worked for quite some time on
>>> Karaf 2.2.8 (which had an older Aries version).
>>>
>>> /Bengt
>>>
>>>
>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>
>>>> Have you added Meta-Persistence metadata in the MANIFEST file ? I have
>>>> created a ticket to provide a more end user message on the console (
>>>> https://issues.apache.org/jira/browse/ARIES-945)
>>>>
>>>>
>>>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>
>>>>> Thanks for your reply Charles,
>>>>>
>>>>> Your're right I don't need the DataSourceFactory. I mistakenly thought
>>>>> that the info message was connected to the problem with not finding the
>>>>> data source via JNDI. Since everything has worked before (using Karaf
>>>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>>>> bundle (that exported the org.osgi.service.jdbc package). That's why
>>>>> I thought it was a Karaf problem and not an Aries problem.
>>>>>
>>>>> So, I probably do not need the org.osgi.service.jdbc package - it was
>>>>> a false lead. Still, I do have problems finding the data source via jndi. I
>>>>> get:
>>>>>
>>>>> *
>>>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>>>                | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>>>> required by bundle
>>>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>>>> not be found.
>>>>> javax.naming.NameNotFoundException:
>>>>> osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>>>>> =jdbc/filetransferhistoryjta)"
>>>>> at
>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>>>  at
>>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>>>> at
>>>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>>>  at
>>>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>>>> at
>>>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>  at
>>>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>  at
>>>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>>>> at
>>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>>>  at
>>>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>>>  at
>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>  at
>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>>  at
>>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>> ...
>>>>> *
>>>>>
>>>>> But the data source seem to be published as a service, the command "ls
>>>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>>>>>
>>>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>>>> *----------------------------------------------------------*
>>>>> *javax.sql.XADataSource*
>>>>> *javax.sql.DataSource*
>>>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>>>
>>>>> I then execute "ls 153" and get:
>>>>>
>>>>> *
>>>>> Connect :: filetransfer-history-datasource (153) provides:
>>>>> ----------------------------------------------------------
>>>>> objectClass = javax.sql.XADataSource
>>>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>>>> osgi.service.blueprint.compname = derbyXADataSource
>>>>>  service.id = 493
>>>>> ----
>>>>> objectClass = javax.sql.DataSource
>>>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>>>> osgi.service.blueprint.compname = derbyDataSource
>>>>> service.id = 494
>>>>> ----
>>>>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>>>>> osgi.blueprint.container.symbolicname =
>>>>> se.digia.connect.services.filetransfer.h
>>>>> istory-datasource
>>>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>>>> service.id = 495
>>>>> *
>>>>>
>>>>> To me it looks like the service is provided with the correct
>>>>> properties. Maybe it's a jndi problem? I was hoping there was a "jndi"
>>>>> command in the Karaf shell that I could use to see what can be resolved via
>>>>> jndi but I can't find such a command.
>>>>>
>>>>> I've actually encountered another strange problem. On startup
>>>>> everything looks fine. But when I try to access the webconsole - it's not
>>>>> there. I then start to type "list" in the Karaf shell. But as soon as I
>>>>> type the "l" I get the following message in the console:
>>>>>
>>>>> *karaf@root> lError executing command: read() with timeout cannot be
>>>>> called as no*
>>>>> *n-blocking operation is disabled*
>>>>> *        __ __                  ____*
>>>>> *       / //_/____ __________ _/ __/*
>>>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>>>> *
>>>>> *
>>>>> *  Apache Karaf (2.3.0)*
>>>>> *
>>>>> *
>>>>> *Hit '<tab>' for a list of available commands*
>>>>> *and '[cmd] --help' for help on a specific command.*
>>>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>>>
>>>>> Note that the "Karaf" logo had already been shown so it's shown twice.
>>>>> Also, in the log I get:
>>>>>
>>>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>>>> Error installing boot features*
>>>>> *java.lang.NullPointerException*
>>>>> * at
>>>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>>>> *
>>>>> * at
>>>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>>>> *
>>>>> * at
>>>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>>>> *
>>>>> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>>>>> * at
>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>>>> *
>>>>> * at
>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>>>> *
>>>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>>>> Error persisting FeaturesService state*
>>>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>>>> * at
>>>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>>>> *
>>>>> * at
>>>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>>>> *
>>>>> * at
>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>>>> *
>>>>> * at
>>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>>>> *
>>>>>
>>>>> If I don't press a key in the shell, I never get these messages but
>>>>> then the web service will never install. It's as if the installation is
>>>>> hung, waiting for something.
>>>>>
>>>>> Do you or anyone have any clue as to what is happening. I am in the
>>>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>>>> I might have done something very wrong but right now I have no clue as to
>>>>> where I should look further,
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>>
>>>>>> Bengt,
>>>>>>
>>>>>> This package is not required by Aries JPA as resolution is optional :
>>>>>>
>>>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>>>
>>>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>>>> Container continues to load the JPA Container based on your config
>>>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>>>> the DataSourceFactory.
>>>>>>
>>>>>> These links could help you to configure your project
>>>>>>
>>>>>> *
>>>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>>>> *
>>>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>>>> *
>>>>>> *
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles
>>>>>>
>>>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>>
>>>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run
>>>>>>> into a problem regarding datasources. I get the following in my log:
>>>>>>>
>>>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>>>                    | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>>>> container will not offer any DataSourceFactory integration.*
>>>>>>>
>>>>>>> It's only an INFO message but it seems fatal to me because later on
>>>>>>> I cannot find my datasource when I try to use it. I publish a data source
>>>>>>> (for Derby) using Blueprint. I use the following features from the
>>>>>>> karaf-enterprise descriptor:
>>>>>>>
>>>>>>> - transaction
>>>>>>> - jpa
>>>>>>> - jndi
>>>>>>>
>>>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>>>> command line I get an empty result.
>>>>>>>
>>>>>>> It seems like this package is needed for Aries JPA Container. What
>>>>>>> bundle should export it?
>>>>>>>
>>>>>>> /Bengt
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Charles Moulliard
>>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Charles Moulliard
>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for checking Charles. Do you know if there is a simple way to check
if jndi can resolve a query? If not, then a "jndi" command would be a great
add-on to Karaf.

/Bengt

2012/10/22 Charles Moulliard <ch...@gmail.com>

> This is correct
>
>
> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>
>> Achim, no Grace Period for any of the bundles.
>>
>> Charles, "headers 151" gives me the following:
>>
>> *Connect :: filetransfer-history-domain (151)*
>> *--------------------------------------------*
>> *Manifest-Version = 1.0*
>> *Bnd-LastModified = 1350893282476*
>> *Tool = Bnd-0.0.357*
>> *Meta-Persistence = META-INF/persistence.xml*
>> *Built-By = berodeha*
>> *Implementation-Version = 2.3-SNAPSHOT*
>> *Build-Jdk = 1.6.0_32*
>> *Implementation-Title = Digia Connect*
>> *Created-By = Apache Maven Bundle Plugin*
>> *
>> *
>> *Bundle-Name = Connect :: filetransfer-history-domain*
>> *Bundle-SymbolicName =
>> se.digia.connect.services.filetransfer.history-domain*
>> *Bundle-Version = 2.3.0.SNAPSHOT*
>> *Bundle-ManifestVersion = 2*
>> *
>> *
>> *Import-Package =*
>> *        javax.persistence;resolution:=optional;version=1.1,*
>> *        javax.persistence.metamodel;resolution:=optional;version=1.1,*
>>  *        javax.validation.constraints;resolution:=optional;version=1.0,*
>> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
>> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
>> *        se.digia.connect.filetransfer.history.domain;*
>> *                resolution:=optional;*
>> *                version=2.3,*
>> *
>> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
>> *Export-Package =*
>> *        se.digia.connect.filetransfer.history.domain;*
>> *                uses:="org.apache.openjpa.util,*
>> *                        se.digia.connect.util.persistence,*
>> *                        javax.validation.constraints,*
>> *                        org.apache.openjpa.enhance,*
>> *                        javax.persistence,*
>> *                        javax.persistence.metamodel";*
>> *                version=2.3.0.SNAPSHOT*
>>
>> I think this is correct. Also, this has worked for quite some time on
>> Karaf 2.2.8 (which had an older Aries version).
>>
>> /Bengt
>>
>>
>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>
>>> Have you added Meta-Persistence metadata in the MANIFEST file ? I have
>>> created a ticket to provide a more end user message on the console (
>>> https://issues.apache.org/jira/browse/ARIES-945)
>>>
>>>
>>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>
>>>> Thanks for your reply Charles,
>>>>
>>>> Your're right I don't need the DataSourceFactory. I mistakenly thought
>>>> that the info message was connected to the problem with not finding the
>>>> data source via JNDI. Since everything has worked before (using Karaf
>>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>>> bundle (that exported the org.osgi.service.jdbc package). That's why I
>>>> thought it was a Karaf problem and not an Aries problem.
>>>>
>>>> So, I probably do not need the org.osgi.service.jdbc package - it was
>>>> a false lead. Still, I do have problems finding the data source via jndi. I
>>>> get:
>>>>
>>>> *
>>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>>                | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>>> required by bundle
>>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>>> not be found.
>>>> javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(
>>>> osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
>>>> at
>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>>  at
>>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>>> at
>>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>>  at
>>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>>> at
>>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>>  at
>>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>>  at
>>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>>> at
>>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>>  at
>>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>>  at
>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>  at
>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>>  at
>>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>> ...
>>>> *
>>>>
>>>> But the data source seem to be published as a service, the command "ls
>>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>>>>
>>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>>> *----------------------------------------------------------*
>>>> *javax.sql.XADataSource*
>>>> *javax.sql.DataSource*
>>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>>
>>>> I then execute "ls 153" and get:
>>>>
>>>> *
>>>> Connect :: filetransfer-history-datasource (153) provides:
>>>> ----------------------------------------------------------
>>>> objectClass = javax.sql.XADataSource
>>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>>> osgi.service.blueprint.compname = derbyXADataSource
>>>>  service.id = 493
>>>> ----
>>>> objectClass = javax.sql.DataSource
>>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>>> osgi.service.blueprint.compname = derbyDataSource
>>>> service.id = 494
>>>> ----
>>>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>>>> osgi.blueprint.container.symbolicname =
>>>> se.digia.connect.services.filetransfer.h
>>>> istory-datasource
>>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>>> service.id = 495
>>>> *
>>>>
>>>> To me it looks like the service is provided with the correct
>>>> properties. Maybe it's a jndi problem? I was hoping there was a "jndi"
>>>> command in the Karaf shell that I could use to see what can be resolved via
>>>> jndi but I can't find such a command.
>>>>
>>>> I've actually encountered another strange problem. On startup
>>>> everything looks fine. But when I try to access the webconsole - it's not
>>>> there. I then start to type "list" in the Karaf shell. But as soon as I
>>>> type the "l" I get the following message in the console:
>>>>
>>>> *karaf@root> lError executing command: read() with timeout cannot be
>>>> called as no*
>>>> *n-blocking operation is disabled*
>>>> *        __ __                  ____*
>>>> *       / //_/____ __________ _/ __/*
>>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>>> *
>>>> *
>>>> *  Apache Karaf (2.3.0)*
>>>> *
>>>> *
>>>> *Hit '<tab>' for a list of available commands*
>>>> *and '[cmd] --help' for help on a specific command.*
>>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>>
>>>> Note that the "Karaf" logo had already been shown so it's shown twice.
>>>> Also, in the log I get:
>>>>
>>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>>> Error installing boot features*
>>>> *java.lang.NullPointerException*
>>>> * at
>>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>>> *
>>>> * at
>>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>>> *
>>>> * at
>>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>>> *
>>>> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>>>> * at
>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>>> *
>>>> * at
>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>>> *
>>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>>> Error persisting FeaturesService state*
>>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>>> * at
>>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>>> *
>>>> * at
>>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>>> *
>>>> * at
>>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>>> *
>>>> * at
>>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>>> *
>>>>
>>>> If I don't press a key in the shell, I never get these messages but
>>>> then the web service will never install. It's as if the installation is
>>>> hung, waiting for something.
>>>>
>>>> Do you or anyone have any clue as to what is happening. I am in the
>>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>>> I might have done something very wrong but right now I have no clue as to
>>>> where I should look further,
>>>>
>>>> /Bengt
>>>>
>>>>
>>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>>
>>>>> Bengt,
>>>>>
>>>>> This package is not required by Aries JPA as resolution is optional :
>>>>>
>>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>>
>>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>>> Container continues to load the JPA Container based on your config
>>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>>> the DataSourceFactory.
>>>>>
>>>>> These links could help you to configure your project
>>>>>
>>>>> *
>>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>>> *
>>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>>> *
>>>>> *
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles
>>>>>
>>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>>
>>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run
>>>>>> into a problem regarding datasources. I get the following in my log:
>>>>>>
>>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>>                    | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>>> container will not offer any DataSourceFactory integration.*
>>>>>>
>>>>>> It's only an INFO message but it seems fatal to me because later on I
>>>>>> cannot find my datasource when I try to use it. I publish a data source
>>>>>> (for Derby) using Blueprint. I use the following features from the
>>>>>> karaf-enterprise descriptor:
>>>>>>
>>>>>> - transaction
>>>>>> - jpa
>>>>>> - jndi
>>>>>>
>>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>>> command line I get an empty result.
>>>>>>
>>>>>> It seems like this package is needed for Aries JPA Container. What
>>>>>> bundle should export it?
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Charles Moulliard
>>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Charles Moulliard
>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for the info JB. Will check if that package was available in my
previous custom distribution (based on Karaf 2.2.8). If not, then it is
probably not needed.

Loooks like a jndi problem to me since I can verify that the service is
actually published but it cannot be found via jndi.

/Bengt

2012/10/22 Jean-Baptiste Onofré <jb...@nanthrax.net>

> FYI,
>
> there is a change in the location of the org.osgi.service.jdbc package
> (especially org.osgi.service.jdbc.**DataSourceFactory):
>
> In Karaf 2.2.x, which use OSGi r4.2, this package was provided in
> org.osgi.enterprise.
>
> In Karaf 2.3.x, which use OSGi r4.3, this package was provided in
> org.osgi.compendium.
>
> In next release using OSGi r5.0.0, it's back in org.osgi.enterprise.
>
> So check the exported packages and the import in your bundle (especially
> if you use a Required-Bundle).
>
> Regards
> JB
>
>
> On 10/22/2012 04:06 PM, Charles Moulliard wrote:
>
>> This is correct
>>
>> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <bengt@rodehav.com
>> <ma...@rodehav.com>> wrote:
>>
>>     Achim, no Grace Period for any of the bundles.
>>
>>     Charles, "headers 151" gives me the following:
>>
>>     /Connect :: filetransfer-history-domain (151)/
>>     /-----------------------------**---------------/
>>     /Manifest-Version = 1.0/
>>     /Bnd-LastModified = 1350893282476/
>>     /Tool = Bnd-0.0.357/
>>     /Meta-Persistence = META-INF/persistence.xml/
>>     /Built-By = berodeha/
>>     /Implementation-Version = 2.3-SNAPSHOT/
>>     /Build-Jdk = 1.6.0_32/
>>     /Implementation-Title = Digia Connect/
>>     /Created-By = Apache Maven Bundle Plugin/
>>     /
>>     /
>>     /Bundle-Name = Connect :: filetransfer-history-domain/
>>     /Bundle-SymbolicName =
>>     se.digia.connect.services.**filetransfer.history-domain/
>>     /Bundle-Version = 2.3.0.SNAPSHOT/
>>     /Bundle-ManifestVersion = 2/
>>     /
>>     /
>>     /Import-Package =/
>>     /        javax.persistence;resolution:=**optional;version=1.1,/
>>     /        javax.persistence.metamodel;**resolution:=optional;version=*
>> *1.1,/
>>     /        javax.validation.constraints;**resolution:=optional;version=
>> **1.0,/
>>     /        org.apache.openjpa.enhance;**resolution:=optional;version=**
>> 2.1,/
>>     /        org.apache.openjpa.util;**resolution:=optional;version=**
>> 2.1,/
>>     /        se.digia.connect.filetransfer.**history.domain;/
>>     /                resolution:=optional;/
>>     /                version=2.3,/
>>     /
>>     se.digia.connect.util.**persistence;resolution:=**
>> optional;version=2.3/
>>     /Export-Package =/
>>     /        se.digia.connect.filetransfer.**history.domain;/
>>     /                uses:="org.apache.openjpa.**util,/
>>     /                        se.digia.connect.util.**persistence,/
>>     /                        javax.validation.constraints,/
>>     /                        org.apache.openjpa.enhance,/
>>     /                        javax.persistence,/
>>     /                        javax.persistence.metamodel";/
>>     /                version=2.3.0.SNAPSHOT/
>>
>>
>>     I think this is correct. Also, this has worked for quite some time
>>     on Karaf 2.2.8 (which had an older Aries version).
>>
>>     /Bengt
>>
>>
>>     2012/10/22 Charles Moulliard <ch007m@gmail.com
>>     <ma...@gmail.com>>
>>
>>
>>         Have you added Meta-Persistence metadata in the MANIFEST file ?
>>         I have created a ticket to provide a more end user message on
>>         the console (https://issues.apache.org/**jira/browse/ARIES-945<https://issues.apache.org/jira/browse/ARIES-945>
>> )
>>
>>
>>         On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav
>>         <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>>
>>             Thanks for your reply Charles,
>>
>>             Your're right I don't need the DataSourceFactory. I
>>             mistakenly thought that the info message was connected to
>>             the problem with not finding the data source via JNDI. Since
>>             everything has worked before (using Karaf 2.2.8) I assumed
>>             that the feature descriptor   in Karaf 2.3.0 lacked a bundle
>>             (that exported the org.osgi.service.jdbc package). That's
>>             why I thought it was a Karaf problem and not an Aries problem.
>>
>>             So, I probably do not need the org.osgi.service.jdbc package
>>             - it was a false lead. Still, I do have problems finding the
>>             data source via jndi. I get:
>>
>>             /
>>             2012-10-22 13:36:23,428 | ERROR | y/api/getEntries |
>>             container                        |
>>             ntainer.unit.impl.**JndiDataSource   85 | The DataSource
>>             osgi:service/javax.sql.**DataSource/(osgi.jndi.service.**name<http://osgi.jndi.service.name>
>>             <http://osgi.jndi.service.name**
>> >=jdbc/filetransferhistoryjta)
>>
>>             required by bundle
>>             se.digia.connect.services.**filetransfer.history-domain/2.**
>> 3.0.SNAPSHOT
>>             could not be found.
>>             javax.naming.**NameNotFoundException:
>>             osgi:service/javax.sql.**DataSource/"(osgi.jndi.**
>> service.name <http://osgi.jndi.service.name>
>>             <http://osgi.jndi.service.name**
>> >=jdbc/filetransferhistoryjta)**"
>>
>>             at
>>             org.apache.aries.jndi.url.**ServiceRegistryContext.lookup(**
>> ServiceRegistryContext.java:**113)[139:org.apache.aries.**jndi.url:1.0.0]
>>             at
>>             org.apache.aries.jndi.url.**ServiceRegistryContext.lookup(**
>> ServiceRegistryContext.java:**144)[139:org.apache.aries.**jndi.url:1.0.0]
>>             at
>>             org.apache.aries.jndi.**DelegateContext.lookup(**
>> DelegateContext.java:161)[137:**org.apache.aries.jndi.core:1.**0.0]
>>             at
>>             javax.naming.InitialContext.**lookup(InitialContext.java:**
>> 392)[:1.6.0_32]
>>             at
>>             org.apache.aries.jpa.**container.unit.impl.**
>> JndiDataSource.getDs(**JndiDataSource.java:65)[134:**
>> org.apache.aries.jpa.**container:1.0.0]
>>             at
>>             org.apache.aries.jpa.**container.unit.impl.**
>> DelayedLookupDataSource.**getConnection(**DelayedLookupDataSource.java:**
>> 36)[134:org.apache.aries.jpa.**container:1.0.0]
>>             at
>>             org.apache.openjpa.lib.jdbc.**DelegatingDataSource.**
>> getConnection(**DelegatingDataSource.java:137)**
>> [142:org.apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.lib.jdbc.**DecoratingDataSource.**
>> getConnection(**DecoratingDataSource.java:112)**
>> [142:org.apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.jdbc.**schema.DataSourceFactory.**
>> installDBDictionary(**DataSourceFactory.java:239)[**
>> 142:org.apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.jdbc.conf.**JDBCConfigurationImpl.**
>> getConnectionFactory(**JDBCConfigurationImpl.java:**
>> 733)[142:org.apache.openjpa:2.**1.1]
>>             at
>>             org.apache.openjpa.jdbc.conf.**JDBCConfigurationImpl.**
>> getDataSource(**JDBCConfigurationImpl.java:**
>> 872)[142:org.apache.openjpa:2.**1.1]
>>             at
>>             org.apache.openjpa.jdbc.**kernel.JDBCStoreManager.**
>> getDataSource(**JDBCStoreManager.java:179)[**
>> 142:org.apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.jdbc.**kernel.JDBCStoreManager.**
>> setContext(JDBCStoreManager.**java:162)[142:org.apache.**openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.jdbc.**kernel.JDBCStoreManager.**
>> setContext(JDBCStoreManager.**java:148)[142:org.apache.**openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.kernel.**DelegatingStoreManager.**
>> setContext(**DelegatingStoreManager.java:**79)[142:org.apache.openjpa:2.*
>> *1.1]
>>             at
>>             org.apache.openjpa.kernel.**BrokerImpl.initialize(**
>> BrokerImpl.java:369)[142:org.**apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.kernel.**BrokerImpl.initialize(**
>> BrokerImpl.java:323)[142:org.**apache.openjpa:2.1.1]
>>             at
>>             org.apache.openjpa.kernel.**AbstractBrokerFactory.**
>> initializeBroker(**AbstractBrokerFactory.java:**
>> 229)[142:org.apache.openjpa:2.**1.1]
>>             at
>>             org.apache.openjpa.kernel.**AbstractBrokerFactory.**
>> newBroker(**AbstractBrokerFactory.java:**213)[142:org.apache.openjpa:2.**
>> 1.1]
>>             at
>>             org.apache.openjpa.kernel.**DelegatingBrokerFactory.**
>> newBroker(**DelegatingBrokerFactory.java:**156)[142:org.apache.openjpa:2.
>> **1.1]
>>             at
>>             org.apache.openjpa.**persistence.**EntityManagerFactoryImpl.*
>> *createEntityManager(**EntityManagerFactoryImpl.java:**
>> 227)[142:org.apache.openjpa:2.**1.1]
>>             at
>>             org.apache.openjpa.**persistence.**EntityManagerFactoryImpl.*
>> *createEntityManager(**EntityManagerFactoryImpl.java:**
>> 60)[142:org.apache.openjpa:2.**1.1]
>>             at
>>             org.apache.aries.jpa.**container.impl.**
>> CountingEntityManagerFactory.**createEntityManager(**
>> CountingEntityManagerFactory.**java:71)[134:org.apache.aries.**
>> jpa.container:1.0.0]
>>             at
>>             org.apache.aries.jpa.**container.context.transaction.**impl.*
>> *JTAPersistenceContextRegistry.**getCurrentPersistenceContext(**
>> JTAPersistenceContextRegistry.**java:152)[135:org.apache.**
>> aries.jpa.container.context:1.**0.1]
>>             at
>>             org.apache.aries.jpa.**container.context.transaction.**
>> impl.JTAEntityManager.**getPersistenceContext(**
>> JTAEntityManager.java:87)[135:**org.apache.aries.jpa.**
>> container.context:1.0.1]
>>             at
>>             org.apache.aries.jpa.**container.context.transaction.**
>> impl.JTAEntityManager.**getCriteriaBuilder(**JTAEntityManager.java:391)[*
>> *135:org.apache.aries.jpa.**container.context:1.0.1]
>>             ...
>>             /
>>
>>             But the data source seem to be published as a service, the
>>             command "ls | grep -A 4 -B 4 javax.sql.DataSource" gives me
>>             the following output:
>>
>>             /Connect :: filetransfer-history-**datasource (153)
>> provides:/
>>             /-----------------------------**
>> -----------------------------/
>>             /javax.sql.XADataSource/
>>             /javax.sql.DataSource/
>>             /org.osgi.service.blueprint.**container.BlueprintContainer/
>>
>>
>>             I then execute "ls 153" and get:
>>
>>             /
>>             Connect :: filetransfer-history-**datasource (153) provides:
>>             ------------------------------**----------------------------
>>             objectClass = javax.sql.XADataSource
>>             osgi.jndi.service.name <http://osgi.jndi.service.name**> =
>>             jdbc/filetransferhistoryjta
>>             osgi.service.blueprint.**compname = derbyXADataSource
>>             service.id <http://service.id> = 493
>>             ----
>>             objectClass = javax.sql.DataSource
>>             osgi.jndi.service.name <http://osgi.jndi.service.name**> =
>>             jdbc/filetransferhistorynojta
>>             osgi.service.blueprint.**compname = derbyDataSource
>>             service.id <http://service.id> = 494
>>
>>             ----
>>             objectClass =
>>             org.osgi.service.blueprint.**container.BlueprintContainer
>>             osgi.blueprint.container.**symbolicname =
>>             se.digia.connect.services.**filetransfer.h/
>>             istory-datasource
>>             /
>>             osgi.blueprint.container.**version = 2.3.0.SNAPSHOT
>>             service.id <http://service.id> = 495
>>
>>             /
>>
>>             To me it looks like the service is provided with the correct
>>             properties. Maybe it's a jndi problem? I was hoping there
>>             was a "jndi" command in the Karaf shell that I could use to
>>             see what can be resolved via jndi but I can't find such a
>>             command.
>>
>>             I've actually encountered another strange problem. On
>>             startup everything looks fine. But when I try to access the
>>             webconsole - it's not there. I then start to type "list" in
>>             the Karaf shell. But as soon as I type the "l" I get the
>>             following message in the console:
>>
>>             /karaf@root> lError executing command: read() with timeout
>>             cannot be called as no/
>>             /n-blocking operation is disabled/
>>             /        __ __                  ____/
>>             /       / //_/____ __________ _/ __//
>>             /      / ,<  / __ `/ ___/ __ `/ /_/
>>             /     / /| |/ /_/ / /  / /_/ / __//
>>             /    /_/ |_|\__,_/_/   \__,_/_//
>>             /
>>             /
>>             /  Apache Karaf (2.3.0)/
>>             /
>>             /
>>             /Hit '<tab>' for a list of available commands/
>>             /and '[cmd] --help' for help on a specific command./
>>             /Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf./
>>
>>
>>             Note that the "Karaf" logo had already been shown so it's
>>             shown twice. Also, in the log I get:
>>
>>             /2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>
>>             FeaturesServiceImpl              |
>>             s.internal.**FeaturesServiceImpl$2 1143 | Error installing
>>             boot features/
>>             /java.lang.**NullPointerException/
>>             /at
>>             org.apache.felix.framework.**BundleWiringImpl.**
>> findClassOrResourceByDelegatio**n(BundleWiringImpl.java:1432)[**
>> org.apache.felix.framework-4.**0.3.jar:]/
>>             /at
>>             org.apache.felix.framework.**BundleWiringImpl.access$400(**
>> BundleWiringImpl.java:72)[org.**apache.felix.framework-4.0.3.**jar:]/
>>             /at
>>             org.apache.felix.framework.**BundleWiringImpl$**
>> BundleClassLoader.loadClass(**BundleWiringImpl.java:1843)[**
>> org.apache.felix.framework-4.**0.3.jar:]/
>>             /at
>>             java.lang.ClassLoader.**loadClass(ClassLoader.java:**
>> 247)[:1.6.0_32]/
>>             /at
>>             org.apache.karaf.features.**internal.FeaturesServiceImpl.**
>> installFeatures(**FeaturesServiceImpl.java:525)[**
>> 20:org.apache.karaf.features.**core:2.3.0]/
>>             /at
>>             org.apache.karaf.features.**internal.FeaturesServiceImpl$**
>> 2.run(FeaturesServiceImpl.**java:1141)[20:org.apache.**
>> karaf.features.core:2.3.0]/
>>             /2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>
>>             FeaturesServiceImpl              |
>>             res.internal.**FeaturesServiceImpl 1227 | Error persisting
>>             FeaturesService state/
>>             /java.lang.**IllegalStateException: Invalid BundleContext./
>>             /at
>>             org.apache.felix.framework.**BundleContextImpl.**
>> checkValidity(**BundleContextImpl.java:514)[**
>> org.apache.felix.framework-4.**0.3.jar:]/
>>             /at
>>             org.apache.felix.framework.**BundleContextImpl.getDataFile(**
>> BundleContextImpl.java:491)[**org.apache.felix.framework-4.**0.3.jar:]/
>>             /at
>>             org.apache.karaf.features.**internal.FeaturesServiceImpl.**
>> saveState(FeaturesServiceImpl.**java:1215)[20:org.apache.**
>> karaf.features.core:2.3.0]/
>>             /at
>>             org.apache.karaf.features.**internal.FeaturesServiceImpl$**
>> 2.run(FeaturesServiceImpl.**java:1146)[20:org.apache.**
>> karaf.features.core:2.3.0]/
>>
>>
>>             If I don't press a key in the shell, I never get these
>>             messages but then the web service will never install. It's
>>             as if the installation is hung, waiting for something.
>>
>>             Do you or anyone have any clue as to what is happening. I am
>>             in the process of upgrading my custom distribution of Karaf
>>             from 2.2.8 to 2.3.0 so I might have done something very
>>             wrong but right now I have no clue as to where I should look
>>             further,
>>
>>             /Bengt
>>
>>
>>             2012/10/22 Charles Moulliard <ch007m@gmail.com
>>             <ma...@gmail.com>>
>>
>>
>>                 Bengt,
>>
>>                 This package is not required by Aries JPA as resolution
>>                 is optional :
>>
>>                 org.osgi.service.jdbc;**resolution:=optional,
>>
>>                 When the Aries JPA Container
>>                 /**ManagedPersistenceUnitInfoImpl /class is called, Aries
>>
>>                 does a check to verify if the OSGI service is provided.
>>                 If this is not the case, the info is displayed in the
>>                 log and Aries JPA Container continues to load the JPA
>>                 Container based on your config (persistence.xml,
>>                 datasource, ...). If you are using JPA, you shouldn't
>>                 use the DataSourceFactory.
>>
>>                 These links could help you to configure your project
>>
>>                 /http://stackoverflow.com/**
>> questions/11861414/openjpa-in-**osgi-not-finding-mysql-jdbc-**
>> connector-bundle/<http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle/>
>>                 /http://aries.apache.org/**modules/jpaproject.html/<http://aries.apache.org/modules/jpaproject.html/>
>>                 /
>>
>>                 /
>>
>>                 Regards,
>>
>>                 Charles
>>
>>                 On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav
>>                 <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>>
>>                     I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0
>>                     and have run into a problem regarding datasources. I
>>                     get the following in my log:
>>
>>                     /2012-10-22 10:52:59,563 | INFO  | Thread-7
>>
>>                     | container                        |
>>                     l.**ManagedPersistenceUnitInfoImpl   50 | The
>>                     org.osgi.service.jdbc package is unavailable. As a
>>                     result the Aries JPA container will not offer any
>>                     DataSourceFactory integration./
>>
>>
>>                     It's only an INFO message but it seems fatal to me
>>                     because later on I cannot find my datasource when I
>>                     try to use it. I publish a data source (for Derby)
>>                     using Blueprint. I use the following features from
>>                     the karaf-enterprise descriptor:
>>
>>                     - transaction
>>                     - jpa
>>                     - jndi
>>
>>                     When I execute "exports | grep -i
>>                     org.osgi.service.jdbc" on the command line I get an
>>                     empty result.
>>
>>                     It seems like this package is needed for Aries JPA
>>                     Container. What bundle should export it?
>>
>>                     /Bengt
>>
>>
>>
>>
>>                 --
>>                 Charles Moulliard
>>                 Apache Committer / Sr. Enterprise Architect (RedHat)
>>                 Twitter : @cmoulliard | Blog :
>>                 http://cmoulliard.blogspot.com
>>
>>
>>
>>
>>
>>
>>         --
>>         Charles Moulliard
>>         Apache Committer / Sr. Enterprise Architect (RedHat)
>>         Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
FYI,

there is a change in the location of the org.osgi.service.jdbc package 
(especially org.osgi.service.jdbc.DataSourceFactory):

In Karaf 2.2.x, which use OSGi r4.2, this package was provided in 
org.osgi.enterprise.

In Karaf 2.3.x, which use OSGi r4.3, this package was provided in 
org.osgi.compendium.

In next release using OSGi r5.0.0, it's back in org.osgi.enterprise.

So check the exported packages and the import in your bundle (especially 
if you use a Required-Bundle).

Regards
JB

On 10/22/2012 04:06 PM, Charles Moulliard wrote:
> This is correct
>
> On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <bengt@rodehav.com
> <ma...@rodehav.com>> wrote:
>
>     Achim, no Grace Period for any of the bundles.
>
>     Charles, "headers 151" gives me the following:
>
>     /Connect :: filetransfer-history-domain (151)/
>     /--------------------------------------------/
>     /Manifest-Version = 1.0/
>     /Bnd-LastModified = 1350893282476/
>     /Tool = Bnd-0.0.357/
>     /Meta-Persistence = META-INF/persistence.xml/
>     /Built-By = berodeha/
>     /Implementation-Version = 2.3-SNAPSHOT/
>     /Build-Jdk = 1.6.0_32/
>     /Implementation-Title = Digia Connect/
>     /Created-By = Apache Maven Bundle Plugin/
>     /
>     /
>     /Bundle-Name = Connect :: filetransfer-history-domain/
>     /Bundle-SymbolicName =
>     se.digia.connect.services.filetransfer.history-domain/
>     /Bundle-Version = 2.3.0.SNAPSHOT/
>     /Bundle-ManifestVersion = 2/
>     /
>     /
>     /Import-Package =/
>     /        javax.persistence;resolution:=optional;version=1.1,/
>     /        javax.persistence.metamodel;resolution:=optional;version=1.1,/
>     /        javax.validation.constraints;resolution:=optional;version=1.0,/
>     /        org.apache.openjpa.enhance;resolution:=optional;version=2.1,/
>     /        org.apache.openjpa.util;resolution:=optional;version=2.1,/
>     /        se.digia.connect.filetransfer.history.domain;/
>     /                resolution:=optional;/
>     /                version=2.3,/
>     /
>     se.digia.connect.util.persistence;resolution:=optional;version=2.3/
>     /Export-Package =/
>     /        se.digia.connect.filetransfer.history.domain;/
>     /                uses:="org.apache.openjpa.util,/
>     /                        se.digia.connect.util.persistence,/
>     /                        javax.validation.constraints,/
>     /                        org.apache.openjpa.enhance,/
>     /                        javax.persistence,/
>     /                        javax.persistence.metamodel";/
>     /                version=2.3.0.SNAPSHOT/
>
>     I think this is correct. Also, this has worked for quite some time
>     on Karaf 2.2.8 (which had an older Aries version).
>
>     /Bengt
>
>
>     2012/10/22 Charles Moulliard <ch007m@gmail.com
>     <ma...@gmail.com>>
>
>         Have you added Meta-Persistence metadata in the MANIFEST file ?
>         I have created a ticket to provide a more end user message on
>         the console (https://issues.apache.org/jira/browse/ARIES-945)
>
>
>         On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav
>         <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>
>             Thanks for your reply Charles,
>
>             Your're right I don't need the DataSourceFactory. I
>             mistakenly thought that the info message was connected to
>             the problem with not finding the data source via JNDI. Since
>             everything has worked before (using Karaf 2.2.8) I assumed
>             that the feature descriptor   in Karaf 2.3.0 lacked a bundle
>             (that exported the org.osgi.service.jdbc package). That's
>             why I thought it was a Karaf problem and not an Aries problem.
>
>             So, I probably do not need the org.osgi.service.jdbc package
>             - it was a false lead. Still, I do have problems finding the
>             data source via jndi. I get:
>
>             /
>             2012-10-22 13:36:23,428 | ERROR | y/api/getEntries |
>             container                        |
>             ntainer.unit.impl.JndiDataSource   85 | The DataSource
>             osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
>             <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)
>             required by bundle
>             se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT
>             could not be found.
>             javax.naming.NameNotFoundException:
>             osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name
>             <http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)"
>             at
>             org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>             at
>             org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>             at
>             org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>             at
>             javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>             at
>             org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>             at
>             org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>             at
>             org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>             at
>             org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>             at
>             org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>             at
>             org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>             at
>             org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>             ...
>             /
>
>             But the data source seem to be published as a service, the
>             command "ls | grep -A 4 -B 4 javax.sql.DataSource" gives me
>             the following output:
>
>             /Connect :: filetransfer-history-datasource (153) provides:/
>             /----------------------------------------------------------/
>             /javax.sql.XADataSource/
>             /javax.sql.DataSource/
>             /org.osgi.service.blueprint.container.BlueprintContainer/
>
>             I then execute "ls 153" and get:
>
>             /
>             Connect :: filetransfer-history-datasource (153) provides:
>             ----------------------------------------------------------
>             objectClass = javax.sql.XADataSource
>             osgi.jndi.service.name <http://osgi.jndi.service.name> =
>             jdbc/filetransferhistoryjta
>             osgi.service.blueprint.compname = derbyXADataSource
>             service.id <http://service.id> = 493
>             ----
>             objectClass = javax.sql.DataSource
>             osgi.jndi.service.name <http://osgi.jndi.service.name> =
>             jdbc/filetransferhistorynojta
>             osgi.service.blueprint.compname = derbyDataSource
>             service.id <http://service.id> = 494
>             ----
>             objectClass =
>             org.osgi.service.blueprint.container.BlueprintContainer
>             osgi.blueprint.container.symbolicname =
>             se.digia.connect.services.filetransfer.h/
>             istory-datasource
>             /
>             osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>             service.id <http://service.id> = 495
>             /
>
>             To me it looks like the service is provided with the correct
>             properties. Maybe it's a jndi problem? I was hoping there
>             was a "jndi" command in the Karaf shell that I could use to
>             see what can be resolved via jndi but I can't find such a
>             command.
>
>             I've actually encountered another strange problem. On
>             startup everything looks fine. But when I try to access the
>             webconsole - it's not there. I then start to type "list" in
>             the Karaf shell. But as soon as I type the "l" I get the
>             following message in the console:
>
>             /karaf@root> lError executing command: read() with timeout
>             cannot be called as no/
>             /n-blocking operation is disabled/
>             /        __ __                  ____/
>             /       / //_/____ __________ _/ __//
>             /      / ,<  / __ `/ ___/ __ `/ /_/
>             /     / /| |/ /_/ / /  / /_/ / __//
>             /    /_/ |_|\__,_/_/   \__,_/_//
>             /
>             /
>             /  Apache Karaf (2.3.0)/
>             /
>             /
>             /Hit '<tab>' for a list of available commands/
>             /and '[cmd] --help' for help on a specific command./
>             /Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf./
>
>             Note that the "Karaf" logo had already been shown so it's
>             shown twice. Also, in the log I get:
>
>             /2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>             FeaturesServiceImpl              |
>             s.internal.FeaturesServiceImpl$2 1143 | Error installing
>             boot features/
>             /java.lang.NullPointerException/
>             /at
>             org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]/
>             /at
>             org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]/
>             /at
>             org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]/
>             /at
>             java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]/
>             /at
>             org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]/
>             /at
>             org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]/
>             /2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>             FeaturesServiceImpl              |
>             res.internal.FeaturesServiceImpl 1227 | Error persisting
>             FeaturesService state/
>             /java.lang.IllegalStateException: Invalid BundleContext./
>             /at
>             org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]/
>             /at
>             org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]/
>             /at
>             org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]/
>             /at
>             org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]/
>
>             If I don't press a key in the shell, I never get these
>             messages but then the web service will never install. It's
>             as if the installation is hung, waiting for something.
>
>             Do you or anyone have any clue as to what is happening. I am
>             in the process of upgrading my custom distribution of Karaf
>             from 2.2.8 to 2.3.0 so I might have done something very
>             wrong but right now I have no clue as to where I should look
>             further,
>
>             /Bengt
>
>
>             2012/10/22 Charles Moulliard <ch007m@gmail.com
>             <ma...@gmail.com>>
>
>                 Bengt,
>
>                 This package is not required by Aries JPA as resolution
>                 is optional :
>
>                 org.osgi.service.jdbc;resolution:=optional,
>
>                 When the Aries JPA Container
>                 /ManagedPersistenceUnitInfoImpl /class is called, Aries
>                 does a check to verify if the OSGI service is provided.
>                 If this is not the case, the info is displayed in the
>                 log and Aries JPA Container continues to load the JPA
>                 Container based on your config (persistence.xml,
>                 datasource, ...). If you are using JPA, you shouldn't
>                 use the DataSourceFactory.
>
>                 These links could help you to configure your project
>
>                 /http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle/
>                 /http://aries.apache.org/modules/jpaproject.html/
>                 /
>                 /
>
>                 Regards,
>
>                 Charles
>
>                 On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav
>                 <bengt@rodehav.com <ma...@rodehav.com>> wrote:
>
>                     I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0
>                     and have run into a problem regarding datasources. I
>                     get the following in my log:
>
>                     /2012-10-22 10:52:59,563 | INFO  | Thread-7
>                     | container                        |
>                     l.ManagedPersistenceUnitInfoImpl   50 | The
>                     org.osgi.service.jdbc package is unavailable. As a
>                     result the Aries JPA container will not offer any
>                     DataSourceFactory integration./
>
>                     It's only an INFO message but it seems fatal to me
>                     because later on I cannot find my datasource when I
>                     try to use it. I publish a data source (for Derby)
>                     using Blueprint. I use the following features from
>                     the karaf-enterprise descriptor:
>
>                     - transaction
>                     - jpa
>                     - jndi
>
>                     When I execute "exports | grep -i
>                     org.osgi.service.jdbc" on the command line I get an
>                     empty result.
>
>                     It seems like this package is needed for Aries JPA
>                     Container. What bundle should export it?
>
>                     /Bengt
>
>
>
>
>                 --
>                 Charles Moulliard
>                 Apache Committer / Sr. Enterprise Architect (RedHat)
>                 Twitter : @cmoulliard | Blog :
>                 http://cmoulliard.blogspot.com
>
>
>
>
>
>
>         --
>         Charles Moulliard
>         Apache Committer / Sr. Enterprise Architect (RedHat)
>         Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>
>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Charles Moulliard <ch...@gmail.com>.
This is correct

On Mon, Oct 22, 2012 at 2:29 PM, Bengt Rodehav <be...@rodehav.com> wrote:

> Achim, no Grace Period for any of the bundles.
>
> Charles, "headers 151" gives me the following:
>
> *Connect :: filetransfer-history-domain (151)*
> *--------------------------------------------*
> *Manifest-Version = 1.0*
> *Bnd-LastModified = 1350893282476*
> *Tool = Bnd-0.0.357*
> *Meta-Persistence = META-INF/persistence.xml*
> *Built-By = berodeha*
> *Implementation-Version = 2.3-SNAPSHOT*
> *Build-Jdk = 1.6.0_32*
> *Implementation-Title = Digia Connect*
> *Created-By = Apache Maven Bundle Plugin*
> *
> *
> *Bundle-Name = Connect :: filetransfer-history-domain*
> *Bundle-SymbolicName =
> se.digia.connect.services.filetransfer.history-domain*
> *Bundle-Version = 2.3.0.SNAPSHOT*
> *Bundle-ManifestVersion = 2*
> *
> *
> *Import-Package =*
> *        javax.persistence;resolution:=optional;version=1.1,*
> *        javax.persistence.metamodel;resolution:=optional;version=1.1,*
> *        javax.validation.constraints;resolution:=optional;version=1.0,*
> *        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
> *        org.apache.openjpa.util;resolution:=optional;version=2.1,*
> *        se.digia.connect.filetransfer.history.domain;*
> *                resolution:=optional;*
> *                version=2.3,*
> *
> se.digia.connect.util.persistence;resolution:=optional;version=2.3*
> *Export-Package =*
> *        se.digia.connect.filetransfer.history.domain;*
> *                uses:="org.apache.openjpa.util,*
> *                        se.digia.connect.util.persistence,*
> *                        javax.validation.constraints,*
> *                        org.apache.openjpa.enhance,*
> *                        javax.persistence,*
> *                        javax.persistence.metamodel";*
> *                version=2.3.0.SNAPSHOT*
>
> I think this is correct. Also, this has worked for quite some time on
> Karaf 2.2.8 (which had an older Aries version).
>
> /Bengt
>
>
> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>
>> Have you added Meta-Persistence metadata in the MANIFEST file ? I have
>> created a ticket to provide a more end user message on the console (
>> https://issues.apache.org/jira/browse/ARIES-945)
>>
>>
>> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>>
>>> Thanks for your reply Charles,
>>>
>>> Your're right I don't need the DataSourceFactory. I mistakenly thought
>>> that the info message was connected to the problem with not finding the
>>> data source via JNDI. Since everything has worked before (using Karaf
>>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>>> bundle (that exported the org.osgi.service.jdbc package). That's why I
>>> thought it was a Karaf problem and not an Aries problem.
>>>
>>> So, I probably do not need the org.osgi.service.jdbc package - it was a
>>> false lead. Still, I do have problems finding the data source via jndi. I
>>> get:
>>>
>>> *
>>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>>              | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>>> required by bundle
>>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>>> not be found.
>>> javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(
>>> osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
>>> at
>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>>  at
>>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>>> at
>>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>>  at
>>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>>> at
>>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>>  at
>>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>>  at
>>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>>> at
>>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>>  at
>>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>>  at
>>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>  at
>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>>  at
>>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>>> ...
>>> *
>>>
>>> But the data source seem to be published as a service, the command "ls
>>> | grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>>>
>>> *Connect :: filetransfer-history-datasource (153) provides:*
>>> *----------------------------------------------------------*
>>> *javax.sql.XADataSource*
>>> *javax.sql.DataSource*
>>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>>
>>> I then execute "ls 153" and get:
>>>
>>> *
>>> Connect :: filetransfer-history-datasource (153) provides:
>>> ----------------------------------------------------------
>>> objectClass = javax.sql.XADataSource
>>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>>> osgi.service.blueprint.compname = derbyXADataSource
>>>  service.id = 493
>>> ----
>>> objectClass = javax.sql.DataSource
>>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>>> osgi.service.blueprint.compname = derbyDataSource
>>> service.id = 494
>>> ----
>>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>>> osgi.blueprint.container.symbolicname =
>>> se.digia.connect.services.filetransfer.h
>>> istory-datasource
>>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>>> service.id = 495
>>> *
>>>
>>> To me it looks like the service is provided with the correct properties.
>>> Maybe it's a jndi problem? I was hoping there was a "jndi" command in the
>>> Karaf shell that I could use to see what can be resolved via jndi but I
>>> can't find such a command.
>>>
>>> I've actually encountered another strange problem. On startup everything
>>> looks fine. But when I try to access the webconsole - it's not there. I
>>> then start to type "list" in the Karaf shell. But as soon as I type the "l"
>>> I get the following message in the console:
>>>
>>> *karaf@root> lError executing command: read() with timeout cannot be
>>> called as no*
>>> *n-blocking operation is disabled*
>>> *        __ __                  ____*
>>> *       / //_/____ __________ _/ __/*
>>> *      / ,<  / __ `/ ___/ __ `/ /_*
>>> *     / /| |/ /_/ / /  / /_/ / __/*
>>> *    /_/ |_|\__,_/_/   \__,_/_/*
>>> *
>>> *
>>> *  Apache Karaf (2.3.0)*
>>> *
>>> *
>>> *Hit '<tab>' for a list of available commands*
>>> *and '[cmd] --help' for help on a specific command.*
>>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>>
>>> Note that the "Karaf" logo had already been shown so it's shown twice.
>>> Also, in the log I get:
>>>
>>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>>> Error installing boot features*
>>> *java.lang.NullPointerException*
>>> * at
>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>>> *
>>> * at
>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>>> *
>>> * at
>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>>> *
>>> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>>> * at
>>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>>> *
>>> * at
>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>>> *
>>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>>> Error persisting FeaturesService state*
>>> *java.lang.IllegalStateException: Invalid BundleContext.*
>>> * at
>>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>>> *
>>> * at
>>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>>> *
>>> * at
>>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>>> *
>>> * at
>>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>>> *
>>>
>>> If I don't press a key in the shell, I never get these messages but then
>>> the web service will never install. It's as if the installation is hung,
>>> waiting for something.
>>>
>>> Do you or anyone have any clue as to what is happening. I am in the
>>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>>> I might have done something very wrong but right now I have no clue as to
>>> where I should look further,
>>>
>>> /Bengt
>>>
>>>
>>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>>
>>>> Bengt,
>>>>
>>>> This package is not required by Aries JPA as resolution is optional :
>>>>
>>>> org.osgi.service.jdbc;resolution:=optional,
>>>>
>>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class
>>>> is called, Aries does a check to verify if the OSGI service is provided. If
>>>> this is not the case, the info is displayed in the log and Aries JPA
>>>> Container continues to load the JPA Container based on your config
>>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>>> the DataSourceFactory.
>>>>
>>>> These links could help you to configure your project
>>>>
>>>> *
>>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>>> *
>>>> *http://aries.apache.org/modules/jpaproject.html*
>>>> *
>>>> *
>>>>
>>>> Regards,
>>>>
>>>> Charles
>>>>
>>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>>
>>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into
>>>>> a problem regarding datasources. I get the following in my log:
>>>>>
>>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>>                  | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>>> container will not offer any DataSourceFactory integration.*
>>>>>
>>>>> It's only an INFO message but it seems fatal to me because later on I
>>>>> cannot find my datasource when I try to use it. I publish a data source
>>>>> (for Derby) using Blueprint. I use the following features from the
>>>>> karaf-enterprise descriptor:
>>>>>
>>>>> - transaction
>>>>> - jpa
>>>>> - jndi
>>>>>
>>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the
>>>>> command line I get an empty result.
>>>>>
>>>>> It seems like this package is needed for Aries JPA Container. What
>>>>> bundle should export it?
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Charles Moulliard
>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Achim, no Grace Period for any of the bundles.

Charles, "headers 151" gives me the following:

*Connect :: filetransfer-history-domain (151)*
*--------------------------------------------*
*Manifest-Version = 1.0*
*Bnd-LastModified = 1350893282476*
*Tool = Bnd-0.0.357*
*Meta-Persistence = META-INF/persistence.xml*
*Built-By = berodeha*
*Implementation-Version = 2.3-SNAPSHOT*
*Build-Jdk = 1.6.0_32*
*Implementation-Title = Digia Connect*
*Created-By = Apache Maven Bundle Plugin*
*
*
*Bundle-Name = Connect :: filetransfer-history-domain*
*Bundle-SymbolicName = se.digia.connect.services.filetransfer.history-domain
*
*Bundle-Version = 2.3.0.SNAPSHOT*
*Bundle-ManifestVersion = 2*
*
*
*Import-Package =*
*        javax.persistence;resolution:=optional;version=1.1,*
*        javax.persistence.metamodel;resolution:=optional;version=1.1,*
*        javax.validation.constraints;resolution:=optional;version=1.0,*
*        org.apache.openjpa.enhance;resolution:=optional;version=2.1,*
*        org.apache.openjpa.util;resolution:=optional;version=2.1,*
*        se.digia.connect.filetransfer.history.domain;*
*                resolution:=optional;*
*                version=2.3,*
*        se.digia.connect.util.persistence;resolution:=optional;version=2.3*
*Export-Package =*
*        se.digia.connect.filetransfer.history.domain;*
*                uses:="org.apache.openjpa.util,*
*                        se.digia.connect.util.persistence,*
*                        javax.validation.constraints,*
*                        org.apache.openjpa.enhance,*
*                        javax.persistence,*
*                        javax.persistence.metamodel";*
*                version=2.3.0.SNAPSHOT*

I think this is correct. Also, this has worked for quite some time on Karaf
2.2.8 (which had an older Aries version).

/Bengt


2012/10/22 Charles Moulliard <ch...@gmail.com>

> Have you added Meta-Persistence metadata in the MANIFEST file ? I have
> created a ticket to provide a more end user message on the console (
> https://issues.apache.org/jira/browse/ARIES-945)
>
>
> On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>
>> Thanks for your reply Charles,
>>
>> Your're right I don't need the DataSourceFactory. I mistakenly thought
>> that the info message was connected to the problem with not finding the
>> data source via JNDI. Since everything has worked before (using Karaf
>> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
>> bundle (that exported the org.osgi.service.jdbc package). That's why I
>> thought it was a Karaf problem and not an Aries problem.
>>
>> So, I probably do not need the org.osgi.service.jdbc package - it was a
>> false lead. Still, I do have problems finding the data source via jndi. I
>> get:
>>
>> *
>> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>>              | ntainer.unit.impl.JndiDataSource   85 | The DataSource
>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
>> required by bundle
>> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
>> not be found.
>> javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(
>> osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
>> at
>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>>  at
>> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
>> at
>> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>>  at
>> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
>> at
>> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>>  at
>> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>>  at
>> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
>> at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>>  at
>> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>>  at
>> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>>  at
>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>>  at
>> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
>> ...
>> *
>>
>> But the data source seem to be published as a service, the command "ls |
>> grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>>
>> *Connect :: filetransfer-history-datasource (153) provides:*
>> *----------------------------------------------------------*
>> *javax.sql.XADataSource*
>> *javax.sql.DataSource*
>> *org.osgi.service.blueprint.container.BlueprintContainer*
>>
>> I then execute "ls 153" and get:
>>
>> *
>> Connect :: filetransfer-history-datasource (153) provides:
>> ----------------------------------------------------------
>> objectClass = javax.sql.XADataSource
>> osgi.jndi.service.name = jdbc/filetransferhistoryjta
>> osgi.service.blueprint.compname = derbyXADataSource
>>  service.id = 493
>> ----
>> objectClass = javax.sql.DataSource
>> osgi.jndi.service.name = jdbc/filetransferhistorynojta
>> osgi.service.blueprint.compname = derbyDataSource
>> service.id = 494
>> ----
>> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
>> osgi.blueprint.container.symbolicname =
>> se.digia.connect.services.filetransfer.h
>> istory-datasource
>> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
>> service.id = 495
>> *
>>
>> To me it looks like the service is provided with the correct properties.
>> Maybe it's a jndi problem? I was hoping there was a "jndi" command in the
>> Karaf shell that I could use to see what can be resolved via jndi but I
>> can't find such a command.
>>
>> I've actually encountered another strange problem. On startup everything
>> looks fine. But when I try to access the webconsole - it's not there. I
>> then start to type "list" in the Karaf shell. But as soon as I type the "l"
>> I get the following message in the console:
>>
>> *karaf@root> lError executing command: read() with timeout cannot be
>> called as no*
>> *n-blocking operation is disabled*
>> *        __ __                  ____*
>> *       / //_/____ __________ _/ __/*
>> *      / ,<  / __ `/ ___/ __ `/ /_*
>> *     / /| |/ /_/ / /  / /_/ / __/*
>> *    /_/ |_|\__,_/_/   \__,_/_/*
>> *
>> *
>> *  Apache Karaf (2.3.0)*
>> *
>> *
>> *Hit '<tab>' for a list of available commands*
>> *and '[cmd] --help' for help on a specific command.*
>> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>>
>> Note that the "Karaf" logo had already been shown so it's shown twice.
>> Also, in the log I get:
>>
>> *2012-10-22 13:28:27,999 | ERROR | Thread-6         |
>> FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$2 1143 |
>> Error installing boot features*
>> *java.lang.NullPointerException*
>> * at
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
>> *
>> * at
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>> *
>> * at
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>> *
>> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
>> * at
>> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
>> *
>> * at
>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
>> *
>> *2012-10-22 13:28:28,002 | ERROR | Thread-6         |
>> FeaturesServiceImpl              | res.internal.FeaturesServiceImpl 1227 |
>> Error persisting FeaturesService state*
>> *java.lang.IllegalStateException: Invalid BundleContext.*
>> * at
>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
>> *
>> * at
>> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
>> *
>> * at
>> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
>> *
>> * at
>> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>> *
>>
>> If I don't press a key in the shell, I never get these messages but then
>> the web service will never install. It's as if the installation is hung,
>> waiting for something.
>>
>> Do you or anyone have any clue as to what is happening. I am in the
>> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
>> I might have done something very wrong but right now I have no clue as to
>> where I should look further,
>>
>> /Bengt
>>
>>
>> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>
>>> Bengt,
>>>
>>> This package is not required by Aries JPA as resolution is optional :
>>>
>>> org.osgi.service.jdbc;resolution:=optional,
>>>
>>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class is
>>> called, Aries does a check to verify if the OSGI service is provided. If
>>> this is not the case, the info is displayed in the log and Aries JPA
>>> Container continues to load the JPA Container based on your config
>>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>>> the DataSourceFactory.
>>>
>>> These links could help you to configure your project
>>>
>>> *
>>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>>> *
>>> *http://aries.apache.org/modules/jpaproject.html*
>>> *
>>> *
>>>
>>> Regards,
>>>
>>> Charles
>>>
>>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>>
>>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into
>>>> a problem regarding datasources. I get the following in my log:
>>>>
>>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>>                  | l.ManagedPersistenceUnitInfoImpl   50 | The
>>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>>> container will not offer any DataSourceFactory integration.*
>>>>
>>>> It's only an INFO message but it seems fatal to me because later on I
>>>> cannot find my datasource when I try to use it. I publish a data source
>>>> (for Derby) using Blueprint. I use the following features from the
>>>> karaf-enterprise descriptor:
>>>>
>>>> - transaction
>>>> - jpa
>>>> - jndi
>>>>
>>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
>>>> line I get an empty result.
>>>>
>>>> It seems like this package is needed for Aries JPA Container. What
>>>> bundle should export it?
>>>>
>>>> /Bengt
>>>>
>>>>
>>>
>>>
>>> --
>>> Charles Moulliard
>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>
>>>
>>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Charles Moulliard <ch...@gmail.com>.
Have you added Meta-Persistence metadata in the MANIFEST file ? I have
created a ticket to provide a more end user message on the console (
https://issues.apache.org/jira/browse/ARIES-945)

On Mon, Oct 22, 2012 at 2:09 PM, Bengt Rodehav <be...@rodehav.com> wrote:

> Thanks for your reply Charles,
>
> Your're right I don't need the DataSourceFactory. I mistakenly thought
> that the info message was connected to the problem with not finding the
> data source via JNDI. Since everything has worked before (using Karaf
> 2.2.8) I assumed that the feature descriptor   in Karaf 2.3.0 lacked a
> bundle (that exported the org.osgi.service.jdbc package). That's why I
> thought it was a Karaf problem and not an Aries problem.
>
> So, I probably do not need the org.osgi.service.jdbc package - it was a
> false lead. Still, I do have problems finding the data source via jndi. I
> get:
>
> *
> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
>            | ntainer.unit.impl.JndiDataSource   85 | The DataSource
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
> required by bundle
> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
> not be found.
> javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(
> osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
> at
> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
>  at
> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
> at
> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
>  at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
> at
> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
>  at
> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
>  at
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
>  at
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
>  at
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
>  at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
>  at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
> ...
> *
>
> But the data source seem to be published as a service, the command "ls |
> grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>
> *Connect :: filetransfer-history-datasource (153) provides:*
> *----------------------------------------------------------*
> *javax.sql.XADataSource*
> *javax.sql.DataSource*
> *org.osgi.service.blueprint.container.BlueprintContainer*
>
> I then execute "ls 153" and get:
>
> *
> Connect :: filetransfer-history-datasource (153) provides:
> ----------------------------------------------------------
> objectClass = javax.sql.XADataSource
> osgi.jndi.service.name = jdbc/filetransferhistoryjta
> osgi.service.blueprint.compname = derbyXADataSource
>  service.id = 493
> ----
> objectClass = javax.sql.DataSource
> osgi.jndi.service.name = jdbc/filetransferhistorynojta
> osgi.service.blueprint.compname = derbyDataSource
> service.id = 494
> ----
> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
> osgi.blueprint.container.symbolicname =
> se.digia.connect.services.filetransfer.h
> istory-datasource
> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
> service.id = 495
> *
>
> To me it looks like the service is provided with the correct properties.
> Maybe it's a jndi problem? I was hoping there was a "jndi" command in the
> Karaf shell that I could use to see what can be resolved via jndi but I
> can't find such a command.
>
> I've actually encountered another strange problem. On startup everything
> looks fine. But when I try to access the webconsole - it's not there. I
> then start to type "list" in the Karaf shell. But as soon as I type the "l"
> I get the following message in the console:
>
> *karaf@root> lError executing command: read() with timeout cannot be
> called as no*
> *n-blocking operation is disabled*
> *        __ __                  ____*
> *       / //_/____ __________ _/ __/*
> *      / ,<  / __ `/ ___/ __ `/ /_*
> *     / /| |/ /_/ / /  / /_/ / __/*
> *    /_/ |_|\__,_/_/   \__,_/_/*
> *
> *
> *  Apache Karaf (2.3.0)*
> *
> *
> *Hit '<tab>' for a list of available commands*
> *and '[cmd] --help' for help on a specific command.*
> *Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*
>
> Note that the "Karaf" logo had already been shown so it's shown twice.
> Also, in the log I get:
>
> *2012-10-22 13:28:27,999 | ERROR | Thread-6         | FeaturesServiceImpl
>              | s.internal.FeaturesServiceImpl$2 1143 | Error installing
> boot features*
> *java.lang.NullPointerException*
> * at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
> *
> * at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
> *
> * at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
> *
> * at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
> * at
> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
> *
> * at
> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
> *
> *2012-10-22 13:28:28,002 | ERROR | Thread-6         | FeaturesServiceImpl
>              | res.internal.FeaturesServiceImpl 1227 | Error persisting
> FeaturesService state*
> *java.lang.IllegalStateException: Invalid BundleContext.*
> * at
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
> *
> * at
> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
> *
> * at
> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
> *
> * at
> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
> *
>
> If I don't press a key in the shell, I never get these messages but then
> the web service will never install. It's as if the installation is hung,
> waiting for something.
>
> Do you or anyone have any clue as to what is happening. I am in the
> process of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so
> I might have done something very wrong but right now I have no clue as to
> where I should look further,
>
> /Bengt
>
>
> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>
>> Bengt,
>>
>> This package is not required by Aries JPA as resolution is optional :
>>
>> org.osgi.service.jdbc;resolution:=optional,
>>
>> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class is
>> called, Aries does a check to verify if the OSGI service is provided. If
>> this is not the case, the info is displayed in the log and Aries JPA
>> Container continues to load the JPA Container based on your config
>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>> the DataSourceFactory.
>>
>> These links could help you to configure your project
>>
>> *
>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>> *
>> *http://aries.apache.org/modules/jpaproject.html*
>> *
>> *
>>
>> Regards,
>>
>> Charles
>>
>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com>wrote:
>>
>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
>>> problem regarding datasources. I get the following in my log:
>>>
>>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>>                | l.ManagedPersistenceUnitInfoImpl   50 | The
>>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>>> container will not offer any DataSourceFactory integration.*
>>>
>>> It's only an INFO message but it seems fatal to me because later on I
>>> cannot find my datasource when I try to use it. I publish a data source
>>> (for Derby) using Blueprint. I use the following features from the
>>> karaf-enterprise descriptor:
>>>
>>> - transaction
>>> - jpa
>>> - jndi
>>>
>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
>>> line I get an empty result.
>>>
>>> It seems like this package is needed for Aries JPA Container. What
>>> bundle should export it?
>>>
>>> /Bengt
>>>
>>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Bengt,

could you do a la, and try to see if one of your bundles got a
"GracePeriod" in the blueprint column?
Cause we have a rather awkward issue with blueprint during start-up,
and I want to make sure it's either
related/or not-related :)

regards, Achim

2012/10/22 Bengt Rodehav <be...@rodehav.com>:
> Thanks for your reply Charles,
>
> Your're right I don't need the DataSourceFactory. I mistakenly thought that
> the info message was connected to the problem with not finding the data
> source via JNDI. Since everything has worked before (using Karaf 2.2.8) I
> assumed that the feature descriptor   in Karaf 2.3.0 lacked a bundle (that
> exported the org.osgi.service.jdbc package). That's why I thought it was a
> Karaf problem and not an Aries problem.
>
> So, I probably do not need the org.osgi.service.jdbc package - it was a
> false lead. Still, I do have problems finding the data source via jndi. I
> get:
>
> 2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
> | ntainer.unit.impl.JndiDataSource   85 | The DataSource
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
> required by bundle
> se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
> not be found.
> javax.naming.NameNotFoundException:
> osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
> at
> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
> at
> org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
> at
> org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
> at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
> at
> org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
> at
> org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
> at
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
> at
> org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
> at
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
> at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
> at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
> ...
>
> But the data source seem to be published as a service, the command "ls |
> grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:
>
> Connect :: filetransfer-history-datasource (153) provides:
> ----------------------------------------------------------
> javax.sql.XADataSource
> javax.sql.DataSource
> org.osgi.service.blueprint.container.BlueprintContainer
>
> I then execute "ls 153" and get:
>
> Connect :: filetransfer-history-datasource (153) provides:
> ----------------------------------------------------------
> objectClass = javax.sql.XADataSource
> osgi.jndi.service.name = jdbc/filetransferhistoryjta
> osgi.service.blueprint.compname = derbyXADataSource
> service.id = 493
> ----
> objectClass = javax.sql.DataSource
> osgi.jndi.service.name = jdbc/filetransferhistorynojta
> osgi.service.blueprint.compname = derbyDataSource
> service.id = 494
> ----
> objectClass = org.osgi.service.blueprint.container.BlueprintContainer
> osgi.blueprint.container.symbolicname =
> se.digia.connect.services.filetransfer.h
> istory-datasource
> osgi.blueprint.container.version = 2.3.0.SNAPSHOT
> service.id = 495
>
> To me it looks like the service is provided with the correct properties.
> Maybe it's a jndi problem? I was hoping there was a "jndi" command in the
> Karaf shell that I could use to see what can be resolved via jndi but I
> can't find such a command.
>
> I've actually encountered another strange problem. On startup everything
> looks fine. But when I try to access the webconsole - it's not there. I then
> start to type "list" in the Karaf shell. But as soon as I type the "l" I get
> the following message in the console:
>
> karaf@root> lError executing command: read() with timeout cannot be called
> as no
> n-blocking operation is disabled
>         __ __                  ____
>        / //_/____ __________ _/ __/
>       / ,<  / __ `/ ___/ __ `/ /_
>      / /| |/ /_/ / /  / /_/ / __/
>     /_/ |_|\__,_/_/   \__,_/_/
>
>   Apache Karaf (2.3.0)
>
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.
>
> Note that the "Karaf" logo had already been shown so it's shown twice. Also,
> in the log I get:
>
> 2012-10-22 13:28:27,999 | ERROR | Thread-6         | FeaturesServiceImpl
> | s.internal.FeaturesServiceImpl$2 1143 | Error installing boot features
> java.lang.NullPointerException
> at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
> at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
> at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]
> at
> org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
> at
> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
> 2012-10-22 13:28:28,002 | ERROR | Thread-6         | FeaturesServiceImpl
> | res.internal.FeaturesServiceImpl 1227 | Error persisting FeaturesService
> state
> java.lang.IllegalStateException: Invalid BundleContext.
> at
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
> at
> org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
> at
> org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
> at
> org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
>
> If I don't press a key in the shell, I never get these messages but then the
> web service will never install. It's as if the installation is hung, waiting
> for something.
>
> Do you or anyone have any clue as to what is happening. I am in the process
> of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so I might
> have done something very wrong but right now I have no clue as to where I
> should look further,
>
> /Bengt
>
>
> 2012/10/22 Charles Moulliard <ch...@gmail.com>
>>
>> Bengt,
>>
>> This package is not required by Aries JPA as resolution is optional :
>>
>> org.osgi.service.jdbc;resolution:=optional,
>>
>> When the Aries JPA Container ManagedPersistenceUnitInfoImpl  class is
>> called, Aries does a check to verify if the OSGI service is provided. If
>> this is not the case, the info is displayed in the log and Aries JPA
>> Container continues to load the JPA Container based on your config
>> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
>> the DataSourceFactory.
>>
>> These links could help you to configure your project
>>
>>
>> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
>> http://aries.apache.org/modules/jpaproject.html
>>
>>
>> Regards,
>>
>> Charles
>>
>> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com> wrote:
>>>
>>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
>>> problem regarding datasources. I get the following in my log:
>>>
>>> 2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>> | l.ManagedPersistenceUnitInfoImpl   50 | The org.osgi.service.jdbc package
>>> is unavailable. As a result the Aries JPA container will not offer any
>>> DataSourceFactory integration.
>>>
>>> It's only an INFO message but it seems fatal to me because later on I
>>> cannot find my datasource when I try to use it. I publish a data source (for
>>> Derby) using Blueprint. I use the following features from the
>>> karaf-enterprise descriptor:
>>>
>>> - transaction
>>> - jpa
>>> - jndi
>>>
>>> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
>>> line I get an empty result.
>>>
>>> It seems like this package is needed for Aries JPA Container. What bundle
>>> should export it?
>>>
>>> /Bengt
>>>
>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
OPS4J Pax for Vaadin
<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
Lead
blog <http://notizblog.nierbeck.de/>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for your reply Charles,

Your're right I don't need the DataSourceFactory. I mistakenly thought that
the info message was connected to the problem with not finding the data
source via JNDI. Since everything has worked before (using Karaf 2.2.8) I
assumed that the feature descriptor   in Karaf 2.3.0 lacked a bundle (that
exported the org.osgi.service.jdbc package). That's why I thought it was a
Karaf problem and not an Aries problem.

So, I probably do not need the org.osgi.service.jdbc package - it was a
false lead. Still, I do have problems finding the data source via jndi. I
get:

*
2012-10-22 13:36:23,428 | ERROR | y/api/getEntries | container
           | ntainer.unit.impl.JndiDataSource   85 | The DataSource
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/filetransferhistoryjta)
required by bundle
se.digia.connect.services.filetransfer.history-domain/2.3.0.SNAPSHOT could
not be found.
javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(
osgi.jndi.service.name=jdbc/filetransferhistoryjta)"
at
org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:113)[139:org.apache.aries.jndi.url:1.0.0]
at
org.apache.aries.jndi.url.ServiceRegistryContext.lookup(ServiceRegistryContext.java:144)[139:org.apache.aries.jndi.url:1.0.0]
at
org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)[137:org.apache.aries.jndi.core:1.0.0]
at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_32]
at
org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:65)[134:org.apache.aries.jpa.container:1.0.0]
at
org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)[134:org.apache.aries.jpa.container:1.0.0]
at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:872)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getDataSource(JDBCStoreManager.java:179)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:162)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:148)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:79)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:369)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:323)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:213)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)[142:org.apache.openjpa:2.1.1]
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)[142:org.apache.openjpa:2.1.1]
at
org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:71)[134:org.apache.aries.jpa.container:1.0.0]
at
org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:152)[135:org.apache.aries.jpa.container.context:1.0.1]
at
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:87)[135:org.apache.aries.jpa.container.context:1.0.1]
at
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getCriteriaBuilder(JTAEntityManager.java:391)[135:org.apache.aries.jpa.container.context:1.0.1]
...
*

But the data source seem to be published as a service, the command "ls |
grep -A 4 -B 4 javax.sql.DataSource" gives me the following output:

*Connect :: filetransfer-history-datasource (153) provides:*
*----------------------------------------------------------*
*javax.sql.XADataSource*
*javax.sql.DataSource*
*org.osgi.service.blueprint.container.BlueprintContainer*

I then execute "ls 153" and get:

*
Connect :: filetransfer-history-datasource (153) provides:
----------------------------------------------------------
objectClass = javax.sql.XADataSource
osgi.jndi.service.name = jdbc/filetransferhistoryjta
osgi.service.blueprint.compname = derbyXADataSource
service.id = 493
----
objectClass = javax.sql.DataSource
osgi.jndi.service.name = jdbc/filetransferhistorynojta
osgi.service.blueprint.compname = derbyDataSource
service.id = 494
----
objectClass = org.osgi.service.blueprint.container.BlueprintContainer
osgi.blueprint.container.symbolicname =
se.digia.connect.services.filetransfer.h
istory-datasource
osgi.blueprint.container.version = 2.3.0.SNAPSHOT
service.id = 495
*

To me it looks like the service is provided with the correct properties.
Maybe it's a jndi problem? I was hoping there was a "jndi" command in the
Karaf shell that I could use to see what can be resolved via jndi but I
can't find such a command.

I've actually encountered another strange problem. On startup everything
looks fine. But when I try to access the webconsole - it's not there. I
then start to type "list" in the Karaf shell. But as soon as I type the "l"
I get the following message in the console:

*karaf@root> lError executing command: read() with timeout cannot be called
as no*
*n-blocking operation is disabled*
*        __ __                  ____*
*       / //_/____ __________ _/ __/*
*      / ,<  / __ `/ ___/ __ `/ /_*
*     / /| |/ /_/ / /  / /_/ / __/*
*    /_/ |_|\__,_/_/   \__,_/_/*
*
*
*  Apache Karaf (2.3.0)*
*
*
*Hit '<tab>' for a list of available commands*
*and '[cmd] --help' for help on a specific command.*
*Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.*

Note that the "Karaf" logo had already been shown so it's shown twice.
Also, in the log I get:

*2012-10-22 13:28:27,999 | ERROR | Thread-6         | FeaturesServiceImpl
           | s.internal.FeaturesServiceImpl$2 1143 | Error installing boot
features*
*java.lang.NullPointerException*
* at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
*
* at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
*
* at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
*
* at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_32]*
* at
org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:525)[20:org.apache.karaf.features.core:2.3.0]
*
* at
org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1141)[20:org.apache.karaf.features.core:2.3.0]
*
*2012-10-22 13:28:28,002 | ERROR | Thread-6         | FeaturesServiceImpl
           | res.internal.FeaturesServiceImpl 1227 | Error persisting
FeaturesService state*
*java.lang.IllegalStateException: Invalid BundleContext.*
* at
org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
*
* at
org.apache.felix.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:491)[org.apache.felix.framework-4.0.3.jar:]
*
* at
org.apache.karaf.features.internal.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:1215)[20:org.apache.karaf.features.core:2.3.0]
*
* at
org.apache.karaf.features.internal.FeaturesServiceImpl$2.run(FeaturesServiceImpl.java:1146)[20:org.apache.karaf.features.core:2.3.0]
*

If I don't press a key in the shell, I never get these messages but then
the web service will never install. It's as if the installation is hung,
waiting for something.

Do you or anyone have any clue as to what is happening. I am in the process
of upgrading my custom distribution of Karaf from 2.2.8 to 2.3.0 so I might
have done something very wrong but right now I have no clue as to where I
should look further,

/Bengt


2012/10/22 Charles Moulliard <ch...@gmail.com>

> Bengt,
>
> This package is not required by Aries JPA as resolution is optional :
>
> org.osgi.service.jdbc;resolution:=optional,
>
> When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class is
> called, Aries does a check to verify if the OSGI service is provided. If
> this is not the case, the info is displayed in the log and Aries JPA
> Container continues to load the JPA Container based on your config
> (persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
> the DataSourceFactory.
>
> These links could help you to configure your project
>
> *
> http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
> *
> *http://aries.apache.org/modules/jpaproject.html*
> *
> *
>
> Regards,
>
> Charles
>
> On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com> wrote:
>
>> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
>> problem regarding datasources. I get the following in my log:
>>
>> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>>                | l.ManagedPersistenceUnitInfoImpl   50 | The
>> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
>> container will not offer any DataSourceFactory integration.*
>>
>> It's only an INFO message but it seems fatal to me because later on I
>> cannot find my datasource when I try to use it. I publish a data source
>> (for Derby) using Blueprint. I use the following features from the
>> karaf-enterprise descriptor:
>>
>> - transaction
>> - jpa
>> - jndi
>>
>> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
>> line I get an empty result.
>>
>> It seems like this package is needed for Aries JPA Container. What bundle
>> should export it?
>>
>> /Bengt
>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Charles Moulliard <ch...@gmail.com>.
Bengt,

This package is not required by Aries JPA as resolution is optional :

org.osgi.service.jdbc;resolution:=optional,

When the Aries JPA Container *ManagedPersistenceUnitInfoImpl  *class is
called, Aries does a check to verify if the OSGI service is provided. If
this is not the case, the info is displayed in the log and Aries JPA
Container continues to load the JPA Container based on your config
(persistence.xml, datasource, ...). If you are using JPA, you shouldn't use
the DataSourceFactory.

These links could help you to configure your project

*
http://stackoverflow.com/questions/11861414/openjpa-in-osgi-not-finding-mysql-jdbc-connector-bundle
*
*http://aries.apache.org/modules/jpaproject.html*
*
*

Regards,

Charles

On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com> wrote:

> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
> problem regarding datasources. I get the following in my log:
>
> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>              | l.ManagedPersistenceUnitInfoImpl   50 | The
> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
> container will not offer any DataSourceFactory integration.*
>
> It's only an INFO message but it seems fatal to me because later on I
> cannot find my datasource when I try to use it. I publish a data source
> (for Derby) using Blueprint. I use the following features from the
> karaf-enterprise descriptor:
>
> - transaction
> - jpa
> - jndi
>
> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
> line I get an empty result.
>
> It seems like this package is needed for Aries JPA Container. What bundle
> should export it?
>
> /Bengt
>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0

Posted by Charles Moulliard <ch...@gmail.com>.
Bengt,

Without additional information, it will be difficult to help you but the
problem that you have (most probably) is that the DataSource has not been
registered as an OSGI service (
http://www.osgi.org/javadoc/r4v42/org/osgi/service/jdbc/DataSourceFactory.html
).

Remark : This question should be posted on Aries mailing list.

Regards,

Charles

On Mon, Oct 22, 2012 at 11:25 AM, Bengt Rodehav <be...@rodehav.com> wrote:

> I'm trying to upgrade fro Karaf 2.2.8 to Karaf 2.3.0 and have run into a
> problem regarding datasources. I get the following in my log:
>
> *2012-10-22 10:52:59,563 | INFO  | Thread-7         | container
>              | l.ManagedPersistenceUnitInfoImpl   50 | The
> org.osgi.service.jdbc package is unavailable. As a result the Aries JPA
> container will not offer any DataSourceFactory integration.*
>
> It's only an INFO message but it seems fatal to me because later on I
> cannot find my datasource when I try to use it. I publish a data source
> (for Derby) using Blueprint. I use the following features from the
> karaf-enterprise descriptor:
>
> - transaction
> - jpa
> - jndi
>
> When I execute "exports | grep -i org.osgi.service.jdbc" on the command
> line I get an empty result.
>
> It seems like this package is needed for Aries JPA Container. What bundle
> should export it?
>
> /Bengt
>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com