JBoss Community

Hibernate4.1 + Custom dialect on JBoss AS7 classloading issues

created by sanmo in JBoss AS 7 Development - View the full discussion

I use spring 3.1.2 and hibernate 4.1. We have a legacy database which does not contain a industry standard dialect. So we have our own dialect. I am trying to migrate from jboss 5 to jboss 7. We used to include hibernat 3 jars along with our application jars and the dialect in the war file. With jboss 7 i am using the hibernate from jboss. When my app initializes it is able to call hibernate classes but hibernate is not able to see the dialect class loaded from within the web-inf/lib.

 

This is the exception

 

Caused by: org.hibernate.HibernateException: Dialect class not found: com.myorg.dao.hibernate.DBDialect

at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:76)

at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)

at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:176)

at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)

at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)

at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)

at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)

at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242)

at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372)

at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)

... 28 more

Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.myorg.dao.hibernate.DBDialect]

at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)

at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)

... 43 more

Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.myorg.dao.hibernate.DBDialect

at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)

... 44 more

 

This is the jboss-deployment-structure.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<jboss-deployment-structure>

    <deployment>

     <dependencies>

            <module name="org.hibernate" />

            <module name="org.apache.xerces" />

            <module name="javax.servlet.api" />

            <module name="javax.jms.api" />

            <module name="org.jboss.ironjacamar.jdbcadapters" />

        </dependencies>

        <exclusions>

            <module name="org.apache.log4j" />

        </exclusions>

    </deployment>

</jboss-deployment-structure>

 

It all worked well in jboss 5.1.0. Trying to find a solution for it on JBoss 7.1.1. Anybody have any suggestions?

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community