1 Reply Latest reply on Feb 13, 2012 5:35 AM by Karsten Wutzke

    Deploying Seam 2.2.2 WAR to JBoss AS 7 + bundled Hibernate 3 gives strange exceptions (CCE + NSME)

    Karsten Wutzke Expert

      Hello,

       

      I'm trying to port my Seam 2 application to JBoss AS 7.1. I have been trying Hibernate 4 for a while, but it's not working. Now I'm reverting back to Hibernate 3 bundled with my webapp. I was following

       

      https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide

       

      "Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application" along the path.

       

      However, when deploying the webapp I get the exception:

       

       

      {code}18:27:00,774 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/bbstats]] (MSC service thread 1-1) Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener: org.jboss.seam.InstantiationException: Could not instantiate Seam component: emf

          at org.jboss.seam.Component.newInstance(Component.java:2170) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.init.Initialization.init(Initialization.java:744) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36) [jboss-seam-2.2.2.Final.jar:]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.7.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:77) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [:1.7.0_02]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.7.0_02]

          at java.lang.Thread.run(Unknown Source) [:1.7.0_02]

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: BBStatsPU] Unable to build EntityManagerFactory

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) [hibernate-entitymanager-3.6.9.Final.jar:]

          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

          at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:81) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50) [jboss-seam-2.2.2.Final.jar:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_02]

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_02]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_02]

          at java.lang.reflect.Method.invoke(Unknown Source) [:1.7.0_02]

          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.callComponentMethod(Component.java:2283) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.callCreateMethod(Component.java:2198) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.newInstance(Component.java:2158) [jboss-seam-2.2.2.Final.jar:]

          ... 13 more

      Caused by: org.hibernate.HibernateException: Could not instantiate dialect class

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

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

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

          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) [hibernate-core-3.6.9.Final.jar:]

          at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) [hibernate-core-3.6.9.Final.jar:]

          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) [hibernate-core-3.6.9.Final.jar:]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) [hibernate-core-3.6.9.Final.jar:]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) [hibernate-entitymanager-3.6.9.Final.jar:]

          ... 28 more

      Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQLDialect cannot be cast to org.hibernate.dialect.Dialect

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

          ... 39 more{code}

       

      Eeh?

       

      OK looking at the persistence.xml file:

       

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

                   version="2.0">

        <persistence-unit name="BBStatsPU" transaction-type="JTA">

          <provider>org.hibernate.ejb.HibernatePersistence</provider>

          <jta-data-source>java:jboss/datasources/BBStatsDS</jta-data-source>

       

          <class>com.kawoolutions.bbstats.model.Arena</class>

          <class>com.kawoolutions.bbstats.model.Assignment</class>

          ...

       

          <exclude-unlisted-classes>false</exclude-unlisted-classes>

       

          <properties>

            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

            <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

            <property name="transaction.manager_lookup_class" value="org.jboss.as.jpa.hibernate3.JBossAppServerJtaPlatform" />

          </properties>

        </persistence-unit>

      </persistence>{code}

      When outcommenting the hibernate.dialect property, the exception goes away, but it seems to get even worse:

      {code}

      18:04:09,863 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/bbstats]] (MSC service thread 1-3) Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener: org.jboss.seam.InstantiationException: Could not instantiate Seam component: emf

          at org.jboss.seam.Component.newInstance(Component.java:2170) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.init.Initialization.init(Initialization.java:744) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36) [jboss-seam-2.2.2.Final.jar:]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.7.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.7.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:77) [jboss-as-web-7.1.0.CR1.jar:7.1.0.CR1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [:1.7.0_02]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.7.0_02]

          at java.lang.Thread.run(Unknown Source) [:1.7.0_02]

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: BBStatsPU] Unable to build EntityManagerFactory

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) [hibernate-entitymanager-3.6.9.Final.jar:]

          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

          at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:81) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50) [jboss-seam-2.2.2.Final.jar:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_02]

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_02]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_02]

          at java.lang.reflect.Method.invoke(Unknown Source) [:1.7.0_02]

          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.callComponentMethod(Component.java:2283) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.callCreateMethod(Component.java:2198) [jboss-seam-2.2.2.Final.jar:]

          at org.jboss.seam.Component.newInstance(Component.java:2158) [jboss-seam-2.2.2.Final.jar:]

          ... 13 more

      Caused by: org.hibernate.HibernateException: Unable to locate TypeSafeActivator#applyDDL method

          at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:226)

          at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-3.6.9.Final.jar:]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) [hibernate-entitymanager-3.6.9.Final.jar:]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) [hibernate-entitymanager-3.6.9.Final.jar:]

          ... 28 more

      Caused by: java.lang.NoSuchMethodException: org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(java.util.Collection, java.util.Properties, org.hibernate.dialect.Dialect)

          at java.lang.Class.getMethod(Unknown Source) [:1.7.0_02]

          at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:206)

          ... 33 more{code}

      Does anybody know what's going on and more importantly how to fix this?

       

      Karsten