Hibernate在初始化过程中“无法打开连接”错误?

问题描述:

康寿消息:Hibernate在初始化过程中“无法打开连接”错误?

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> 

+0

修正:只需添加log4j.properties项目的类路径和其固定 – 2012-07-30 04:56:31

+0

没有u得到正确的网址是什么? ' jdbc:mysql:// localhost/support',默认端口号? – Cruis 2012-07-30 08:48:15

修正:

只添加项目的类路径log4j.properties其固定

+0

你应该接受你的答案。 – 2012-07-30 09:16:08

+1

阅读此为什么:http://meta.stackexchange.com/questions/6044/why-must-i-wait-2-days-before-accepting-my-own-answer – 2012-07-30 10:00:37

+0

亚我知道..谢谢你的参考.. – 2012-07-30 10:07:51