Thanks, Tim and Alasdair, for your clarifications - I wasn't aware of the Aries 
JNDI service before, and I didn't have an explicit  
transaction-type="RESOURCE_LOCAL" in persistence.xml.

I had another try with the aries.jpa.api, aries.jpa.container and aries.util 
bundles added to my application. My persistence unit gets discovered, and I can 
see an EntityManagerFactory in the service registry. However, this factory is 
not usable, because of the following errors:


36  test.openjpa  TRACE  [Start Level Event Dispatcher] openjpa.MetaData - 
Scanning URL "bundleresource://11.fwk1603837828/" for persistent types.
0  test.openjpa  TRACE  [Start Level Event Dispatcher] openjpa.Runtime - 
Setting the following properties from "?" into configuration: 
{openjpa.BrokerFactory=jdbc, javax.persistence.validation.mode=AUTO, 
openjpa.RuntimeUnenhancedClasses=supported, openjpa.BrokerImpl=non-finalizing, 
openjpa.MetaDataFactory=jpa(URLs=bundleresource://11.fwk1603837828/, 
Types=test.openjpa.model.Book), 
openjpa.classresolver=org.apache.openjpa.persistence.persistenceunitinfoimpl$classresolveri...@42f1916f,
 javax.persistence.sharedCache.mode=UNSPECIFIED, 
openjpa.jdbc.DBDictionary=org.apache.openjpa.jdbc.sql.PostgresDictionary(storeCharsAsNumbers=false),
 openjpa.Log=DefaultLevel=TRACE, PersistenceVersion=2.0, 
openjpa.Id=test.openjpa}
15  test.openjpa  WARN   [Start Level Event Dispatcher] openjpa.Runtime - An 
error occurred while registering a ClassTransformer with 
org.apache.aries.jpa.container.unit.impl.persistenceunitinfoi...@69264eab. The 
error is logged along with this warning. Load-time class transformation will 
not be available.
org.apache.commons.lang.exception.NestableRuntimeException: Error extracting 
class information from "bundleresource://11.fwk1603837828/".
        at 
org.apache.openjpa.lib.meta.ClassArgParser.parseTypeNames(ClassArgParser.java:249)
        at 
org.apache.openjpa.meta.AbstractCFMetaDataFactory.parsePersistentTypeNames(AbstractCFMetaDataFactory.java:724)

...
Caused by: java.io.FileNotFoundException: /appl/plugins/test.openjpa/bin (Is a 
directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at 
org.eclipse.osgi.framework.util.SecureAction.getFileInputStream(SecureAction.java:124)
        at 
org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry.getInputStream(FileBundleEntry.java:56)
        at 
org.eclipse.osgi.framework.internal.core.BundleURLConnection.connect(BundleURLConnection.java:53)
        at 
org.eclipse.osgi.framework.internal.core.BundleURLConnection.getInputStream(BundleURLConnection.java:99)
        at java.net.URL.openStream(URL.java:1010)
        at 
org.apache.openjpa.lib.util.J2DoPrivHelper$41.run(J2DoPrivHelper.java:907)
        at 
org.apache.openjpa.lib.util.J2DoPrivHelper$41.run(J2DoPrivHelper.java:905)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.openjpa.lib.meta.URLMetaDataIterator.getInputStream(URLMetaDataIterator.java:67)
        at 
org.apache.openjpa.lib.meta.ClassArgParser.parseTypeNames(ClassArgParser.java:246)



The problem appears to be the bundleresource://... URL returned by 
PersistenceUnitInfoImpl.getPersistenceUnitRootUrl(), which OpenJPA thinks is a 
file, not a directory. I'm not really intimate with pax-exam, but apparently it 
installs all bundles as JARs, whereas I'm launching Equinox directly from the 
Eclipse IDE,  so my bundles are installed from class folders, not from JARs, 
which might explain why the Aries integration tests work and my setup does 
not...

Anyway, it seems this is an issue on the OpenJPA side and not in Aries, so I'm 
going to cross-post this on the OpenJPA mailing list.

Best regards,

Harald

Reply via email to