1 Reply Latest reply on Jan 28, 2010 5:19 PM by Boris Jockov

    Could not parse configuration hibernate.cfg.xml

    Boris Jockov Newbie

      Hey all.
      I've been trying to setup simple Seam/Hibernate application using examples from tutorial and some others. When I add Hibernate I get an exception saying it can't parse hibernate.cfg.xml. The very same hibernate.cfg.xml I used in a pure hibernate test app just to test it and it's ok.
      So here we go :


      hibernate.cfg.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE hibernate-configuration PUBLIC
                "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      
      <hibernate-configuration>
      <session-factory name="java:/bookingSessionFactory">
       <property name="connection.url">jdbc:derby:probnirad;create=true</property>
       <property name="connection.username">root</property>
       <property name="connection.password" ></property> 
       <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
       <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
       <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
       <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
       <property name="transaction.flush_before_completion">true</property>
       <property name="connection.release_mode">after_statement</property>
      </session-factory>
      </hibernate-configuration>
      


      components.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
        xmlns:core="http://jboss.com/products/seam/core"
        xmlns:persistence="http://jboss.com/products/seam/persistence"
        xmlns:security="http://jboss.com/products/seam/security"
        xmlns:drools="http://jboss.com/products/seam/drools"
        xmlns:web="http://jboss.com/products/seam/web"
        xmlns:mail="http://jboss.com/products/seam/mail"
        xmlns:transaction="http://jboss.com/products/seam/transaction"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation=
            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
             http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
             http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd
             http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
             http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
              
        <core:init debug="true"/>
        <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
        <persistence:managed-hibernate-session name="bookingDatabase" auto-create="true" session-factory-jndi-name="java:/bookingSessionFactory"/>
      </components>
      



      stack trace


      14:12:19,501 ERROR [[/seamWeb]] Exception sending context initialized event to l
      istener instance of class org.jboss.seam.servlet.SeamListener
      org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.
      xml
              at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1494)
              at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
              at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
              at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFacto
      ry(HibernateSessionFactory.java:120)
              at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateS
      essionFactory.java:79)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
              at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
              at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
              at org.jboss.seam.Component.newInstance(Component.java:1976)
              at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
              at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
              at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLif
      ecycle.java:95)
              at org.jboss.seam.init.Initialization.init(Initialization.java:583)
              at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.j
      ava:34)
              at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
      t.java:3856)
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
      361)
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
      .java:790)
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
      0)
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
      
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.j
      ava:296)
              at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
      64)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.apache.catalina.core.StandardContext.init(StandardContext.java:53
      12)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.j
      ava:296)
              at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
      64)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(Tom
      catDeployer.java:301)
              at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeplo
      yer.java:104)
              at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      
              at org.jboss.web.WebModule.startModule(WebModule.java:83)
              at org.jboss.web.WebModule.startService(WebModule.java:61)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:289)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:245)
              at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:978)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:417)
              at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy44.start(Unknown Source)
              at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:46
      6)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:142)
              at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor
      .java:97)
              at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(Intercepto
      rServiceMBeanSupport.java:238)
              at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInt
      erceptor.java:87)
              at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.
      start(SubDeployerInterceptorSupport.java:188)
              at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterce
      ptor.java:95)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy45.start(Unknown Source)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
              at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:142)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy9.deploy(Unknown Source)
              at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:421)
              at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:634)
              at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:263)
              at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
      bstractDeploymentScanner.java:336)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:289)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:245)
              at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:978)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:417)
              at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy4.start(Unknown Source)
              at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:142)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy5.deploy(Unknown Source)
              at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
              at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
              at org.jboss.Main.boot(Main.java:200)
              at org.jboss.Main$1.run(Main.java:508)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast
       to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot
       be cast to org.dom4j.DocumentFactory
              at org.dom4j.io.SAXReader.read(SAXReader.java:484)
              at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)
              ... 153 more
      14:12:19,551 ERROR [StandardContext] Error listenerStart
      14:12:19,552 ERROR [StandardContext] Context [/seamWeb] startup failed due to pr
      evious errors
      



      I am using Jboss 4.2.2GA and Seam 2.1.2. Hibernate used is the one provided by JBoss and the whole project is packaged by Maven.
      Is there something wrong with my configs? Help!
      Thx, Boris.