As your java field name is 'em' --> <bean id="helloServices" class="org.examples.hello.HelloServiceImpl"> <tx:transaction method="*" value="Required" /> <jpa:context property="em" unitname="myUnit" /> </bean>
On Thu, Oct 10, 2013 at 12:22 PM, Mansour Al Akeel < [email protected]> wrote: > Charles, > I reviewed my setup, and could not find anything wrong: > > > https://github.com/mansour77/examples/blob/master/karaf-jpa/persistence-model/src/main/resources/META-INF/persistence.xml > > > https://github.com/mansour77/examples/blob/master/karaf-jpa/persistence-model/src/main/resources/OSGI-INF/blueprint/blueprint.xml > > > This is the code I am using to inject the entityManager. > > <bean id="helloServices" class="org.examples.hello.HelloServiceImpl"> > <tx:transaction method="*" value="Required" /> > <jpa:context property="entityManager" unitname="myUnit" /> > </bean> > > I don't see what is wrong with this ! > > > > > On Thu, Oct 10, 2013 at 2:44 AM, Charles Moulliard <[email protected]> > wrote: > > Hi Mansour, > > > > According to your log file, Blueptint is not able to retrieve this > interface > > name (javax.persistence.EntityManagerFactory) with the filter > > (osgi.unit.name=myUnit). There is something which is wrong in your > project > > > > Can you check that you have a persistence unit name = myunit defined in > your > > persistence file and that you inject it correctly within your bean as > > described here : http://aries.apache.org/modules/jpaproject.html ? > > > > <!-- Inject a persistence unit called "myUnit" using the bean property > > "setEmf" --> > > <bean id="unit"> > > <jpa:unit property="emf" unitname="myUnit" /> > > </bean> > > > > > > Here is an example : > > > > - JPA Service : > > > https://github.com/apache/aries/tree/0.1-incubating-RCx/samples/ariestrader/modules/ariestrader-persist-jpa-am > > > > - Entity definition + persistence.xml : > > > https://github.com/apache/aries/tree/0.1-incubating-RCx/samples/ariestrader/modules/ariestrader-entities > > > > > > Regards, > > > > > > > > On Thu, Oct 10, 2013 at 1:09 AM, Mansour Al Akeel > > <[email protected]> wrote: > >> > >> Charles, > >> The sample project I have created has openJPA 2.2.2 as a dependency. > >> This is the stack trace with OpenJPA 2.2.2 > >> https://gist.github.com/mansour77/6910015 > >> > >> And this is the log with OpenJPA 2.2.0 > >> > >> https://gist.github.com/mansour77/6910100 > >> > >> Thank you for your help. > >> > >> > >> On Wed, Oct 9, 2013 at 9:08 AM, Charles Moulliard <[email protected]> > >> wrote: > >> > Can you send using gist the stack trace please as I see that you have > a > >> > grace period (wait 3 minutes) ? > >> > > >> > > >> > On Wed, Oct 9, 2013 at 2:02 PM, Mansour Al Akeel > >> > <[email protected]> > >> > wrote: > >> >> > >> >> Charles, > >> >> Thank you for your time. > >> >> > >> >> I am using the trunk version: > >> >> > >> >> Apache Karaf (3.0.0-SNAPSHOT) > >> >> > >> >> "osgi:list" is not available. However, I have "package:exports" : > >> >> > >> >> karaf@root(package)> exports | grep org.apache.openjpa.persistence > >> >> org.apache.openjpa.persistence.criteria | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.jdbc | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.jest.help | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.jest.images | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.jest | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.meta | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.osgi | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.query | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.util | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence.validation | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> org.apache.openjpa.persistence | 2.2.2 > >> >> | 225 | org.apache.openjpa > >> >> > >> >> And: > >> >> > >> >> karaf@root(package)> imports | grep org.apache.openjpa.persistence > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.criteria)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.jdbc)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.jest)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.jest.help)(version>=2.2.0)) > >> >> | | 225 | > org.apache.openjpa > >> >> | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.jest.images)(version>=2.2.0)) > >> >> | | 225 | org.apache.openjpa > >> >> | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.meta)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.osgi)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.query)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.util)(version>=2.2.0)) > >> >> | | 225 | > >> >> org.apache.openjpa | true > >> >> > >> >> > >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence.validation)(version>=2.2.0)) > >> >> | | 225 | org.apache.openjpa > >> >> | true > >> >> karaf@root(package)> > >> >> > >> >> > >> >> The version I am using in pom.xml is 2.2.2. Even when I change it to > >> >> 2.2.0, there's no difference in the results, as the exports as far as > >> >> I know coming from openJPA bundle, I installed separately: > >> >> > >> >> karaf@root()> list > >> >> START LEVEL 100 , List Threshold: 50 > >> >> ID State Level Name > >> >> [ 219] [ Active] [ 80] data-source (1.0.0) > >> >> [ 225] [ Installed] [ 80] OpenJPA Aggregate Jar (2.2.2) > >> >> [ 240] [ Resolved] [ 80] XBean-Finder-Fragment (3.0.2), Hosts: 237 > >> >> [ 250] [ Active] [ 80] maven-status (0.0.0) > >> >> [ 257] [GracePeriod] [ 80] persistence-model (1.0) > >> >> karaf@root()> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> On Wed, Oct 9, 2013 at 2:12 AM, Charles Moulliard <[email protected]> > >> >> wrote: > >> >> > Can you check which bundles have been deployed on Karaf (osgi:list > -t > >> >> > 0) > >> >> > and > >> >> > if OpenJPA is well present in the list (osgi:list -t 0 | grep -i > >> >> > openjpa). > >> >> > Next, it is important to verify that the packages of openjpa are > >> >> > exported > >> >> > (packages:export | grep org.apache.openjpa.persistence)) and the > >> >> > version > >> >> > correspond to what you import in the bundle of your project > >> >> > (packages:import > >> >> > | grep org.apache.openjpa.persistence). > >> >> > > >> >> > > >> >> > On Wed, Oct 9, 2013 at 2:02 AM, Mansour Al Akeel > >> >> > <[email protected]> > >> >> > wrote: > >> >> >> > >> >> >> Hello all, > >> >> >> I created a sample project, to understand how things work with > >> >> >> aries. > >> >> >> The project is using JPA, and hoping to add/use EJB in the future. > >> >> >> > >> >> >> To do this, I have create this project > >> >> >> https://github.com/mansour77/examples, and deployed its modules > as > >> >> >> an > >> >> >> exploded bundles using felix fileinstall. However, I am unable to > >> >> >> complete this simple project properly. I looked in the samples > that > >> >> >> came with the source code, and did not know how to deploy them > into > >> >> >> an > >> >> >> existing karaf instance. > >> >> >> > >> >> >> The errors I am getting when I try to run the sample: > >> >> >> > >> >> >> 2013-10-08 19:50:04,451 | WARN | nce-model/target | fileinstall > >> >> >> | 17 - org.apache.felix.fileinstall - 3.2.6 | Error > >> >> >> while starting bundle: > >> >> >> > >> >> >> > >> >> >> > >> >> >> > jardir:/home/mansour/workspace/examples/karaf-jpa/persistence-model/target/classes > >> >> >> org.osgi.framework.BundleException: Unresolved constraint in > bundle > >> >> >> persistence-model [217]: Unable to resolve 217.1: missing > >> >> >> requirement > >> >> >> [217.1] osgi.wiring.package; > >> >> >> > >> >> >> > >> >> >> > >> >> >> > (&(osgi.wiring.package=org.apache.openjpa.persistence)(version>=2.2.0)(!(version>=3.0.0))) > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)[org.apache.felix.framework-4.2.1.jar:] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.framework.Felix.startBundle(Felix.java:2037)[org.apache.felix.framework-4.2.1.jar:] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.2.1.jar:] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1247)[17:org.apache.felix.fileinstall:3.2.6] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1219)[17:org.apache.felix.fileinstall:3.2.6] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1208)[17:org.apache.felix.fileinstall:3.2.6] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:503)[17:org.apache.felix.fileinstall:3.2.6] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[17:org.apache.felix.fileinstall:3.2.6] > >> >> >> 2013-10-08 19:50:04,451 | WARN | nce-model/target | fileinstall > >> >> >> | 17 - org.apache.felix.fileinstall - 3.2.6 | Error > >> >> >> while starting bundle: > >> >> >> > >> >> >> > >> >> >> > >> >> >> > jardir:/home/mansour/workspace/examples/karaf-jpa/persistence-model/target/classes > >> >> >> > >> >> >> > >> >> >> > >> >> >> The reason, "as far as I understand" is that karaf can not see > >> >> >> openJpa > >> >> >> jar. I am not sure why ?? > >> >> >> If I remove : > >> >> >> org.apache.openjpa.persistence , from: > >> >> >> > >> >> >> <Import-Package> > >> >> >> !javax.validation.* , > >> >> >> !javax.servlet.* , > >> >> >> !org.apache.tools.ant.* , > >> >> >> !javax.crypto.* , > >> >> >> !com.ibm.* , > >> >> >> > !org.apache.derby.iapi.services.sanity , > >> >> >> !org.apache.derby.impl.drda , > >> >> >> !org.postgresql.* , > >> >> >> !org.apache.commons.dbcp , > >> >> >> > !org.apache.derby.shared.common.sanity , > >> >> >> org.apache.openjpa.persistence , > >> >> >> * > >> >> >> </Import-Package> > >> >> >> > >> >> >> > >> >> >> Then I get this error after it times out: > >> >> >> > >> >> >> 2013-10-08 19:52:50,806 | DEBUG | Local user karaf | ServiceRecipe > >> >> >> | 27 - org.apache.aries.blueprint.core - > >> >> >> 1.1.1.SNAPSHOT > >> >> >> | Method exit: getService, returning > >> >> >> org.apache.karaf.shell.console.commands.BlueprintCommand@1ce829c > >> >> >> 2013-10-08 19:52:50,806 | DEBUG | Local user karaf | > >> >> >> BlueprintContainerImpl | 27 - > >> >> >> org.apache.aries.blueprint.core - 1.1.1.SNAPSHOT | Instantiating > >> >> >> component shell-231 > >> >> >> 2013-10-08 19:52:50,807 | DEBUG | Local user karaf | > >> >> >> BlueprintContainerImpl | 27 - > >> >> >> org.apache.aries.blueprint.core - 1.1.1.SNAPSHOT | Instantiating > >> >> >> component blueprintBundleContext > >> >> >> 2013-10-08 19:57:42,886 | DEBUG | rint Extender: 3 | > ReferenceRecipe > >> >> >> | 27 - org.apache.aries.blueprint.core - > >> >> >> 1.1.1.SNAPSHOT > >> >> >> | Unbinding reference .component-1 > >> >> >> 2013-10-08 19:57:42,886 | ERROR | rint Extender: 3 | > >> >> >> BlueprintContainerImpl | 27 - > >> >> >> org.apache.aries.blueprint.core - 1.1.1.SNAPSHOT | Unable to start > >> >> >> blueprint container for bundle persistence-model due to unresolved > >> >> >> dependencies > >> >> >> > >> >> >> > >> >> >> [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name > =myUnit))(objectClass=javax.persistence.EntityManagerFactory))] > >> >> >> java.util.concurrent.TimeoutException > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:328)[27:org.apache.aries.blueprint.core:1.1.1.SNAPSHOT] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[27:org.apache.aries.blueprint.core:1.1.1.SNAPSHOT] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_13] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_13] > >> >> >> at > >> >> >> > java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_13] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_13] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_13] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_13] > >> >> >> at > >> >> >> > >> >> >> > >> >> >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_13] > >> >> >> at java.lang.Thread.run(Thread.java:722)[:1.7.0_13] > >> >> >> 2013-10-08 19:57:42,886 | DEBUG | rint Extender: 3 | > >> >> >> BlueprintEventDispatcher | 27 - > >> >> >> org.apache.aries.blueprint.core - 1.1.1.SNAPSHOT | Sending > blueprint > >> >> >> container event BlueprintEvent[type=FAILURE, > >> >> >> > >> >> >> > >> >> >> > >> >> >> dependencies=[(&(&(org.apache.aries.jpa.proxy.factory=true)( > osgi.unit.name > =myUnit))(objectClass=javax.persistence.EntityManagerFactory))], > >> >> >> exception=null] for bundle persistence-model > >> >> >> 2013-10-08 19:57:42,886 | DEBUG | nt Dispatcher: 1 | > >> >> >> BlueprintListener > >> >> >> | 1 - org.apache.karaf.bundle.core - > 3.0.0.SNAPSHOT | > >> >> >> Blueprint app state changed to Failure for bundle 220 > >> >> >> > >> >> >> > >> >> >> > >> >> >> My question is, how can I get the samples with aries to deploy to > >> >> >> existing karaf ? I am sure answring this question will lead me to > >> >> >> know what is wrong with the prototype I have. > >> >> >> > >> >> >> Thank you. > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > Charles Moulliard > >> >> > Apache Committer / Architect @RedHat > >> >> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > >> >> > > >> > > >> > > >> > > >> > > >> > -- > >> > Charles Moulliard > >> > Apache Committer / Architect @RedHat > >> > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > >> > > > > > > > > > > > -- > > Charles Moulliard > > Apache Committer / Architect @RedHat > > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > > > -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
