Intellij 找不到我的 Spring Boot 应用程序

Posted

技术标签:

【中文标题】Intellij 找不到我的 Spring Boot 应用程序【英文标题】:Intellij not finding my Spring Boot application 【发布时间】:2019-12-05 01:25:49 【问题描述】:

自从我将 IntelliJ 升级到 Ultimate 2019.2 后,突然开始出现以下问题:

/opt/jdk-11/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:43359,suspend=y,server=n -Dspring.profiles.active=dev -XX:TieredStopAtLevel= 1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/snap /intellij-idea-ultimate/159/plugins/Groovy/lib/agent/gragent.jar -javaagent:/snap/intellij-idea-ultimate/159/plugins/java/lib/rt/debugger-agent.jar -Dfile。 encoding=UTF-8 -classpath /home/thomas/workspace/AddyCaddy/out/production/classes:/home/thomas/workspace/AddyCaddy/out/production/resources:/home/thomas/workspace/AddyCaddy/libs/heavyweight- util-1.11.jar:/home/thomas/workspace/AddyCaddy/libs/AddyCaddy-client-0.5.1-SNAPSHOT.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework .boot/spring-boot-starter-actuator/2.1.5.RELEASE/4abebc4ec0ee87155bfa8daf6a9d63366308e58a/spring-boot-starter-actuator-2.1.5.RELEASE.jar:/home/thomas/。 gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-data-jpa/2.1.5.RELEASE/f33f69b3744d07f832db6ab48eab227ccde9e922/spring-boot-starter-data-jpa-2.1.5。 RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.mariadb.jdbc/mariadb-java-client/1.5.9/75d4d6e4cdb9a551a102e92a14c640768174e214/mariadb-java-client-1.5.9。 jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-web/2.1.5.RELEASE/d46494b46a626cbd8f253066a2d7413412efc908/spring-boot-starter-web- 2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.h2database/h2/1.4.199/7bf08152984ed8859740ae3f97fae6c72771ae45/h2-1.4.199.jar:/home/thomas /.gradle/caches/modules-2/files-2.1/net.sf.dozer/dozer/5.5.1/f2e52ef54166788ae29b5b4eec6fdb9cd580acab/dozer-5.5.1.jar:/home/thomas/.gradle/caches/modules-2/文件-2.1/org.springframework.boot/spring-boot-starter-aop/2.1.5.RELEASE/464cfb573009e724ea76ca404f106b1b19e759ff/spring-boot-starter-aop-2.1.5.RELEASE.jar: /home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-jdbc/2.1.5.RELEASE/6f187e708a47b0d37552a01292ce649a97a0059d/spring-boot-starter-jdbc-2.1。 5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-devtools/2.1.5.RELEASE/82da693e16b112f535e2cb2682a29b23f7378dd0/spring-boot-devtools- 2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/2.1.5.RELEASE/cf880b4a4713b2a1aea21f929df718a0260aa29/spring- boot-starter-json-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter/2.1.5.RELEASE/ 74952d169c2da56f7794b3a88508e52005bb8f36/spring-boot-starter-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-actuator-autoconfigure/2.1。 5.RELEASE/4e6774d2f4a70e62092dbaace39190f8b1df8083/spring-boot-actuator-autoconfigure-2.1.5.RELEASE.jar:/home/thomas/.gradl e/caches/modules-2/files-2.1/io.micrometer/micrometer-core/1.1.4/96eabfe2343a4a4676d215b2122cbbc4d4b6af9b/micrometer-core-1.1.4.jar:/home/thomas/.gradle/caches/modules-2/ files-2.1/javax.transaction/javax.transaction-api/1.3/e006adf5cf3cca2181d16bd640ecb80148ec0fce/javax.transaction-api-1.3.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/javax.xml。绑定/jaxb-api/2.3.1/8531ad5ac454cc2deb9d4d32c40c4d7451939b5d/jaxb-api-2.3.1.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.hibernate/hibernate-core/5.3。 10.Final/e608b854325005edbf43cb2b6041fdafd3f2eb57/hibernate-core-5.3.10.Final.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/2.1。 8.RELEASE/385ab53309b4f0dfb317c4753fe853821ff15c08/spring-data-jpa-2.1.8.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aspects/5.1.7。 RELEASE/15309277b9a18c8dae21272be3e57b69a67c41f6/spring-aspects-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.spr ingframework.boot/spring-boot-starter-tomcat/2.1.5.RELEASE/49de1c20ea6b8c6920d0a66329f9bf980e4498eb/spring-boot-starter-tomcat-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/ files-2.1/org.hibernate.validator/hibernate-validator/6.0.16.Final/ad9557c558972093c0567a2a1f224f318c00f650/hibernate-validator-6.0.16.Final.jar:/home/thomas/.gradle/caches/modules-2/files- 2.1/org.springframework/spring-webmvc/5.1.7.RELEASE/686326ff513bf4e852b3ee359cf741d92ab82cfe/spring-webmvc-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org。 springframework/spring-web/5.1.7.RELEASE/595dd528ec66eccc6cf4375ea3b56f3605fa1d1f/spring-web-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/commons-beanutils/commons- beanutils/1.9.1/d2662a4e018671ed061e9acca6299a31b7652f3c/commons-beanutils-1.9.1.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.8.1/ 6505a72a097d9270f7a9e7bf42c4238283247755/commons-lang3-3.8.1.jar:/home/thomas/.gradle/caches/m odules-2/files-2.1/org.slf4j/jcl-over-slf4j/1.7.26/33fbc2d93de829fa5e263c5ce97f5eab8f57d53e/jcl-over-slf4j-1.7.26.jar:/home/thomas/.gradle/caches/modules-2/ files-2.1/com.zaxxer/HikariCP/3.2.0/6c66db1c636ee90beb4c65fe34abd8ba9396bca6/HikariCP-3.2.0.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring- data-commons/2.1.8.RELEASE/d68b9a9850ee21319469c40bdbdfe4eaaf29557/spring-data-commons-2.1.8.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/ spring-boot-starter-logging/2.1.5.RELEASE/b4fe11fb0e606b67b9fb2bd9ae4fe65b484445dd/spring-boot-starter-logging-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/ ch.qos.logback/logback-classic/1.2.3/7c4f3c474fb2c041d8028740440937705ebb473a/logback-classic-1.2.3.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.logging。 log4j/log4j-to-slf4j/2.11.2/6d37bf7b046c0ce2669f26b99365a2cfa45c4c18/log4j-to-slf4j-2.11.2.jar:/home/thomas/.gradle/caches/modules-2/files-2.1 /org.slf4j/jul-to-slf4j/1.7.26/8031352b2bb0a49e67818bf04c027aa92e645d5c/jul-to-slf4j-1.7.26.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.slf4j /slf4j-api/1.7.26/77100a62c2e6f04b53977b9f541044d7d722693d/slf4j-api-1.7.26.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure /2.1.5.RELEASE/69ae2819b295603563b95f79abae53f2631c5b94/spring-boot-autoconfigure-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot -actuator/2.1.5.RELEASE/eccd3c70cfbe9534db19fbdd6cbf86fab884c3c0/spring-boot-actuator-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring -boot/2.​​1.5.RELEASE/939061a385b4e30e115978d78a7412fb984674df/spring-boot-2.1.5.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/javax.annotation/javax.annotation-api /1.3.2/934c04d3cfef185a8008e7bf34331b79730a9d43/javax.annotation-api-1.3.2.jar:/home/thomas/.gradle/caches/modules-2/files-2.1 /org.springframework/spring-context/5.1.7.RELEASE/b4154d41a70c56eeca42974825fe64a8576642dd/spring-context-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework /spring-aop/5.1.7.RELEASE/8138b5e3dd01d514741de35d7f5050599c617509/spring-aop-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm /5.1.7.RELEASE/1e532795f730814b07961fbf5f14e14bd2507fcd/spring-orm-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/5.1.7 .RELEASE/d00069664e066c4021fa3de167ad755e4148f340/spring-jdbc-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/5.1.7.RELEASE/d437d5d16bbdc312d9242e /spring-tx-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.1.7.RELEASE/14cd651e4aa3514e75710c9450c7a0c89413e63f/spring-beans -5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.srin gframework/spring-expression/5.1.7.RELEASE/7b47446553c83a5a7323d647f5c1793106b2948c/spring-expression-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spring-核心/5.1.7.RELEASE/280f821b9ed4dad9993f1d551d6e86557092ae58/spring-core-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.23/ec62d74fe5365689c28c8c05bbdb05 snakeyaml-1.23.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.9.8/28ad1bced632ba338e51c825a652f6e11a8e6eac/jackson-datatype-jsr310- 2.9.8.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.9.8/bcd02aa9195390e23747ed40bf76be869ad3a2fb/jackson-datatype-jdk8- 2.9.8.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-parameter-names/2.9.8/c4eef0e6e20d60fb27af4bc4770dba7bcc3f6de6/jackson-module-参数名称-2.9.8.jar:/home/thomas/.gradle/ca ches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.9.8/11283f21cc480aa86c4df7a0a3243ec508372ed2/jackson-databind-2.9.8.jar:/home/thomas/.gradle/caches/modules- 2/files-2.1/org.hdrhistogram/HdrHistogram/2.1.9/e4631ce165eb400edecfa32e03d3f1be53dee754/HdrHistogram-2.1.9.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.latencyutils/LatencyUtils/ 2.0.3 / 769c0b82cb2421c8256300e907298a9410a2a3d3 / LatencyUtils-2.0.3.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.9.4/9205229878f3d62fbd3a32a0fb6be2d6ad8589a9/aspectjweaver-1.9.4。 jar:/home/thomas/.gradle/caches/modules-2/files-2.1/javax.activation/javax.activation-api/1.2.0/85262acf3ca9816f9537ca47d5adeabaeaad7cb16/javax.activation-api-1.2.0.jar:/home /thomas/.gradle/caches/modules-2/files-2.1/org.hibernate.common/hibernate-commons-annotations/5.0.4.Final/965a18fdf939ee75e41f7918532d37b3a8350535/hibernate-commons-annotations-5.0.4.Final.jar: /home/thomas/.gradle/caches/modules-2/files-2.1/org.jb oss.logging/jboss-logging/3.3.2.Final/3789d00e859632e6c6206adc0c71625559e6e3b0/jboss-logging-3.3.2.Final.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/javax.persistence/ javax.persistence-api/2.2/25665ac8c0b62f50e6488173233239120fc52c96/javax.persistence-api-2.2.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.23.2-GA/ c5afe660a95e87ceb518e4f5cf02f5c56b547683/javassist-3.23.2-GA.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.9.12/39050dbbd36862ea87eb19.94158854b 12.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar:/home/thomas/.gradle/caches/ modules-2/files-2.1/org.jboss/jandex/2.0.5.Final/7060f67764565b9ee9d467e3ed0cb8a9c601b23a/jandex-2.0.5.Final.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/ com.fasterxml/classmate/1.4.0/291658ac2ce2476256c7115943652c0accb5c857/classmate-1.4.0.jar:/home/thomas/.gradle/caches/modules -2/files-2.1/org.dom4j/dom4j/2.1.1/3dce5dbb3571aa820c677fadd8349bfa8f00c199/dom4j-2.1.1.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.tomcat .embed/tomcat-embed-websocket/9.0.19/dee79022818f490203f4901f5651f3233aee14db/tomcat-embed-websocket-9.0.19.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.tomcat .embed/tomcat-embed-core/9.0.19/56e42e12bf92b713befd0700430f7c5c0af68d49/tomcat-embed-core-9.0.19.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.tomcat .embed/tomcat-embed-el/9.0.19/6145f2cd11c7df4ad9463637087c0f7e8e673394/tomcat-embed-el-9.0.19.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/javax.validation/validation -api/2.0.1.Final/cb855558e6271b1b32e716d24cb85c7f583ce09e/validation-api-2.0.1.Final.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2 .1/761ea405b9b37ced573d2df0d1e3a4e0f9edc668/commons-collections-3.2.1.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.springframework/spri ng-jcl/5.1.7.RELEASE/6b14bfb9ae41ca1bc604fe2e78f4a6efa3d67002/spring-jcl-5.1.7.RELEASE.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/ jackson-annotations/2.9.0/7c10d545325e3a6e72e06381afe469fd40eb701/jackson-annotations-2.9.0.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/ 2.9.8/f5a654e4675769c716e5b387830d19b501ca191/jackson-core-2.9.8.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.3/864344400c3d4d4d4d92dfeb67a303cdc8792dfeb67a303cdc8795 logback-core-1.2.3.jar:/home/thomas/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.11.2/f5e9a2ffca496057d6891a3de65128efc636e26e/log4j-api- 2.11.2.jar:/snap/intellij-idea-ultimate/159/lib/idea_rt.jar org.addycaddy.AddycaddyApplication

