Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] osgi persistence.xml hack

Ok, it is still occuring, even with your new ones.

Let me give you an example of what our set up looks like:

Plugins:
CustomJpaUtil plugin (Has dependencies on all the
JPA/javax.persistence stuff, is responsible for creating
EntityManagerFactories)
CustomApp plugins (references EmfFactory in CustomJpaUtil plugin to
get Connection)

So one of our custom app plugins has an eclipse product, this .product
references all the required plugins and when you export as a plugin it
includes the JRE & all the required plugins as well as an exe. When
running that exe, we get the following error with your code (before &
now) as soon as it tries to make an EMF, the fix was detailed earlier.

Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0
(Build SNAPSHOT - 20080514)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5113f0
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence
Services - 1.0 (Build SNAPSHOT - 20080514)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing
persistence.xml from URL: bundleresource://27/
Internal Exception: java.net.MalformedURLException
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:121)
	at org.eclipse.persistence.jpa.osgi.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:128)
	at com.redacted.jpa.EmfFactory.createEntityManagerFactory(EmfFactory.java:43)
	at com.redacted.plugin.om.model.OmModelPlugin.start(OmModelPlugin.java:46)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:189)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:340)
	at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:405)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)



On Wed, May 14, 2008 at 12:51 PM, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
> I'll try to duplicate with the nightly plugins, but how are you
> testing?  Are you creating a product in eclipse and exporting from
> there, or are you using ant?
>
> I'll try to duplicate our issue with the comics example I checked in,
> then it'll be easier for you to dup, i'll check back in later.
>
>
> On Wed, May 14, 2008 at 11:41 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
>> Hi Tim,
>>
>>  We are now creating plugins as part of our build.  I was unable to recreate
>> the issue you mention below with those plug-ins.  I am wondering if you
>> still get it with those plugins.
>>
>>  The most recent plugins are published with our nightly builds.  Just look
>> for: eclipselink-plugins-incubation-20080514.zip for last night's build at:
>>
>> http://www.eclipse.org/eclipselink/downloads/nightly.php
>>
>> Note: There is an issue with the ant plug-in found in the zip file right
>> now, so you will likely have to export that file from our Eclispe PDE
>> project for now.
>>
>> -Tom
>>
>>
>>
>> Tim Hollosy wrote:
>>>
>>> HI devs!
>>>
>>> After mucking around trying to get OSGi EclipseLink to work _outside_
>>> of eclipse (an exported eclipse product),  We've finally gotten it to
>>> work:
>>>
>>> In
>>> org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor
>>> in the processPersistenceArchive method
>>>
>>> Instead of getting the XML stream from the "Archive" class like:
>>> InputStream pxmlStream = archive.getEntry("META-INF/persistence.xml");
>>>
>>> -- which doesn't work for some reason.
>>>
>>> You can instead use the classLoader's getResourceAsStream method like
>>> this:
>>>
>>> InputStream pxmlStream =
>>> loader.getResourceAsStream("META-INF/persistence.xml");
>>>
>>> I'm not exactly sure why the Archive class stuff doesn't work outside
>>> of eclipse, since the getResources() call on the classLoader seems to
>>> work fine, but I thought someone might be interested in this work
>>> around.
>>>
>>> As an aside -- I think you might want to look at testing outside of
>>> eclipse, since apparently osgi in and outside of eclipse are two
>>> different animals.
>>>
>>> Thanks!
>>> Tim
>>> _______________________________________________
>>> eclipselink-dev mailing list
>>> eclipselink-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
>>
>> _______________________________________________
>> eclipselink-dev mailing list
>> eclipselink-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
>>
>
>
>
> --
> ./tch
>



-- 
./tch


Back to the top