Search code examples
mysqltapestry

How to change database of tapestry 5 demo(tapestry-hotel-booking) to mysql


I change hibernate.cfg.xml as the following:

<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/quickstart</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">aaa</property>
        <property name="hbm2ddl.auto">update</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.format_sql">true</property>
    </session-factory>
</hibernate-configuration>

but I can't run and have the following error:

[ERROR] ioc.Registry Error invoking constructor public org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List): org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
[ERROR] ioc.Registry Operations trace:
[ERROR] ioc.Registry [ 1] Realizing service RegistryStartup
[ERROR] ioc.Registry [ 2] Instantiating service RegistryStartup implementation via org.apache.tapestry5.ioc.internal.services.RegistryStartup(Logger, List) (at RegistryStartup.java:36) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49)
[ERROR] ioc.Registry [ 3] Creating plan to instantiate org.apache.tapestry5.ioc.internal.services.RegistryStartup via public org.apache.tapestry5.ioc.internal.services.RegistryStartup(org.slf4j.Logger,java.util.List)
[ERROR] ioc.Registry [ 4] Determining injection value for parameter #2 (java.util.List)
[ERROR] ioc.Registry [ 5] Collecting ordered configuration for service RegistryStartup
[ERROR] ioc.Registry [ 6] Invoking www.com.example.forum.dal.DataModule.initialize() (at DataModule.java:37)
[ERROR] ioc.Registry [ 7] Instantiating service HibernateSessionManager implementation via org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionManager(HibernateSessionSource, PerthreadManager) (at HibernateCoreModule.java:96)
[ERROR] ioc.Registry [ 8] Constructing service implementation via org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionManager(HibernateSessionSource, PerthreadManager) (at HibernateCoreModule.java:96)
[ERROR] ioc.Registry [ 9] Realizing service HibernateSessionSource
[ERROR] ioc.Registry [10] Instantiating service HibernateSessionSource implementation via org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(Logger, List) (at HibernateSessionSourceImpl.java:36) via org.apache.tapestry5.hibernate.HibernateCoreModule.bind(ServiceBinder) (at HibernateCoreModule.java:45)

and so on.


Solution

  • That looks like a classpath issue; you should verify that you have all the necessary JARs, and no unnecessary JARS, on the classpath. I believe you may have mismatched versions of the SLF4J (logging framework) JARs.