Connected to the target VM, address: '127.0.0.1:43359', transport: 'socket'
Error: Could not find or load main class org.addycaddy.AddycaddyApplication
Caused by: java.lang.ClassNotFoundException: org.addycaddy.AddycaddyApplication
Disconnected from the target VM, address: '127.0.0.1:43359', transport: 'socket'

Process finished with exit code 1

我通过单击org.addycaddy.AddycaddyApplication 的主要功能上的播放按钮来运行它。我不得不将该目录标记为源目录和测试源。我重新导入了我的 gradle.build。我尝试重建项目,但在我的源项目中也找不到项目。

我还尝试过使缓存无效并重新启动。没有变化。

我想不出还有什么可以尝试的。

【问题讨论】:

先关闭Intellij Idea,进入目录删除.idea目录,删除.iml文件。然后从现有源转到 File > New > Project,将项目导入为 maven 或 gradle 。 【参考方案1】:

首先关闭Intellij Idea,进入源代码所在目录,删除.idea目录,删除.iml文件。然后转到 File > New > Project from existing sources,将项目导入为 maven 或 gradle。我在下面的屏幕截图下方提供。

然后选择目录并导入为 maven 或 gradle 项目。

【讨论】:

【参考方案2】:

就我而言,我遇到了类似的问题。我正在使用 Intellij IDEA 2021.2,并且在 pom.xml 中找不到一些工件。我关闭了项目并重新打开,通过 maven 更新了依赖项,然后一切都很好......

【讨论】:

您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center。

以上是关于Intellij 找不到我的 Spring Boot 应用程序的主要内容,如果未能解决你的问题,请参考以下文章

intellij 编译 springmvc+hibernate+spring+maven 找不到hbm.xml映射文件

在 IntelliJ IDE 中找不到 Maven 插件

intellij idea 怎么找不到spring boot

Spring boot JSF可执行JAR找不到xhtml文件

intellij idea 怎么找不到spring boot

Intellij16创建Spring-Mybatis项目创(填)建(坑)记录,解决IDEA下找不到xml文件的问题