spring - Issue configuring JBoss EAP 6.1 with hibernate 3.6 -
i'm trying deploy ear file in local server seems it's still trying use hibernate 4 (the default option, guess).
what have done:
- i've added hibernate 3 module in $jboss_home$\modules\org.hibernate\3 module.xml file:
<module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3"> <resources> <resource-root path="hibernate3.jar"/> <resource-root path="commons-collections-3.1.jar"/> <resource-root path="jta-1.1.jar"/> <resource-root path="javassist-3.12.0.ga.jar"/> <resource-root path="antlr-2.7.6.jar"/> <resource-root path="slf4j-api-1.6.1.jar"/> <resource-root path="dom4j-1.6.1.jar"/> <!-- insert other hibernate 3 jars used here --> </resources> <dependencies> <module name="org.jboss.as.jpa.hibernate" slot="3"/> <module name="asm.asm"/> <module name="javax.api"/> <module name="javax.persistence.api"/> <module name="javax.transaction.api"/> <module name="com.ibm.db2" /> <module name="org.infinispan"/> </dependencies> </module>
- i've created data source in
standalone-full-ha.xml
:
<datasource jndi-name="java:jboss/datasources/txdb" pool-name="txdbds" enabled="true" use-java-context="true"> <connection-url>jdbc:db2://156.24.30.103:50000/tx_lspdb</connection-url> <driver>db2driver</driver> <security> <user-name> .... </user-name> <password> .... </password> </security> </datasource>
- my persistence.xml file has following entry:
<persistence-unit name="esdb"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>java:jboss/datasources/txdb</jta-data-source> <class>com.gtech.commerce.uidblockpool</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.db2dialect"/> <property name="jboss.as.jpa.providermodule" value="org.jboss.as.jpa.hibernate:3" /> </properties> </persistence-unit>
and when try deploy:
caused by: java.lang.classcastexception: org.springframework.orm.hibernate3.localjtadatasourceconnectionprovider incompatible org.hibernate.service.jdbc.connections.spi.connectionprovider @ org.hibernate.service.jdbc.connections.internal.connectionproviderinitiator.instantiateexplicitconnectionprovider(connectionproviderinitiator.java:189) [hibernate-core-4.2.0.sp1-redhat-1.jar:4.2.0.sp1-redhat-1] ... 107 more
any idea missing?
update: haven't found solution, did obvious workaround: using hibernate 3 bundled application, ignoring module
imho problem comes fact jboss datasource built-in connection pool rely on default persistence implementation provided server.
you can try override server datasource configuration
but don't know if can specify connection pool provider.
you try otherwise set custom datasource
see http://docs.jboss.org/hibernate/orm/4.1/devguide/en-us/html/ch01.html
please consider won't more in case:
jdbc connections obtained jndi datasource automatically participate in container-managed transactions of application server.
, have configure transaction factory.
as more general comment i'll advise not override provided implementation when using java ee application server.
if wan't use hibernate 3 switch jboss 6.0 or not rely on built-in java ee container features (and in case switch lighter jetty or tomcat)
Comments
Post a Comment