【问题标题】:HibernateException: /hibernate.cfg.xml not foundHibernateException:/hibernate.cfg.xml 未找到
【发布时间】:2018-05-22 19:24:20
【问题描述】:

在处理我的 servlet 时遇到了这个问题:

org.hibernate.HibernateException: /hibernate.cfg.xml not found
    org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
    org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2093)
    org.hibernate.cfg.Configuration.configure(Configuration.java:2074)
    org.hibernate.cfg.Configuration.configure(Configuration.java:2054)
    com.dede.app1st.controller.AddUser.doPost(AddUser.java:26)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

【问题讨论】:

  • 请用问题描述更新标题,以便人们更容易找到您的问题并为您提供帮助。
  • 它似乎在根目录中寻找配置文件,但它不存在。我认为您的设置中某处存在错误路径。
  • 感谢标题 :) 但我认为问题不一样

标签: java hibernate exception


【解决方案1】:

hibernate.cfg.xml 似乎在您的类路径根目录中搜索,但位于子包com.dede.app1st.controller 中。将其移至根包应该可以解决问题。

【讨论】:

    猜你喜欢
    • 2012-01-02
    • 2011-06-23
    • 2015-02-07
    • 2013-01-24
    • 1970-01-01
    • 1970-01-01
    • 2013-02-21
    • 2012-03-16
    相关资源
    最近更新 更多