一、启动主程序报错
1. 异常:找不到或无法加载主类
错误: 找不到或无法加载主类 com.zsx.EurekaServerApplication
原因: java.lang.ClassNotFoundException: com.zsx.EurekaServerApplication
Process finished with exit code 1
2. 背景:单个spring-cloud文件夹下多个工程,通过TortoiseGit提交到Github后,再重新从Github拉取后,使用Intellij IDEA打开spring-cloud,启动主程序报错
3. 通过Beyond Compare 4进行对比(Push前内容和Pull后内容),发现如下变化
4. 解决方法,修改spring-cloud.iml 文件,将
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/spring-cloud-eureka-server/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/spring-cloud-eureka-server/src/main/resources" type="java-resource" />
</content>
修改为
<content url="file://$MODULE_DIR$"/>
5.查看结果
C:\software\jdk-11.0.3\bin\java.exe -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:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=19006:C:\software\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath F:\IdeaProjects\spring-cloud\spring-cloud-eureka-server\target\classes;D:\repository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-server\2.1.2.RELEASE\spring-cloud-starter-netflix-eureka-server-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-starter\2.1.2.RELEASE\spring-cloud-starter-2.1.2.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-context\2.1.2.RELEASE\spring-cloud-context-2.1.2.RELEASE.jar;D:\repository\org\springframework\security\spring-security-crypto\5.1.5.RELEASE\spring-security-crypto-5.1.5.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-commons\2.1.2.RELEASE\spring-cloud-commons-2.1.2.RELEASE.jar;D:\repository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;D:\repository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;D:\repository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-eureka-server\2.1.2.RELEASE\spring-cloud-netflix-eureka-server-2.1.2.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-actuator\2.1.6.RELEASE\spring-boot-starter-actuator-2.1.6.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.1.6.RELEASE\spring-boot-actuator-autoconfigure-2.1.6.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-actuator\2.1.6.RELEASE\spring-boot-actuator-2.1.6.RELEASE.jar;D:\repository\io\micrometer\micrometer-core\1.1.5\micrometer-core-1.1.5.jar;D:\repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;D:\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\repository\org\springframework\boot\spring-boot-starter-freemarker\2.1.6.RELEASE\spring-boot-starter-freemarker-2.1.6.RELEASE.jar;D:\repository\org\freemarker\freemarker\2.3.28\freemarker-2.3.28.jar;D:\repository\org\springframework\spring-context-support\5.1.8.RELEASE\spring-context-support-5.1.8.RELEASE.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-hystrix\2.1.2.RELEASE\spring-cloud-netflix-hystrix-2.1.2.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-aop\2.1.6.RELEASE\spring-boot-starter-aop-2.1.6.RELEASE.jar;D:\repository\org\aspectj\aspectjweaver\1.9.4\aspectjweaver-1.9.4.jar;D:\repository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.1.2.RELEASE\spring-cloud-netflix-eureka-client-2.1.2.RELEASE.jar;D:\repository\com\netflix\eureka\eureka-client\1.9.12\eureka-client-1.9.12.jar;D:\repository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\repository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\repository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\repository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\repository\joda-time\joda-time\2.10.2\joda-time-2.10.2.jar;D:\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\repository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\repository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\repository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\repository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\repository\org\apache\httpcomponents\httpclient\4.5.9\httpclient-4.5.9.jar;D:\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar;D:\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\repository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\repository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\repository\com\sun\jersey\jersey-servlet\1.19.1\jersey-servlet-1.19.1.jar;D:\repository\com\sun\jersey\jersey-server\1.19.1\jersey-server-1.19.1.jar;D:\repository\com\netflix\eureka\eureka-core\1.9.12\eureka-core-1.9.12.jar;D:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar;D:\repository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\repository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;D:\repository\com\google\guava\guava\16.0\guava-16.0.jar;D:\repository\javax\inject\javax.inject\1\javax.inject-1.jar;D:\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-xml\2.9.9\jackson-dataformat-xml-2.9.9.jar;D:\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.9.9\jackson-module-jaxb-annotations-2.9.9.jar;D:\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\repository\xmlpull\xmlp