首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到hibernate.cfg.xml

找不到hibernate.cfg.xml
EN

Stack Overflow用户
提问于 2020-08-27 13:45:51
回答 1查看 48关注 0票数 0

代码语言:javascript
复制
michael@michael:~/IdeaProjects/tulesco/tulesco$ tree
.
├── pom.xml
├── src
│   ├── hibernate.cfg.xml
│   ├── main
│   │   └── java
│   │       └── org
│   │           └── example
│   │               ├── Alien.java
│   │               └── App.java
│   └── test
│       └── java
│           └── org
│               └── example
│                   └── AppTest.java

..。

溯源

代码语言:javascript
复制
/usr/lib/jvm/jdk-11.0.8/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:58987,suspend=y,server=n -javaagent:/home/michael/Documents/idea-IC-202.6397.94/plugins/java/lib/rt/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /home/michael/IdeaProjects/tulesco/tulesco/target/classes:/home/michael/.m2/repository/org/hibernate/hibernate-core/4.1.6.Final/hibernate-core-4.1.6.Final.jar:/home/michael/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/home/michael/.m2/repository/org/jboss/logging/jboss-logging/3.1.0.GA/jboss-logging-3.1.0.GA.jar:/home/michael/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar:/home/michael/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/michael/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar:/home/michael/.m2/repository/org/javassist/javassist/3.15.0-GA/javassist-3.15.0-GA.jar:/home/michael/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final.jar:/home/michael/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar:/home/michael/Documents/idea-IC-202.6397.94/lib/idea_rt.jar org.example.App
Connected to the target VM, address: '127.0.0.1:58987', transport: 'socket'
Hello World!
Aug 27, 2020 4:37:25 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Aug 27, 2020 4:37:25 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.6.Final}
Aug 27, 2020 4:37:25 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Aug 27, 2020 4:37:25 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 27, 2020 4:37:25 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Aug 27, 2020 4:37:25 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found
    at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173)
    at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1949)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1930)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1910)
    at org.example.App.main(App.java:21)
Disconnected from the target VM, address: '127.0.0.1:58987', transport: 'socket'

Process finished with exit code 1

hibernate.cfg.xml位于src目录中。我尽我最大的能力搞不清楚为什么没有被发现。你能告诉我为什么找不到hibernate.cfg.xml吗?以及如何修复它?

EN

回答 1

Stack Overflow用户

发布于 2020-08-27 13:47:02

它应该在课堂上。对于Maven项目,您可以将其放在:

代码语言:javascript
复制
src\main\resources\hibernate.cfg.xml
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63617397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档