写点什么

Java 致命错误: 在类路径或引导类路径中找不到程序包 java.lang

作者:Andy
  • 2023-06-01
    北京
  • 本文字数:20342 字

    阅读完需:约 67 分钟

一、包重复配置问题


1)问题描述


先说下最开始遇到的问题。


在使用开源项目铭飞(MCMS)过程中,项目已经导入本地,数据库也已经构建完成,启动 MSApplication 主程序,访问地址,一切正确。


Gitee 地址:


git@gitee.com:mingSoft/MCMS.git
复制代码


接下来试着去打包,将其部署到本地 Tomcat 容器上。


谁知构建打包的时候,居然报了一个错误,描述如下:



红色文字详细内容如下:



Some problems were encountered while building the effective model for net.mingsoft:ms-mcms:jar:5.3.1'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.logging.log4j:log4j-slf4j-impl:jar -> duplicate declaration of version ${log4j.version} @ line 97, column 21It is highly recommended to fix these problems because they threaten the stability of your build.For this reason, future Maven versions might no longer support building such malformed projects.
复制代码


仔细一读,就是说,在构建模块 net.mingsoft:ms-mcms:jar:5.3.1 中,要求 org.apache.logging.log4j:log4j-slf4j-impl:jar 必须是唯一的。


那么,很显然,就说明,打的相关包,肯定是不唯一的,要不然不会报这个错误。


2)问题解决


接下来就去 pom.xml 文件看下具体的情况。


仔细一查,还真是多写了一个。



故而,去掉多余的那个部分就行了。


二、找不到程序包 java.lang 问题


1)问题描述


解决了以上问题之后,重新打包,又报出了新的问题。



详细描述的内容如下:


