karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bengt Rodehav <be...@rodehav.com>
Subject Re: "The org.osgi.service.jdbc package is unavailable" after upgrading to Karaf 2.3.0
Date Mon, 22 Oct 2012 12:09:07 GMT
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 <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://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
>
>
>

Mime
View raw message