NutzCN Logo
问答 nutzMvc项目使用jdk17启动出现问题
发布于 942天前 作者 huodong 1394 次浏览 复制 上一个帖子 下一个帖子
标签:

问题背景:我这边打算用nutz代替springboot重构项目,要求jdk统一使用17.0.1。
问题描述:nutzMvc项目使用jdk1.8可以正常启动,更换为jdk17提示找不到MainModule

-----------------------------------------------控制台报错信息---------------------------------------------------

D:\Tools\java\jdk-17.0.1\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\nutz_workspace\nutzDemo -Dmaven.home=D:\Tools\Maven\apache-maven-3.8.5 -Dclassworlds.conf=D:\Tools\Maven\apache-maven-3.8.5\bin\m2.conf "-Dmaven.ext.class.path=D:\Tools\IDEA\IntelliJ IDEA 2021.3.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\Tools\IDEA\IntelliJ IDEA 2021.3.3\lib\idea_rt.jar=9211:D:\Tools\IDEA\IntelliJ IDEA 2021.3.3\bin" -Dfile.encoding=UTF-8 -classpath D:\Tools\Maven\apache-maven-3.8.5\boot\plexus-classworlds-2.6.0.jar;D:\Tools\Maven\apache-maven-3.8.5\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2021.3.3 -s D:\nutz_workspace\maven_nutz\settings\settings.xml -Dmaven.repo.local=D:\nutz_workspace\maven_nutz\repository org.eclipse.jetty:jetty-maven-plugin:9.4.3.v20170317:run
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< org.nutz:nutzDemo >--------------------------
[INFO] Building nutzDemo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:9.4.3.v20170317:run (default-cli) > test-compile @ nutzDemo >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ nutzDemo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ nutzDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ nutzDemo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\nutz_workspace\nutzDemo\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ nutzDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< jetty-maven-plugin:9.4.3.v20170317:run (default-cli) < test-compile @ nutzDemo <<<
[INFO] 
[INFO] 
[INFO] --- jetty-maven-plugin:9.4.3.v20170317:run (default-cli) @ nutzDemo ---
[INFO] Logging initialized @2958ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] Configuring Jetty for project: nutzDemo
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\nutz_workspace\nutzDemo\target\classes
[INFO] Context path = /
[INFO] Tmp directory = D:\nutz_workspace\nutzDemo\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:///D:/nutz_workspace/nutzDemo/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\nutz_workspace\nutzDemo\src\main\webapp
[INFO] jetty-9.4.3.v20170317
[INFO] Scanning elapsed time=284ms
[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@44cffc25{/,file:///D:/nutz_workspace/nutzDemo/src/main/webapp/,UNAVAILABLE}{file:///D:/nutz_workspace/nutzDemo/src/main/webapp/}
java.lang.RuntimeException: Error scanning file MainModule.class
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:712)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parse (AnnotationParser.java:830)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call (AnnotationConfiguration.java:159)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run (AnnotationConfiguration.java:464)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
    at java.lang.Thread.run (Thread.java:833)
Caused by: java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.objectweb.asm.ClassReader.<init> (Unknown Source)
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass (AnnotationParser.java:959)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:705)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parseDir (AnnotationParser.java:689)
    at org.eclipse.jetty.annotations.AnnotationParser.parse (AnnotationParser.java:830)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call (AnnotationConfiguration.java:159)
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run (AnnotationConfiguration.java:464)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
    at java.lang.Thread.run (Thread.java:833)
[INFO] Started ServerConnector@3c91530d{HTTP/1.1,[http/1.1]}{0.0.0.0:8083}
[INFO] Started @3893ms
[INFO] Started Jetty Server

-----------------------------------------------控制台报错信息---------------------------------------------------

-----------------------------------------------pom.xml---------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4.0.0
org.nutz
nutzDemo
1.0-SNAPSHOT

<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
</properties>


<dependencies>
    <dependency>
        <groupId>org.nutz</groupId>
        <artifactId>nutz</artifactId>
        <version>1.r.60</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>

</dependencies>
<build>
    <finalName>nuzDemo</finalName>
    <plugins>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.3.v20170317</version>
            <configuration>
                <httpConnector>
                    <port>8083</port>
                </httpConnector>
            </configuration>
        </plugin>
    </plugins>
</build>


-----------------------------------------------pom.xml---------------------------------------------------

求大神指点,非常感谢。

1 回复

看来asm版本低,导致jetty挂了

添加回复
请先登陆
回到顶部