java.io.FileNotFoundException: class path resource ..cannot be opened because it does not exist

來源:互聯網
上載者:User

標籤:res   cli   原因   inf   val   ping   csharp   conf   bean   

java.io.FileNotFoundException: class path resource ..cannot be opened because it does not exist 異常如下:java.io.FileNotFoundException: class path resource [com/jxust/zjh/model/Account.hbm.xml] cannot be opened because it does not exist在spring中我這樣配置<property name="mappingResources"><list> <value>com/jxust/zjh/model/Account.hbm.xml</value></list></property>就報上述錯誤,Account.hbm.xml確實在此目錄下。但是,我改成這樣就運行正常,<property name="mappingDirectoryLocations"><list><value>classpath:/com/jxust/zjh/model/</value></list></property>解決方案:1.路徑問題,,,,,,直接將設定檔搞到src下面.....因為myeclipse預設會去src下找最簡單的方法還是老老實實把xml放在src下方便。或者建立config時建立成source folder,,,,就相當於是classpath了2.此時去查看tomcat中的web-inf下的classes檔案夾,查看上面報錯的差找不到beans檔案是否存在於tomcat中....如果不存在,,,,說明原因在這裡此時需要將tomcat中部署的項目刪掉.然後在myeclipse中的項目工程clean一下,然後重新部署,會發現所有檔案都部署到了tomcat中,項目完美運行.

  

java.io.FileNotFoundException: class path resource ..cannot be opened because it does not exist

聯繫我們

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