如何将 Tapestry 5 demo(tapestry-hotel-booking) 的数据库更改为 mysql

发布于 2024-12-26 15:52:59 字数 3118 浏览 2 评论 0原文

我将 hibernate.cfg.xml 更改如下:

<!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>

但无法运行并出现以下错误:

[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)

等等。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最舍不得你 2025-01-02 15:52:59

这看起来像是一个类路径问题;您应该验证类路径上是否有所有必需的 JAR,并且没有不必要的 JAR。我相信您的 SLF4J(日志框架)JAR 版本可能不匹配。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文