Karaf 3.0.6 JPA 2.3.0 Pax JDBC 1.1.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Karaf 3.0.6 JPA 2.3.0 Pax JDBC 1.1.0

sekaijin
This post was updated on .
Hi
I have deployed a datasource "omer" with pax jdbc that works well.
I can get the service, establish a connection and make queries.

I've deployeda bundle that contains an open jpa config.
And I can not get the datasource.
osgi.jdbc.driver.name=oracle
url=jdbc:oracle:thin:@localhost:2584:MyStore
user=myUser
password=myPass
dataSourceName=omer
pool=dbcp2
jdbc.pool.maxTotal=30
<?xml version="1.0" encoding="UTF-8"?>
<persistence
    xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
   <persistence-unit name="omer" transaction-type="RESOURCE_LOCAL">
      <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<!--      <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=omer)</jta-data-source> -->
      <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=omer)</non-jta-data-source>
<!--  <non-jta-data-source>osgi:service/javax.sql.DataSource/(dataSourceName=omer)</non-jta-data-source> -->

      <class>fr.aphp.olympe.hermes.agent.omer.model.OmerMessage</class>
      <class>fr.aphp.olympe.hermes.agent.omer.model.OmerStatut</class>
      <class>fr.aphp.olympe.hermes.agent.omer.model.OmerHeader</class>
      <class>fr.aphp.olympe.hermes.agent.omer.model.Eventstore</class>

      <exclude-unlisted-classes>true</exclude-unlisted-classes>
   </persistence-unit>
</persistence>

I added in jpa openjpa.ConnectionDriverName
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

	<persistence-unit name="">
		<properties>
			<property name="openjpa.Log"
				value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO" />

			<!-- <property name="openjpa.DynamicEnhancementAgent" value="false"/> -->
			<!-- <property name="openjpa.RuntimeUnenhancedClasses" value="supported" /> -->
			<!-- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/> -->
			<!-- <property name="openjpa.ConnectionFactoryProperties" value="PrintParameters=true" /> -->
			<property name="openjpa.ConnectionDriverName" value="javax.sql.DataSource" />
			<property name="openjpa.FlushBeforeQueries" value="true" />
			<property name="openjpa.jdbc.DBDictionary" value="oracle(batchLimit=0, MaxEmbeddedBlobSize=-1)" />
		</properties>

	</persistence-unit>
</persistence>
2017-08-03 18:37:46,444 | ERROR | l for user karaf | BlueprintCamelContext            | 100 - org.apache.camel.camel-blueprint - 2.16.2 | Error occurred during starting Camel: CamelContext(hermes-agent-presi) due There were errors initializing your configuration: <openjpa-2.3.0-r422266:1540826 fatal user error> 
org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "javax.sql.DataSource" and URL "null".  You may have specified an invalid URL.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:849)
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)

Merci
thank
A+JYT
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 3.0.6 JPA 2.3.0 Pax JDBC 1.1.0

sekaijin
I found the first problem
The jndi feature was not installed.
I had an error telling me to add the property :
<property name="openjpa.ConnectionDriverName" value="javax.sql.DataSource" />
I've resolved it and deleted the property I had added.

I've used the debugger and found that the datasource was well-established.
But I still can not use jpa.
I have no error in the logs, but a stactrace at the console.
 EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy54)
java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy54
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
        at org.springframework.orm.jpa.ExtendedEntityManagerCreator.createProxy(ExtendedEntityManagerCreator.java:264)
        at org.springframework.orm.jpa.ExtendedEntityManagerCreator.createProxy(ExtendedEntityManagerCreator.java:229)
        at org.springframework.orm.jpa.ExtendedEntityManagerCreator.createApplicationManagedEntityManager(ExtendedEntityManagerCreator.java:110)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:379)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:519)
        at com.sun.proxy.$Proxy49.createEntityManager(Unknown Source)
        at org.apache.camel.component.jpa.JpaConsumer.doStart(JpaConsumer.java:506)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3232)
        at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3526)
        at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3462)
        at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3392)
        at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3160)
        at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3016)
        at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
        at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2812)
        at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2808)
        at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2831)
        at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2808)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2777)
        at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:180)
        at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:212)
        at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:150)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4419)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3423)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:352)
        at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:100)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)
        at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:956)
        at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
        at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
        at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)
        at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)
        at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
        at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)
        at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)
        at org.apache.felix.framework.Felix.updateBundle(Felix.java:2404)
        at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:973)
        at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:960)
        at org.apache.karaf.bundle.command.Update.doExecute(Update.java:43)
        at org.apache.karaf.bundle.command.BundleCommand.doExecute(BundleCommand.java:49)
        at org.apache.karaf.bundle.command.BundleCommandWithConfirmation.doExecute(BundleCommandWithConfirmation.java:34)
        at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)
        at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)
        at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)
        at Proxy5f5484d3_888b_452c_91af_30cfd0b27398.execute(Unknown Source)
        at Proxy5f5484d3_888b_452c_91af_30cfd0b27398.execute(Unknown Source)
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
        at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:210)
        at org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1$1.run(LocalConsoleManager.java:109)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57)
        at org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1.run(LocalConsoleManager.java:102)
k

But what class?
A+JYT
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 3.0.6 JPA 2.3.0 Pax JDBC 1.1.0

sekaijin
I've found

missing JPA feature installed

>feature:install jpa/2.1.0

Bye
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 3.0.6 JPA 2.3.0 Pax JDBC 1.1.0

nikonmsn
This post has NOT been accepted by the mailing list yet.
In reply to this post by sekaijin
I'm trying to implement the exact same thing on karaf 4.0.9 but having some issues... Just wondering how you installed the oracle driver? Is this process documented somewhere? I've installed the driver and related features as documented in a few places, but I'm unable to open datasourse and log reports nothing, how did you view the stack trace, any help would be very much appreciated.
Loading...