Java HibernateException:/hibernate.cfg.xml未找到
在使用servlet时,我遇到了以下问题:Java HibernateException:/hibernate.cfg.xml未找到,java,hibernate,exception,Java,Hibernate,Exception,在使用servlet时,我遇到了以下问题: org.hibernate.HibernateException: /hibernate.cfg.xml not found org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173) org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration
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)
hibernate.cfg.xml似乎在类路径根目录中搜索,但位于子包
com.dede.app1st.controller
中。将其移动到根目录包应该可以解决问题。请使用问题描述更新标题,以便人们更容易找到您的问题并帮助您。它似乎正在根目录中查找配置文件,但不在那里。我认为你的设置中有一条不好的路径。可能是重复的,谢谢你的标题:),但我不认为问题是相同的