Hibernate映射出現Context initialization failed

來源:互聯網
上載者:User
今天給系統增加了一個表,要給這個表增加一個hibernate的對應檔,增加完對應檔後啟動,抱錯了ERROR [org.hibernate.util.XMLHelper] - Error parsing XML: XML InputStream(53) Value must be quoted. INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertymap,propertyConfigurer,dataSource,sessionFactory,transactionManager,proxyTemplate,dao,service,jdbcTemplate,updateService,priceService,createPriceUtil,createRoomNumberUtil,deletePriceUtil,roomNumberTimeoutUtil,jobDetailCreateDayprice,jobDetailCreateRoomNumber,jobDetailDeletePrice,jobDetailRoomNumberTimeout,cronTriggerDayprice,cronTriggerRoomNumber,cronTriggerDeletePrice,cronTriggerRoomNumberTimeout,org.springframework.scheduling.quartz.SchedulerFactoryBean]; root of BeanFactory hierarchy}ERROR [org.springframework.web.context.ContextLoader] - Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext-hibernate.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Could not read mapping document from file: ....../Price.hbm.xmlorg.hibernate.MappingException: Could not read mapping document from file: ..../Price.hbm.xml一看,肯定是對應檔出現問題了,首先檢查了類型,沒有問題最後發現,原來是在複製欄位時,將 <property        name="startdate"        type="timestamp"        column="startdate"        length="23"    />改成 <property        name=startdate        type="timestamp"        column="startdate"        length="23"    />少了一對雙引號,編輯器沒有報錯.但是啟動時卻無法正常啟動了.改回來後啟動正常了.隨後想了一下,將雙引號改成單引號試試,啟動系統還是正常啟動.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.