Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HibernateException:/hibernate.cfg.xml未找到_Java_Hibernate_Exception - Fatal编程技术网

Java HibernateException:/hibernate.cfg.xml未找到

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

在使用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)


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

请使用问题描述更新标题,以便人们更容易找到您的问题并帮助您。它似乎正在根目录中查找配置文件,但不在那里。我认为你的设置中有一条不好的路径。可能是重复的,谢谢你的标题:),但我不认为问题是相同的