Thank you very much for all your help,

as Shaun commented there is a bug using PDE in eclipse for version 3.5. I
was messing around this bug and mixing eclipselinks versions.

Now it is working perfectly using EclipseLink 2.0. I will try to post a
topic about that.
thank you!

Miguel


On Mon, Dec 28, 2009 at 4:39 PM, Shaun Smith <[email protected]> wrote:

>  Hi Miguel,
>
>    I just responded to your post on the EclipseLink forum about this and
> pointed you at the OSGi examples on the wiki [1].   I suspect your problem
> is either trying to obtain a persistence unit before either the
> javax.persistence or EclipseLink JPA bundle are started, or you didn't
> declare your persistence unit in your bundle manifest.  All of this is
> covered in the examples.
>
>    Also, I see you are using EclipseLink 2.0.  If you are developing with
> PDE in Eclipse 3.5 or 3.5.1 you will likely run into what appears to be a
> PDE bug [2].  The current workaround is to use PDE in Eclipse < 3.5 for now.
>
>     Shaun
>
> [1] http://wiki.eclipse.org/EclipseLink/Examples/OSGi
> [2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=298318
>
> Miguel wrote:
>
> Thank you Chris,
>
> I usually work with standard OSGI API also I must say sometimes spring
> framework is much better organize! I still have the same error, I have
> launch the framework with the spring bundles:
> osgi> ss
>
> Framework is launched.
>
> id    State       Bundle
> 0    ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
> 1    ACTIVE      com.springsource.javax.persistence_2.0.0
> 2    ACTIVE      com.springsource.org.apache.commons.logging_1.1.1
> 3    ACTIVE      com.springsource.com.mysql.jdbc_5.1.6
> 4    ACTIVE      com.springsource.javax.validation_1.0.0.GA
> 5    ACTIVE      com.springsource.javax.xml.stream_1.0.1
> 6    ACTIVE      com.springsource.javax.activation_1.1.1
> 7    ACTIVE
> com.springsource.org.eclipse.persistence.internal.libraries.antlr_2.0.0
> 8    ACTIVE      com.springsource.javax.transaction_1.1.0
> 9    ACTIVE      com.springsource.org.eclipse.persistence_2.0.0
> 10    ACTIVE
> com.springsource.org.eclipse.persistence.internal.libraries.asm_2.0.0
> 11    ACTIVE      com.springsource.org.eclipse.persistence.jpa_2.0.0
> 12    RESOLVED    com.as.jpa.example_1.0.0.200912280843
>
>
> but when I start the 12th bundle, my jpa example bundle I still have the
> same error. Do you think that I am missing something in this bundle...
> headers in the Manifest?
>
> thank you for your help.
>
>
> osgi> start 12
> org.osgi.framework.BundleException: Exception in
> com.as.jpa.example.Activator.start() of bundle com.as.jpa.example.
>     at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
>     at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
>     at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
>     at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
>     at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
>     at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
>     at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
>     at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
>     at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
>     at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.persistence.PersistenceException: No Persistence provider
> for EntityManager named hello-world
>     at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
>     at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
>     at com.as.jpa.example.JpaTest.initEntityManager(JpaTest.java:23)
>     at com.as.jpa.example.Activator.start(Activator.java:15)
>     at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
>     ... 14 more
>
>
>
>
> Miguel
>
>
> On Sat, Dec 26, 2009 at 9:12 PM, Chris Carrier <[email protected]>wrote:
>
>> Seems like you might be missing the main eclipselink bundle.  I'm not sure
>> what that core bundle you have is.  I just got an app up and running using
>> EclipseLink in Spring DM server.  The bundles I had to add to get everything
>> working were:
>>
>> com.springsource.com.mysql.jdbc-5.1.6.jar
>> com.springsource.javax.persistence-2.0.0.jar
>> com.springsource.javax.validation-1.0.0.GA.jar
>> com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
>> com.springsource.org.apache.commons.pool-1.4.0.jar
>> com.springsource.org.eclipse.persistence-2.0.0.jar
>> com.springsource.org.eclipse.persistence.internal.libraries.asm-2.0.0.jar
>> com.springsource.org.eclipse.persistence.jpa-2.0.0.jar
>> org.springframework.aspects-3.0.0.RELEASE.jar
>>
>> I'm not sure if all of those are required just for JPA but that's all the
>> bundles I've installed and like I said things are working for me.  It looks
>> like I'm using a newer version but anyway maybe this will help.  I think
>> org.eclipse.persistence.jpa at the version you have may be a Fragment
>> bundle.  So make sure that whatever parent bundle it's expecting is
>> installed.
>>
>> Chris
>>
>>  On Sat, Dec 26, 2009 at 5:01 AM, Miguel <[email protected]> wrote:
>>
>>>  Hello,
>>>
>>> I have a java application using JPA and mysql libraries. The application
>>> works correctly using standard java but now I am trying to deploy in insite
>>> an OSGI platform.
>>>
>>> I have tried to have a look to EclipseLink. Eclipe provides you some
>>> bundles to make JPA works properly. The target platform I have:
>>>
>>> 0    ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827
>>> 1    ACTIVE      org.eclipse.persistence.asm_1.1.2.v20090612-r4475
>>> 2    RESOLVED    com.as.jpa.example_1.0.0.qualifier
>>> 3    ACTIVE      org.eclipse.persistence.core_1.1.2.v20090612-r4475
>>> 4    ACTIVE      javax.persistence_2.0.0.v200911271158
>>> 5    ACTIVE      org.eclipse.persistence.jpa_1.1.2.v20090612-r4475
>>> 6    ACTIVE      org.eclipse.persistence.antlr_1.1.2.v20090612-r4475
>>>
>>>
>>> and the error I get:
>>>
>>>
>>> org.osgi.framework.BundleException: Exception in
>>> com.as.jpa.example.Activator.start() of bundle com.as.jpa.example.
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
>>>     at org. ... [...]
>>> Caused by: Exception [EclipseLink-28027] (Eclipse Persistence Services -
>>> 1.1.2.v20090612-r4475):
>>> org.eclipse.persistence.exceptions.EntityManagerSetupException
>>> Exception Description: An attempt has been made to use PersistenceUnit
>>> [hello-world], but no bundle is available that defines that persistence
>>> unit.
>>>     at
>>> org.eclipse.persistence.exceptions.EntityManagerSetupException.couldNotFindPersistenceUnitBundle(EntityManagerSetupException.java:298)
>>>     at
>>> org.eclipse.persistence.internal.jpa.deployment.osgi.OSGiPersistenceInitializationHelper.getClassLoader(OSGiPersistenceInitializationHelper.java:129)
>>>     at
>>> org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:66)
>>>     at
>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
>>>     at
>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
>>>     at com.as.jpa.example.JpaTest.initEntityManager(JpaTest.java:23)
>>>     at com.as.jpa.example.Activator.start(Activator.java:15)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
>>>     at java.security.AccessController.doPrivileged(Native Method)
>>>     at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
>>>     ... 14 more
>>>
>>>
>>>
>>> I have also tried
>>> http://www.dynamicjava.org/projects/jsr-api/jpa-osgi
>>>
>>> but I must be missing some bundles or libraries because i can not make it
>>> works.
>>>
>>> could anybody throw light about it?
>>>
>>> thank you!
>>>
>>> Miguel
>>> Sent from Madrid, Spain
>>>  _______________________________________________
>>> OSGi Developer Mail List
>>> [email protected]
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>
>>
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> [email protected]
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>
> ------------------------------
>
> _______________________________________________
> OSGi Developer Mail 
> [email protected]https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
> --
> [image: Oracle] <http://www.oracle.com>
> Shaun Smith | Principal Product Manager
> Phone: +19055023094
> Oracle Server Technologies, Oracle TopLink
> ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga,
> Ontario | L5R 3P4
> [image: Green Oracle] <http://www.oracle.com/commitment> Oracle is
> committed to developing practices and products that help protect the
> environment
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>

<<green-for-email-sig_0.gif>>

<<oracle_sig_logo.gif>>

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to