1 Reply Latest reply on Oct 20, 2010 5:27 PM by Ivan B

    hibernate.cfg.xml is not picked up by Seam

    Ivan B Novice

      Hey everyone,

      I'm trying to setup maven based seam application following the instructions kindly provided here:

      Creating a JBoss Seam application

      Beside the mentioned configuration I added maven-jetty-plugin into pom.xml, in order to test the application with jetty:run command.

      However, when I run the application, I get the following error:

      2010-10-20 21:55:21.995:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@44efdd58{/MyCMS,/Users/xman/Store/src/main/webapp}
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: hibernateSessionFactory
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           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(ServletLifecycle.java:95)

      It seems like hibernate.cfg.xml is not seen by Seam, even though it resides in the /resources dir of the webapp.

      Can anyone suggest any hints why this might happen?


        • 1. Re: hibernate.cfg.xml is not picked up by Seam
          Ivan B Novice

          During racking my brains for almost the whole day crawling to the root of this problem I suspected many things.
          However, the solution turned out to be missing slf4j-log4j dependency in maven :)


          How did I find this? Put a break point into org.jboss.seam.persistence.HibernateSessionFactory, and discovered that Hibernate did not bootstap properly without this lib and the real exception had been swallowed. What a shame )

          Anyway, I'm happy now )
          Wish everyone not to come across similar weird issues )