JPA Application fails to start
lalit.manchanda May 10, 2013 5:38 AMHi,
I am working on a simple JPA app on Jboss Fuse 6.0, which is using openJPA as a provider, attempts to connect to postgres. It installs, but when starting it fails with the following error. I am attaching the pom.xml, blueprint.xml and persistence.xml being used for the project. I see some similarity of my issue with -http://fusesource.com/issues/browse/ENTESB-320
09:25:26,497 | INFO | hat-015-thread-1 | faultManagementLifecycleStrategy | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | StatisticsLevel at All so enabling load performance statistics 09:25:26,503 | INFO | hat-015-thread-1 | BlueprintCamelContext | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | Total 1 routes, of which 1 is started. 09:25:26,504 | INFO | hat-015-thread-1 | BlueprintCamelContext | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | Apache Camel 2.10.0.redhat-60015 (CamelContext: cbr-example-context) started in 0.681 seconds 09:25:27,026 | INFO | NAPSHOT-thread-1 | ManagementStrategyFactory | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | JMX enabled. 09:25:27,046 | WARN | NAPSHOT-thread-1 | BeanRecipe | 8 - org.apache.aries.blueprint.core - 1.0.1.redhat-60015 | Object to be destroyed is not an instance of UnwrapperedBeanHolder, type: null 09:25:27,046 | INFO | NAPSHOT-thread-1 | BlueprintCamelContext | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | Apache Camel 2.10.0.redhat-60015 (CamelContext: blueprintContext) is shutting down 09:25:27,048 | INFO | NAPSHOT-thread-1 | BlueprintCamelContext | 130 - org.apache.camel.camel-core - 2.10.0.redhat-60015 | Apache Camel 2.10.0.redhat-60015 (CamelContext: blueprintContext) is shutdown in 0.001 seconds. Uptime not started. 09:25:27,048 | ERROR | NAPSHOT-thread-1 | BlueprintContainerImpl | 8 - org.apache.aries.blueprint.core - 1.0.1.redhat-60015 | Unable to start blueprint container for bundle com.mycompany.test-blueprint org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: entityManagerFactory, getter: class org.apache.camel.component.jpa.JpaComponent.getEntityManagerFactory(), setter: [class org.apache.camel.component.jpa.JpaComponent.setEntityManagerFactory(interface javax.persistence.EntityManagerFactory)] at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43] at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_43] at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:667)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[13:org.apache.aries.util:1.0.1.redhat-60015] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[13:org.apache.aries.util:1.0.1.redhat-60015] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[13:org.apache.aries.util:1.0.1.redhat-60015] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[13:org.apache.aries.util:1.0.1.redhat-60015] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[13:org.apache.aries.util:1.0.1.redhat-60015] at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4580)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.Felix$4.run(Felix.java:2115)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.Felix$4.run(Felix.java:2115)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at org.apache.felix.framework.Felix$5.run(Felix.java:2159)[org.apache.felix.framework-4.0.3.redhat-60015.jar:] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_43] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43] at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_43] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)[:1.6.0_43] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)[:1.6.0_43] at java.lang.Thread.run(Thread.java:662)[:1.6.0_43] Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to convert to javax.persistence.EntityManagerFactory at org.apache.aries.blueprint.container.ReferenceRecipe$ServiceProxyWrapper.convert(ReferenceRecipe.java:304)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:145)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[8:org.apache.aries.blueprint.core:1.0.1.redhat-60015] ... 32 more
Pom.xml looks like -
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>test-blueprint</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>A Camel Blueprint Route</name>
<url>http://www.myorganization.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>fusesource.m2</id>
<name>FuseSource Community Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>fusesource.ea</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fusesource.m2</id>
<name>FuseSource Community Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>fusesource.ea</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>2.10.0.redhat-60015</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jpa</artifactId>
<version>2.10.0.redhat-60015</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<index>true</index>
<manifestEntries>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
blueprint.xml looks like -
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/xmlns/jpa/v1.1.0 http://aries.apache.org/schemas/jpa/jpa_110.xsd">
<bean id="helloBean" class="com.mycompany.test_blueprint.HelloBean">
<property name="say" value="Hi from Camel"/>
</bean>
<camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="timerToLog">
<from uri="timer:foo?period=50000"/>
<setBody>
<method ref="helloBean" method="helloDb"></method>
</setBody>
<log message="The message contains ${body}"/>
<to uri="mock:result"/>
</route>
</camelContext>
<reference id="jtaTransactionManager" interface="javax.transaction.TransactionManager"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<argument ref="jtaTransactionManager"/>
</bean>
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<jpa:unit unitname="camel-openjpa" property="entityManagerFactory"/>
<property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="dataSource" class="org.postgresql.ds.PGPoolingDataSource" destroy-method="close">
<property name="serverName" value="localhost:5432/AMP"/>
<property name="user" value="postgres"/>
<property name="password" value="airtel@123"/>
<property name="dataSourceName" value="myConnectionPool"/>
<property name="initialConnections" value="2"/>
<property name="maxConnections" value="4" />
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/postgresds"/>
</service-properties>
</service>
</blueprint>
persistence.xml looks like -
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="camel-openjpa" transaction-type="RESOURCE_LOCAL">
<provider>
org.apache.openjpa.persistence.PersistenceProviderImpl
</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/postgresds</jta-data-source>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/postgresds)</non-jta-data-source>
<class>com.mycompany.test_blueprint.PurchaseOrder</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="openjpa.Log" value="DefaultLevel=INFO, Tool=INFO"/>
<property name="openjpa.jdbc.DBDictionary" value="postgres"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
</properties>
</persistence-unit>
</persistence>