初始化期间Hibernate“无法打开连接”错误?

时间:2012-07-30 04:26:16

标签: hibernate jsp log4j

康索尔消息:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hibernate.exception.GenericJDBCException: Could not open connection

配置文件

    

    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost/support</property> 
    <property name="connection.username">prince</property>
    <property name="connection.password">prince</property>
    <property name="show_sql">false</property>
    <property name="format_sql">false</property>

    <!-- JDBC connection pool (use the built-in)  -->
    <property name="connection.pool_size">1</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>

    <!-- Disable the second-level cache -->
    <!--<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>-->
    <property name="hibernate.hbm2ddl.auto">create</property>
    <property name="connection.autocommit">false</property>

    <!-- Mapping files -->
    <mapping class="com.swiftant.model.Ticket"/>
    <mapping class="com.swiftant.model.TicketPriority"/>
    <mapping class="com.swiftant.model.TicketStatus"/>
    <mapping class="com.swiftant.model.Role"/>
    <mapping class="com.swiftant.model.BusinessUnit"/>
    <mapping class="com.swiftant.model.Member"/>

   </session-factory>

1 个答案:

答案 0 :(得分:0)

修正:

只需在项目的类路径中添加log4j.properties及其固定的