在我的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)
答案 0 :(得分:1)
hibernate.cfg.xml似乎在类路径根目录中搜索,但位于子包com.dede.app1st.controller
中。将它移动到root包应该可以解决问题。