Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Does OSGI work?

Hi Hugo,

  Lets see if we can get the examples working for you.

Your 1st step should work. After that, there are a few things we should do differently.

2. The osgi branch in our SVN is a proof of concept branch and is therefore deprecated. We will update our Wiki to be more accurate. Instead, get the examples from the "examples" folder in either our trunk, or branches/1.0/trunk. The example projects you want are:

org.eclipse.persistence.derby
org.eclipse.persistence.example.jpa.comics.model.annotated
org.eclipse.persistence.example.jpa.comics.setup
org.eclipse.persistence.example.jpa.rcp.comics

3. You are correct to install apache derby, but the org.apache.derby.core bundle is not JPA friendly (it is not well setup for a client-connection to Derby through OSGi). The org.eclipse.persistence.derby project you imported in the step above can be used to provide Derby access. See the readme file in that project to understand how to configure it.

When you have it configured, you will have to run the startNetworkServer script in your derby installation

4. You should only have one compile error. It is explained in the readme mentioned above and you should not have to worry about it.

5. Run the ComicsExampleDBSetup launch configuration (from the org.eclipse.persistence.example.jpa.comics.setup project)

This is a simple OSGi application that sets up your database.

6. Run the ComicsRCP launch configuration (from the org.eclipse.persistence.example.jpa.rcp.comics project) You will get a warning about the derby jar. Click on the button to ignore the warning.

You should get a simple RCP app.

Let me know how this goes for you and we will ensure the wiki gets updated.

-Tom





Hugo Garcia wrote:
Below is the error when i try to run the examples.

Am I doing something wrong?
Would like to know if anyone has gotten them to work?

This is why I was asking if the OSGi stuff works since I get the same
exception regardless of OS and/or JDK.

1. Get the OSGi bundles and set up Eclipse.
    A. Download the EclipseLink 1.0 OSGi Bundles Zip and unpack.
    B. Start up Eclipse and File>Import>Plug-ins and Fragments:
    C. Uncheck "The target platform (as specified in Preferences)".
    D. Hit the "Browse..." button
    E. Select the 'plugins' folder of the EclipseLink 1.0 OSGi Bundle.
    F. Click "Next".
    G. Click "Add All -->" button.
    H. Click "Finish" button.

2. Get the source for the demo projects.
    A. Get your favorite SVN client.
    B. Connect to the Technology SVN (how to:
http://wiki.eclipse.org/SVN_Howto )
    C. Checkout all the projects in
[repo_location]/org.eclipse.persistence/branches/osgi/trunk/demos

3. Install Apache Derby
    A. Get the 'derby_core_plugin' from
http://db.apache.org/derby/integrate/derby_plugin.html
    B. Install it in your eclipse/plugins folder and restart Eclipse
    C. Replace the dependency for "org.apache.derby" with
"org.apache.derby.core" in every  MANIFEST.MF with
an error.
    D. Download the binary version of Derby and run it. (You could get
the UI Derby plugin and then run it)

4. Correct the compile errors:
    A. Add a dependency for "javax.persistence" in every project with
the following error "The import javax.persistence cannot be resolved"
    B. Add a dependency for "javax.persistence" in every project with
the following error "The type javax.persistence.EntityManagerFactory
cannot be resolved. It is indirectly referenced from required .class
file"
    C. Replace the line:
        'import org.eclipse.persistence.jpa.config.PersistenceUnitProperties;'
    with:
        'import org.eclipse.persistence.config.PersistenceUnitProperties;'
     in every project with the following error: "The import
org.eclipse.persistence.jpa.config cannot be resolved"
    D. THE FOLLOWING CHANGES COMPILE BUT DON'T WORK?!?:
        Remove the the third parameter in the method call for
createEntityManagerFactory() for the error:
        "The method createEntityManagerFactory(String, Map,
ClassLoader) from the type PersistenceProvider is not visible"

5. >>>> Follow the instructions in the wiki page to create a Run
Configuration, run and the following happens:

osgi> Persistence bundle starting...
Persistence bundle started.
ProviderTracker: New service detected...
ProviderTracker: Added service
org.eclipse.persistence.jpa.osgi.PersistenceProviderOSGi
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0
(Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
org.eclipse.persistence.internal.jpa.deployment.osgi.BundleProxyClassLoader@5a676437
Internal Exception: Exception [EclipseLink-28027] (Eclipse Persistence
Services - 1.0 (Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: An attempt has been made to use PersistenceUnit
[bundleresource://10/comics], but no bundle is available that defines
that persistence unit.
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:121)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:117)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:64)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:123)
	at org.eclipse.persistence.demo.jpa.comics.setup.CreateAndInitDatabase.start(CreateAndInitDatabase.java:42)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:355)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1074)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:616)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:299)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:489)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:211)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:321)
Caused by: Exception [EclipseLink-28027] (Eclipse Persistence Services
- 1.0 (Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: An attempt has been made to use PersistenceUnit
[bundleresource://10/comics], 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:97)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:149)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:135)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:104)
	... 16 more
Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0
(Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
org.eclipse.persistence.internal.jpa.deployment.osgi.BundleProxyClassLoader@5a676437
Internal Exception: Exception [EclipseLink-28027] (Eclipse Persistence
Services - 1.0 (Build 1.0 - 20080707)):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: An attempt has been made to use PersistenceUnit
[bundleresource://10/comics], but no bundle is available that defines
that persistence unit.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top