On Fri, Jul 31, 2009 at 4:54 AM, Thierry Templier <temp...@yahoo.fr> wrote:
> > Hello, > > I fixed my problem by adding the <exclude-unlisted-classes/> parameter in > my persistent.xml file to desactivate auto detecting. Just a heads up... Do not rely on the default value for <exclude-unlisted-classes/>. In JPA 1.0, this element was defined incorrectly. The default value was set to "false". Thus, the <exclude-unlisted-classes/> element, if typed just like this, would indicate "not to exclude unlisted classes", which means to include unlisted classes. Confusing, right? In the upcoming JPA 2.0 spec, this is getting corrected. So, now the default value will be "true". Although this now makes more sense as the default value, if you have accidentally used <exclude-unlisted-classes/> in your persistence.xml, you could start to experience different processing. Best bet is to be explicit: <exclude-unlisted-classes>true</exclude-unlisted-classes> Thanks, Kevin > > Thierry > > > Hello, > > > > I'm trying to use OpenJPA 1.1.0 with the Spring JPA support > > within an OSGi environment. > > > > Here is my Spring configuration: > > > > <bean id="entityManagerFactory" > > > class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" > > lazy-init="false"> > > <property name="dataSource" > > ref="dataSource"/> > > <property name="jpaVendorAdapter"> > > <bean > > class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"> > > <property > > name="databasePlatform" > > value="org.apache.openjpa.jdbc.sql.HSQLDictionary"/> > > <property > > name="showSql" value="true"/> > > </bean> > > </property> > > <property name="loadTimeWeaver"> > > <bean > > > class="org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver"/> > > </property> > > </bean> > > > > I have a strange problem when trying to use the entity > > manager: > > > > Could not open JPA EntityManager for transaction; nested > > exception is <openjpa-1.1.0-r422266:657916 nonfatal > > general error> > > org.apache.openjpa.persistence.PersistenceException: Error > > extracting class information from "bundleresource://2/". > > > > It seems that OpenJPA tries to autodetect metadata for JPA > > entities whereas I explicitly specify them in the > > persistent.xml file: > > > > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > > version="1.0"> > > <persistence-unit name="myUnit" > > transaction-type="RESOURCE_LOCAL"> > > > > <class>test.service.jpa.model.Author</class> > > > > <class>test.service.jpa.model.Book</class> > > </persistence-unit> > > </persistence> > > > > If it's the case, is it possible to desactivate this > > mechanism? > > Thanks very much for your help! > > Thierry > > > > ----------------- > > > > More details on exceptions: > > > > Caused by: <openjpa-1.1.0-r422266:657916 nonfatal > > general error> > > org.apache.openjpa.persistence.PersistenceException: Error > > extracting class information from "bundleresource://2/". > > at > > > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196) > > at > > > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142) > > at > > > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192) > > at > > > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145) > > at > > > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56) > > at > > > org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:392) > > at > > > org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:320) > > ... 38 more > > Caused by: > > org.apache.commons.lang.exception.NestableRuntimeException: > > Error extracting class information from > > "bundleresource://2/". > > at > > > org.apache.openjpa.lib.meta.ClassArgParser.parseTypeNames(ClassArgParser.java:246) > > at > > > org.apache.openjpa.meta.AbstractCFMetaDataFactory.parsePersistentTypeNames(AbstractCFMetaDataFactory.java:715) > > at > > > org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:606) > > at > > > org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNames(MetaDataRepository.java:1253) > > at > > > org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1270) > > at > > > org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:276) > > at > > > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228) > > at > > > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190) > > ... 44 more > > > > > > Caused by: java.io.FileNotFoundException: > > [...]/test.service.jpa.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:50) > > 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:1009) > > at > > > org.apache.openjpa.lib.util.J2DoPrivHelper$39.run(J2DoPrivHelper.java:825) > > 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:243) > > ... 51 more > > > > > > > > > > > > > >