[INFO] [INFO] ------------------------< net.mingsoft:ms-mcms >------------------------[INFO] Building net.mingsoft:ms-mcms 5.3.1[INFO] --------------------------------[ jar ]---------------------------------[INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ ms-mcms ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Using 'UTF-8' encoding to copy filtered properties files.[INFO] Copying 1042 resources[INFO] Copying 5 resources[INFO] Copying 5 resources[INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ms-mcms ---[INFO] Changes detected - recompiling the module![INFO] Compiling 31 source files to C:\Projects\ailpha\MCMS\target\classes[语法分析开始时间 SimpleFileObject[C:\Projects\ailpha\MCMS\src\main\java\net\mingsoft\cms\dao\ICmsHistoryLogDao.java]][语法分析已完成, 用时 16 毫秒]
......
[语法分析开始时间 SimpleFileObject[C:\Projects\ailpha\MCMS\src\main\java\net\mingsoft\cms\biz\impl\CategoryBizImpl.java]][语法分析已完成, 用时 4 毫秒][源文件的搜索路径: C:\Projects\ailpha\MCMS\src\main\java][类文件的搜索路径: C:\Program Files\Java\jdk-11.0.9\lib\rt.jar,C:\Program Files\Java\jdk-11.0.9\lib\jce.jar,C:\Projects\ailpha\MCMS\target\classes,C:\Users\andy\.m2\repository\net\mingsoft\ms-base\2.1.19\ms-base-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-ueditor\1.0.6\ms-ueditor-1.0.6.jar,C:\Users\andy\.m2\repository\org\json\json\20160212\json-20160212.jar,C:\Users\andy\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar,C:\Users\andy\.m2\repository\commons-fileupload\commons-fileupload\1.3.1\commons-fileupload-1.3.1.jar,C:\Users\andy\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar,C:\Users\andy\.m2\repository\net\mingsoft\shiro-freemarker-tags\1.0.3\shiro-freemarker-tags-1.0.3.jar,C:\Users\andy\.m2\repository\com\mysql\mysql-connector-j\8.0.31\mysql-connector-j-8.0.31.jar,C:\Users\andy\.m2\repository\org\mybatis\mybatis\3.5.11\mybatis-3.5.11.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-boot-starter\3.5.2\mybatis-plus-boot-starter-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus\3.5.2\mybatis-plus-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-extension\3.5.2\mybatis-plus-extension-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-core\3.5.2\mybatis-plus-core-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-annotation\3.5.2\mybatis-plus-annotation-3.5.2.jar,C:\Users\andy\.m2\repository\com\github\jsqlparser\jsqlparser\4.4\jsqlparser-4.4.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.6.21\kotlin-stdlib-jdk8-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.6.21\kotlin-stdlib-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.6.21\kotlin-stdlib-common-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.6.21\kotlin-stdlib-jdk7-1.6.21.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.7\spring-boot-autoconfigure-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.7.7\spring-boot-starter-jdbc-2.7.7.jar,C:\Users\andy\.m2\repository\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar,C:\Users\andy\.m2\repository\org\springframework\spring-jdbc\5.3.24\spring-jdbc-5.3.24.jar,C:\Users\andy\.m2\repository\com\alibaba\druid-spring-boot-starter\1.2.14\druid-spring-boot-starter-1.2.14.jar,C:\Users\andy\.m2\repository\com\alibaba\druid\1.2.14\druid-1.2.14.jar,C:\Users\andy\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.2.2\mybatis-spring-boot-starter-2.2.2.jar,C:\Users\andy\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.2.2\mybatis-spring-boot-autoconfigure-2.2.2.jar,C:\Users\andy\.m2\repository\org\mybatis\mybatis-spring\2.0.7\mybatis-spring-2.0.7.jar,C:\Users\andy\.m2\repository\org\mybatis\caches\mybatis-ehcache\1.2.2\mybatis-ehcache-1.2.2.jar,C:\Users\andy\.m2\repository\net\sf\ehcache\ehcache\2.10.9.2\ehcache-2.10.9.2.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.4.6\pagehelper-spring-boot-starter-1.4.6.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.4.6\pagehelper-spring-boot-autoconfigure-1.4.6.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper\5.3.2\pagehelper-5.3.2.jar,C:\Users\andy\.m2\repository\org\freemarker\freemarker\2.3.31\freemarker-2.3.31.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-all\1.10.0\shiro-all-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-lang\1.10.0\shiro-lang-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-config-core\1.10.0\shiro-config-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-config-ogdl\1.10.0\shiro-config-ogdl-1.10.0.jar,C:\Users\andy\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar,C:\Users\andy\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-core\1.10.0\shiro-crypto-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-hash\1.10.0\shiro-crypto-hash-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-cipher\1.10.0\shiro-crypto-cipher-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-event\1.10.0\shiro-event-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-core\1.10.0\shiro-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-web\1.10.0\shiro-web-1.10.0.jar,C:\Users\andy\.m2\repository\org\owasp\encoder\encoder\1.2.3\encoder-1.2.3.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-aspectj\1.10.0\shiro-aspectj-1.10.0.jar,C:\Users\andy\.m2\repository\org\aspectj\aspectjrt\1.9.7\aspectjrt-1.9.7.jar,C:\Users\andy\.m2\repository\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-cache\1.10.0\shiro-cache-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-guice\1.10.0\shiro-guice-1.10.0.jar,C:\Users\andy\.m2\repository\com\google\inject\guice\4.2.3\guice-4.2.3.jar,C:\Users\andy\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar,C:\Users\andy\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar,C:\Users\andy\.m2\repository\com\google\guava\guava\27.1-jre\guava-27.1-jre.jar,C:\Users\andy\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar,C:\Users\andy\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar,C:\Users\andy\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar,C:\Users\andy\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar,C:\Users\andy\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar,C:\Users\andy\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar,C:\Users\andy\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar,C:\Users\andy\.m2\repository\com\google\inject\extensions\guice-multibindings\4.2.3\guice-multibindings-4.2.3.jar,C:\Users\andy\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-hazelcast\1.10.0\shiro-hazelcast-1.10.0.jar,C:\Users\andy\.m2\repository\com\hazelcast\hazelcast\5.1.5\hazelcast-5.1.5.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-quartz\1.10.0\shiro-quartz-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-spring\1.10.0\shiro-spring-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-ehcache\1.10.0\shiro-ehcache-1.10.0.jar,C:\Users\andy\.m2\repository\net\sf\ehcache\ehcache-core\2.6.11\ehcache-core-2.6.11.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar,C:\Users\andy\.m2\repository\commons-io\commons-io\2.11.0\commons-io-2.11.0.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.13.4.2\jackson-databind-2.13.4.2.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.4\jackson-annotations-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.13.4\jackson-core-2.13.4.jar,C:\Users\andy\.m2\repository\cn\hutool\hutool-all\5.8.9\hutool-all-5.8.9.jar,C:\Users\andy\.m2\repository\redis\clients\jedis\3.8.0\jedis-3.8.0.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-pool2\2.11.1\commons-pool2-2.11.1.jar,C:\Users\andy\.m2\repository\com\google\zxing\javase\3.3.3\javase-3.3.3.jar,C:\Users\andy\.m2\repository\com\google\zxing\core\3.3.3\core-3.3.3.jar,C:\Users\andy\.m2\repository\com\beust\jcommander\1.72\jcommander-1.72.jar,C:\Users\andy\.m2\repository\org\jsoup\jsoup\1.10.3\jsoup-1.10.3.jar,C:\Users\andy\.m2\repository\com\github\stuxuhai\jpinyin\1.1.8\jpinyin-1.1.8.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-ooxml\4.1.2\poi-ooxml-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi\4.1.2\poi-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-math3\3.6.1\commons-math3-3.6.1.jar,C:\Users\andy\.m2\repository\com\zaxxer\SparseBitSet\1.2\SparseBitSet-1.2.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-ooxml-schemas\4.1.2\poi-ooxml-schemas-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\xmlbeans\xmlbeans\3.1.0\xmlbeans-3.1.0.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-compress\1.19\commons-compress-1.19.jar,C:\Users\andy\.m2\repository\com\github\virtuald\curvesapi\1.06\curvesapi-1.06.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-scratchpad\4.1.2\poi-scratchpad-4.1.2.jar,C:\Users\andy\.m2\repository\com\sun\mail\javax.mail\1.6.2\javax.mail-1.6.2.jar,C:\Users\andy\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar,C:\Users\andy\.m2\repository\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar,C:\Users\andy\.m2\repository\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar,C:\Users\andy\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar,C:\Users\andy\.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar,C:\Users\andy\.m2\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar,C:\Users\andy\.m2\repository\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-configuration-processor\2.7.7\spring-boot-configuration-processor-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-websocket\2.7.7\spring-boot-starter-websocket-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\spring-websocket\5.3.24\spring-websocket-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter\2.7.7\spring-boot-starter-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot\2.7.7\spring-boot-2.7.7.jar,C:\Users\andy\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar,C:\Users\andy\.m2\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar,C:\Users\andy\.m2\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.7.7\spring-boot-starter-web-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.7.7\spring-boot-starter-json-2.7.7.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.4\jackson-datatype-jdk8-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.4\jackson-datatype-jsr310-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.4\jackson-module-parameter-names-2.13.4.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.7\spring-boot-starter-tomcat-2.7.7.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.70\tomcat-embed-core-9.0.70.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.70\tomcat-embed-el-9.0.70.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.70\tomcat-embed-websocket-9.0.70.jar,C:\Users\andy\.m2\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-freemarker\2.7.7\spring-boot-starter-freemarker-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.7.7\spring-boot-starter-data-redis-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-redis\2.7.6\spring-data-redis-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-keyvalue\2.7.6\spring-data-keyvalue-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-commons\2.7.6\spring-data-commons-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\spring-oxm\5.3.24\spring-oxm-5.3.24.jar,C:\Users\andy\.m2\repository\io\lettuce\lettuce-core\6.1.10.RELEASE\lettuce-core-6.1.10.RELEASE.jar,C:\Users\andy\.m2\repository\io\netty\netty-common\4.1.86.Final\netty-common-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-handler\4.1.86.Final\netty-handler-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-resolver\4.1.86.Final\netty-resolver-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-buffer\4.1.86.Final\netty-buffer-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.86.Final\netty-transport-native-unix-common-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-codec\4.1.86.Final\netty-codec-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-transport\4.1.86.Final\netty-transport-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\projectreactor\reactor-core\3.4.26\reactor-core-3.4.26.jar,C:\Users\andy\.m2\repository\org\reactivestreams\reactive-streams\1.0.4\reactive-streams-1.0.4.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-quartz\2.7.7\spring-boot-starter-quartz-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\spring-tx\5.3.24\spring-tx-5.3.24.jar,C:\Users\andy\.m2\repository\org\quartz-scheduler\quartz\2.3.2\quartz-2.3.2.jar,C:\Users\andy\.m2\repository\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-log4j2\2.7.7\spring-boot-starter-log4j2-2.7.7.jar,C:\Users\andy\.m2\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar,C:\Users\andy\.m2\repository\org\springframework\spring-messaging\5.3.24\spring-messaging-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\security\spring-security-core\5.7.6\spring-security-core-5.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\security\spring-security-crypto\5.7.6\spring-security-crypto-5.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-context-support\5.3.24\spring-context-support-5.3.24.jar,C:\Users\andy\.m2\repository\junit\junit\4.13.2\junit-4.13.2.jar,C:\Users\andy\.m2\repository\org\hamcrest\hamcrest-core\2.2\hamcrest-core-2.2.jar,C:\Users\andy\.m2\repository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-core\4.5.1\mockito-core-4.5.1.jar,C:\Users\andy\.m2\repository\net\bytebuddy\byte-buddy\1.12.20\byte-buddy-1.12.20.jar,C:\Users\andy\.m2\repository\net\bytebuddy\byte-buddy-agent\1.12.20\byte-buddy-agent-1.12.20.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-junit-jupiter\4.5.1\mockito-junit-jupiter-4.5.1.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-inline\4.5.1\mockito-inline-4.5.1.jar,C:\Users\andy\.m2\repository\org\lionsoul\ip2region\1.7.2\ip2region-1.7.2.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-text\1.9\commons-text-1.9.jar,C:\Users\andy\.m2\repository\org\apache\tika\tika-core\2.4.1\tika-core-2.4.1.jar,C:\Users\andy\.m2\repository\org\apache\httpcomponents\httpclient\4.5.14\httpclient-4.5.14.jar,C:\Users\andy\.m2\repository\org\apache\httpcomponents\httpcore\4.4.16\httpcore-4.4.16.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-basic\2.1.19\ms-basic-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-mdiy\2.1.19\ms-mdiy-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\store-client\2.1.19.2\store-client-2.1.19.2.jar,C:\Users\andy\.m2\repository\org\apache\ant\ant\1.10.5\ant-1.10.5.jar,C:\Users\andy\.m2\repository\org\apache\ant\ant-launcher\1.10.5\ant-launcher-1.10.5.jar,C:\Users\andy\.m2\repository\com\github\oshi\oshi-core\6.2.2\oshi-core-6.2.2.jar,C:\Users\andy\.m2\repository\net\java\dev\jna\jna\5.12.1\jna-5.12.1.jar,C:\Users\andy\.m2\repository\net\java\dev\jna\jna-platform\5.12.1\jna-platform-5.12.1.jar,C:\Users\andy\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-core\2.20.0\log4j-core-2.20.0.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-slf4j-impl\2.20.0\log4j-slf4j-impl-2.20.0.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-api\2.20.0\log4j-api-2.20.0.jar,.][共 896 毫秒]致命错误: 在类路径或引导类路径中找不到程序包 java.lang[INFO] -------------------------------------------------------------[ERROR] COMPILATION ERROR : [INFO] -------------------------------------------------------------[ERROR] An unknown compilation problem occurred[INFO] 1 error[INFO] -------------------------------------------------------------
复制代码


2)分析原因


从问题的描述上来说看,“在类路径或引导类路径中找不到程序包 java.lang”,这让人不得不思考,是不是环境变量没有配置好,要不然,不可能找不到 java.lang,这个程序包可是非常基础和常用的包,一般都不会出现这种问题的。


没有办法,只好去检查一下环境变量的配置。


Java_home:



classpath:



path:



由此可见,环境变量问题,而且,如果有问题的话,那么,之前的本地 MSApplication 主程序启动就应该不行了才对。很显然,不是环境变量的问题。


那么,到底问题在哪里呢?


再去回看一下报错的日志信息,发现需要看下插件 maven-compiler-plugin。


[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ms-mcms ---[INFO] Changes detected - recompiling the module![INFO] Compiling 31 source files to C:\Projects\ailpha\MCMS\target\classes
......
[语法分析开始时间 SimpleFileObject[C:\Projects\ailpha\MCMS\src\main\java\net\mingsoft\cms\biz\impl\CategoryBizImpl.java]][语法分析已完成, 用时 4 毫秒][源文件的搜索路径: C:\Projects\ailpha\MCMS\src\main\java][类文件的搜索路径: C:\Program Files\Java\jdk-11.0.9\lib\rt.jar,C:\Program Files\Java\jdk-11.0.9\lib\jce.jar,C:\Projects\ailpha\MCMS\target\classes,C:\Users\andy\.m2\repository\net\mingsoft\ms-base\2.1.19\ms-base-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-ueditor\1.0.6\ms-ueditor-1.0.6.jar,C:\Users\andy\.m2\repository\org\json\json\20160212\json-20160212.jar,C:\Users\andy\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar,C:\Users\andy\.m2\repository\commons-fileupload\commons-fileupload\1.3.1\commons-fileupload-1.3.1.jar,C:\Users\andy\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar,C:\Users\andy\.m2\repository\net\mingsoft\shiro-freemarker-tags\1.0.3\shiro-freemarker-tags-1.0.3.jar,C:\Users\andy\.m2\repository\com\mysql\mysql-connector-j\8.0.31\mysql-connector-j-8.0.31.jar,C:\Users\andy\.m2\repository\org\mybatis\mybatis\3.5.11\mybatis-3.5.11.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-boot-starter\3.5.2\mybatis-plus-boot-starter-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus\3.5.2\mybatis-plus-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-extension\3.5.2\mybatis-plus-extension-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-core\3.5.2\mybatis-plus-core-3.5.2.jar,C:\Users\andy\.m2\repository\com\baomidou\mybatis-plus-annotation\3.5.2\mybatis-plus-annotation-3.5.2.jar,C:\Users\andy\.m2\repository\com\github\jsqlparser\jsqlparser\4.4\jsqlparser-4.4.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.6.21\kotlin-stdlib-jdk8-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.6.21\kotlin-stdlib-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.6.21\kotlin-stdlib-common-1.6.21.jar,C:\Users\andy\.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar,C:\Users\andy\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.6.21\kotlin-stdlib-jdk7-1.6.21.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.7\spring-boot-autoconfigure-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.7.7\spring-boot-starter-jdbc-2.7.7.jar,C:\Users\andy\.m2\repository\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar,C:\Users\andy\.m2\repository\org\springframework\spring-jdbc\5.3.24\spring-jdbc-5.3.24.jar,C:\Users\andy\.m2\repository\com\alibaba\druid-spring-boot-starter\1.2.14\druid-spring-boot-starter-1.2.14.jar,C:\Users\andy\.m2\repository\com\alibaba\druid\1.2.14\druid-1.2.14.jar,C:\Users\andy\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.2.2\mybatis-spring-boot-starter-2.2.2.jar,C:\Users\andy\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.2.2\mybatis-spring-boot-autoconfigure-2.2.2.jar,C:\Users\andy\.m2\repository\org\mybatis\mybatis-spring\2.0.7\mybatis-spring-2.0.7.jar,C:\Users\andy\.m2\repository\org\mybatis\caches\mybatis-ehcache\1.2.2\mybatis-ehcache-1.2.2.jar,C:\Users\andy\.m2\repository\net\sf\ehcache\ehcache\2.10.9.2\ehcache-2.10.9.2.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.4.6\pagehelper-spring-boot-starter-1.4.6.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.4.6\pagehelper-spring-boot-autoconfigure-1.4.6.jar,C:\Users\andy\.m2\repository\com\github\pagehelper\pagehelper\5.3.2\pagehelper-5.3.2.jar,C:\Users\andy\.m2\repository\org\freemarker\freemarker\2.3.31\freemarker-2.3.31.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-all\1.10.0\shiro-all-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-lang\1.10.0\shiro-lang-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-config-core\1.10.0\shiro-config-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-config-ogdl\1.10.0\shiro-config-ogdl-1.10.0.jar,C:\Users\andy\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar,C:\Users\andy\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-core\1.10.0\shiro-crypto-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-hash\1.10.0\shiro-crypto-hash-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-crypto-cipher\1.10.0\shiro-crypto-cipher-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-event\1.10.0\shiro-event-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-core\1.10.0\shiro-core-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-web\1.10.0\shiro-web-1.10.0.jar,C:\Users\andy\.m2\repository\org\owasp\encoder\encoder\1.2.3\encoder-1.2.3.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-aspectj\1.10.0\shiro-aspectj-1.10.0.jar,C:\Users\andy\.m2\repository\org\aspectj\aspectjrt\1.9.7\aspectjrt-1.9.7.jar,C:\Users\andy\.m2\repository\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-cache\1.10.0\shiro-cache-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-guice\1.10.0\shiro-guice-1.10.0.jar,C:\Users\andy\.m2\repository\com\google\inject\guice\4.2.3\guice-4.2.3.jar,C:\Users\andy\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar,C:\Users\andy\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar,C:\Users\andy\.m2\repository\com\google\guava\guava\27.1-jre\guava-27.1-jre.jar,C:\Users\andy\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar,C:\Users\andy\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar,C:\Users\andy\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar,C:\Users\andy\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar,C:\Users\andy\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar,C:\Users\andy\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar,C:\Users\andy\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar,C:\Users\andy\.m2\repository\com\google\inject\extensions\guice-multibindings\4.2.3\guice-multibindings-4.2.3.jar,C:\Users\andy\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-hazelcast\1.10.0\shiro-hazelcast-1.10.0.jar,C:\Users\andy\.m2\repository\com\hazelcast\hazelcast\5.1.5\hazelcast-5.1.5.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-quartz\1.10.0\shiro-quartz-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-spring\1.10.0\shiro-spring-1.10.0.jar,C:\Users\andy\.m2\repository\org\apache\shiro\shiro-ehcache\1.10.0\shiro-ehcache-1.10.0.jar,C:\Users\andy\.m2\repository\net\sf\ehcache\ehcache-core\2.6.11\ehcache-core-2.6.11.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar,C:\Users\andy\.m2\repository\commons-io\commons-io\2.11.0\commons-io-2.11.0.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.13.4.2\jackson-databind-2.13.4.2.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.4\jackson-annotations-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.13.4\jackson-core-2.13.4.jar,C:\Users\andy\.m2\repository\cn\hutool\hutool-all\5.8.9\hutool-all-5.8.9.jar,C:\Users\andy\.m2\repository\redis\clients\jedis\3.8.0\jedis-3.8.0.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-pool2\2.11.1\commons-pool2-2.11.1.jar,C:\Users\andy\.m2\repository\com\google\zxing\javase\3.3.3\javase-3.3.3.jar,C:\Users\andy\.m2\repository\com\google\zxing\core\3.3.3\core-3.3.3.jar,C:\Users\andy\.m2\repository\com\beust\jcommander\1.72\jcommander-1.72.jar,C:\Users\andy\.m2\repository\org\jsoup\jsoup\1.10.3\jsoup-1.10.3.jar,C:\Users\andy\.m2\repository\com\github\stuxuhai\jpinyin\1.1.8\jpinyin-1.1.8.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-ooxml\4.1.2\poi-ooxml-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi\4.1.2\poi-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-math3\3.6.1\commons-math3-3.6.1.jar,C:\Users\andy\.m2\repository\com\zaxxer\SparseBitSet\1.2\SparseBitSet-1.2.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-ooxml-schemas\4.1.2\poi-ooxml-schemas-4.1.2.jar,C:\Users\andy\.m2\repository\org\apache\xmlbeans\xmlbeans\3.1.0\xmlbeans-3.1.0.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-compress\1.19\commons-compress-1.19.jar,C:\Users\andy\.m2\repository\com\github\virtuald\curvesapi\1.06\curvesapi-1.06.jar,C:\Users\andy\.m2\repository\org\apache\poi\poi-scratchpad\4.1.2\poi-scratchpad-4.1.2.jar,C:\Users\andy\.m2\repository\com\sun\mail\javax.mail\1.6.2\javax.mail-1.6.2.jar,C:\Users\andy\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar,C:\Users\andy\.m2\repository\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar,C:\Users\andy\.m2\repository\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar,C:\Users\andy\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar,C:\Users\andy\.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar,C:\Users\andy\.m2\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar,C:\Users\andy\.m2\repository\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar,C:\Users\andy\.m2\repository\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-configuration-processor\2.7.7\spring-boot-configuration-processor-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-websocket\2.7.7\spring-boot-starter-websocket-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\spring-websocket\5.3.24\spring-websocket-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter\2.7.7\spring-boot-starter-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot\2.7.7\spring-boot-2.7.7.jar,C:\Users\andy\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar,C:\Users\andy\.m2\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar,C:\Users\andy\.m2\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.7.7\spring-boot-starter-web-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.7.7\spring-boot-starter-json-2.7.7.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.4\jackson-datatype-jdk8-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.4\jackson-datatype-jsr310-2.13.4.jar,C:\Users\andy\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.4\jackson-module-parameter-names-2.13.4.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.7\spring-boot-starter-tomcat-2.7.7.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.70\tomcat-embed-core-9.0.70.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.70\tomcat-embed-el-9.0.70.jar,C:\Users\andy\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.70\tomcat-embed-websocket-9.0.70.jar,C:\Users\andy\.m2\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-freemarker\2.7.7\spring-boot-starter-freemarker-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.7.7\spring-boot-starter-data-redis-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-redis\2.7.6\spring-data-redis-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-keyvalue\2.7.6\spring-data-keyvalue-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\data\spring-data-commons\2.7.6\spring-data-commons-2.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\spring-oxm\5.3.24\spring-oxm-5.3.24.jar,C:\Users\andy\.m2\repository\io\lettuce\lettuce-core\6.1.10.RELEASE\lettuce-core-6.1.10.RELEASE.jar,C:\Users\andy\.m2\repository\io\netty\netty-common\4.1.86.Final\netty-common-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-handler\4.1.86.Final\netty-handler-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-resolver\4.1.86.Final\netty-resolver-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-buffer\4.1.86.Final\netty-buffer-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.86.Final\netty-transport-native-unix-common-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-codec\4.1.86.Final\netty-codec-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\netty\netty-transport\4.1.86.Final\netty-transport-4.1.86.Final.jar,C:\Users\andy\.m2\repository\io\projectreactor\reactor-core\3.4.26\reactor-core-3.4.26.jar,C:\Users\andy\.m2\repository\org\reactivestreams\reactive-streams\1.0.4\reactive-streams-1.0.4.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-quartz\2.7.7\spring-boot-starter-quartz-2.7.7.jar,C:\Users\andy\.m2\repository\org\springframework\spring-tx\5.3.24\spring-tx-5.3.24.jar,C:\Users\andy\.m2\repository\org\quartz-scheduler\quartz\2.3.2\quartz-2.3.2.jar,C:\Users\andy\.m2\repository\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar,C:\Users\andy\.m2\repository\org\springframework\boot\spring-boot-starter-log4j2\2.7.7\spring-boot-starter-log4j2-2.7.7.jar,C:\Users\andy\.m2\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar,C:\Users\andy\.m2\repository\org\springframework\spring-messaging\5.3.24\spring-messaging-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\security\spring-security-core\5.7.6\spring-security-core-5.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\security\spring-security-crypto\5.7.6\spring-security-crypto-5.7.6.jar,C:\Users\andy\.m2\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar,C:\Users\andy\.m2\repository\org\springframework\spring-context-support\5.3.24\spring-context-support-5.3.24.jar,C:\Users\andy\.m2\repository\junit\junit\4.13.2\junit-4.13.2.jar,C:\Users\andy\.m2\repository\org\hamcrest\hamcrest-core\2.2\hamcrest-core-2.2.jar,C:\Users\andy\.m2\repository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-core\4.5.1\mockito-core-4.5.1.jar,C:\Users\andy\.m2\repository\net\bytebuddy\byte-buddy\1.12.20\byte-buddy-1.12.20.jar,C:\Users\andy\.m2\repository\net\bytebuddy\byte-buddy-agent\1.12.20\byte-buddy-agent-1.12.20.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-junit-jupiter\4.5.1\mockito-junit-jupiter-4.5.1.jar,C:\Users\andy\.m2\repository\org\mockito\mockito-inline\4.5.1\mockito-inline-4.5.1.jar,C:\Users\andy\.m2\repository\org\lionsoul\ip2region\1.7.2\ip2region-1.7.2.jar,C:\Users\andy\.m2\repository\org\apache\commons\commons-text\1.9\commons-text-1.9.jar,C:\Users\andy\.m2\repository\org\apache\tika\tika-core\2.4.1\tika-core-2.4.1.jar,C:\Users\andy\.m2\repository\org\apache\httpcomponents\httpclient\4.5.14\httpclient-4.5.14.jar,C:\Users\andy\.m2\repository\org\apache\httpcomponents\httpcore\4.4.16\httpcore-4.4.16.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-basic\2.1.19\ms-basic-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\ms-mdiy\2.1.19\ms-mdiy-2.1.19.jar,C:\Users\andy\.m2\repository\net\mingsoft\store-client\2.1.19.2\store-client-2.1.19.2.jar,C:\Users\andy\.m2\repository\org\apache\ant\ant\1.10.5\ant-1.10.5.jar,C:\Users\andy\.m2\repository\org\apache\ant\ant-launcher\1.10.5\ant-launcher-1.10.5.jar,C:\Users\andy\.m2\repository\com\github\oshi\oshi-core\6.2.2\oshi-core-6.2.2.jar,C:\Users\andy\.m2\repository\net\java\dev\jna\jna\5.12.1\jna-5.12.1.jar,C:\Users\andy\.m2\repository\net\java\dev\jna\jna-platform\5.12.1\jna-platform-5.12.1.jar,C:\Users\andy\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-core\2.20.0\log4j-core-2.20.0.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-slf4j-impl\2.20.0\log4j-slf4j-impl-2.20.0.jar,C:\Users\andy\.m2\repository\org\apache\logging\log4j\log4j-api\2.20.0\log4j-api-2.20.0.jar,.][共 896 毫秒]致命错误: 在类路径或引导类路径中找不到程序包 java.lang[INFO] -------------------------------------------------------------
复制代码



看了一下 pom.xml 文件中 maven-compiler-plugin 插件的配置,应该是没有什么问题的,而且还是比较正确的配置方式了。


那么,既然报错说,找不到 java.lang,进一步思考,难道是“${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar”这个内容读取不到正确类吗?


很显然,${java.home} 是从指定的 java 版本默认去读的,那么,只有一种可能性,是这个版本有问题,导致,知道不到 java.lang。


接着,继续去找 {java.version} 的配置,看看具体是什么内容。



接着可以看到 pom.xml 文件里,java.version 的版本是 1.8。思考了一下,本地虽然用的是 java 11,但是,也是有 java 1.8 的。


再看下日志,其中一段说的是“类文件的搜索路径: C:\Program Files\Java\jdk-11.0.9\lib\rt.jar”,也就是说,打包找的是 java 11 的,而不是 java 1.8 的。


那么,极有可能就是这里不对,才导致的问题。


3)问题解决


分析问题的原因,在项目结构 Project Structure 中更改了一下项目的 SDK 为 1.8。



重新打包,结果成功了。



三、启发


这个排查错误的过程,也是一个思考逻辑判断的过程。


经过这么一个问题分析解决之后,有一个感触,就是如果不知道如何下手,那就按照程序的逻辑,一点点从上一直往下去找原因,最终一定能够找到那个根本原因的。


毕竟,程序都是顺序执行的,不可能能够跳过某个环节去到下一个步骤的。


用户头像

Andy

关注

强准备+强信念+强执行 2019-11-21 加入

以前是T型人才,当下是π型人才,未来是梳子型人才

评论

发布
暂无评论
Java 致命错误: 在类路径或引导类路径中找不到程序包 java.lang_Andy_InfoQ写作社区