Hibernate4.3.6 Final+Spring3.0.5配置出錯提示及解決方案,hibernate4.3.6

來源:互聯網
上載者:User

Hibernate4.3.6 Final+Spring3.0.5配置出錯提示及解決方案,hibernate4.3.6

1. Caused by: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given, please either disable second  level cache or set correct region factory class name to property hibernate.cache.region.factory_class (and make sure the second level cache provider, hibernate-infinispan, for example, is available in the classpath).

    原因在於hibernate4.0在hibernate.cfg.xml配置二級緩衝和hibernate3.3有所不同,本例子用的是 Hibernate-core.4.3.6.Final,實際上從4.0開始就不一樣,二級緩衝的配置對比如下所示:    

4.0以上配置如下:

<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>

3.3配置如下:

<property name="hibernate.cache.use_second_level_cache">true</property>

<property name="cache.provider_class ">org.hibernate.cache.EhCacheProvider</property>

      但是如果僅僅是修改上述配置的話,還是會出錯,因為要使用二級緩衝的話,還需要引用相應的jar包,即hibernate-release-4.3.6.Final\lib\optional\ehcache下的jar包也要拷貝到lib中,否則會出現Unable to create requested service [org.hibernate.cache.spi.RegionFactory]的錯誤。

2.nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'attendTypeDao' is defined

這個錯誤提示很明顯:沒有定義相應的bean,仔細察看之後發現原來是自己太粗心,在定義bean時將"attendTypeDao"寫成了"attentTypeDao"導致

3.錯誤
!MESSAGE Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml檔案。

<servers>
<server hostname="localhost" id="JBoss v5.0 at localhost" name="JBoss v5.0 at
localhost" runtime-id="JBoss v5.0" server-type="org.eclipse.jst.server.generic.jboss5"
server-type-id="org.eclipse.jst.server.generic.jboss5" start-timeout="1000" stop-
timeout="15" timestamp="0">
<map jndiPort="1099" key="generic_server_instance_properties" port="8090"
serverAddress="127.0.0.1" serverConfig="default"/>
</server>
</servers>
把 start-timeout="45" 改為 start-timeout="100" 或者更長.

    就醬紫,終於部署成功了。但是實際部署時每個人遇到的問題可能都會有所不同,按它的出錯提示資訊仔細分析一般都可以找到原因。







Struts23161Hibernate434Spring402架構配置啟動出錯

sessionFactory 調用init時失敗,檢測資料庫連接部分。

貼出你sessionFactory的bean xml
 
一個對於SSH(struts21+spring30+hibernate33)配置的問題,幫下忙,問題如下,急等

at com.fei.dao.impl.IUserDAOImpl.login(IUserDAOImpl.java:17)

注意看錯誤提示
你的IUserDAOImpl第17行是什麼內容?
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.