-
Notifications
You must be signed in to change notification settings - Fork 38.5k
JPA without persistence.xml fails when all classpath items are jars [SPR-8832] #13474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Torsten Krah commented This does still apply to 3.1.0.RELEASE and i would rate this one at major, because the complete classpath scan feature is broken which does render the app unusable if packaged via jar file. |
Juergen Hoeller commented As of 3.1.1, we are using the containing jar as the persistence unit root URL for the default unit now, based on the location of the packages that we are scanning. We'll only fall back to the classpath root strategy if the jar determination doesn't work out. Juergen |
Cristi Vulpe commented It seems that the problem is still there with 3.1.1. Here are some details: <bean id="myEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource"defaultDataSource" ref="myDataSource" />
<property name="persistenceUnitName"defaultPersistenceUnitName" value="myDb" />
<property name="mappingResources" value="META-INF/my-orm-mapping.xml" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
</bean>
</property>
<property name="jpaProperties" ref="myOracleHibernatePoperties" />
</bean> … I bump into the same error as originally reported… <bean id="myPUManager"
class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="defaultDataSource" ref="myDataSource" />
<property name="defaultPersistenceUnitName" value="myDb" />
<property name="mappingResources" value="META-INF/my-orm-mapping.xml" />
<property name="defaultPersistenceUnitRootLocation"
value="file://C:/tmp/jpa" />
</bean>
<bean id="myEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="myPUManager" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
</bean>
</property>
<property name="jpaProperties" ref="myOracleHibernatePoperties" />
</bean> Some details here:
<property name="defaultPersistenceUnitRootLocation" value="file://C:/tmp/jpa" />
… fixes the situation (note that the C:/tmp/jpa is an empty folder).
Let me know if you need more details about this. |
Artem Troitskiy opened SPR-8832 and commented
LocalContainerEntityManagerFactoryBean
withsetPackagesToScan()
and withoutpersistence.xml
fails when all classpath items are jars with the following exception:It doesn't fail if at least one classpath item is a folder.
It's caused by attempt to resolve a pattern pointing to the classpath root (
"classpath:"
) that doesn't work for jars.Affects: 3.1 RC1
Issue Links:
Referenced from: commits 62e5b9d
9 votes, 11 watchers
The text was updated successfully, but these errors were encountered: