NutzCN Logo
问答 nutz-boot jetty 集成websocket启动报错
发布于 1717天前 作者 LjieJJJJJJJ 1610 次浏览 复制 上一个帖子 下一个帖子
标签:

提示缺少 java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer


[DEBUG] 15:57:22.979 org.nutz.resource.Scans.printLocations(Scans.java:527) - Locations count=89 time use 126ms [DEBUG] 15:57:23.002 org.nutz.resource.Scans.scan(Scans.java:280) - Found 1 resource by src( custom/ ) , regex( ^.+[.]properties$ ) [DEBUG] 15:57:23.003 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:106) - load properties from jar:file:/C:/Users/LIuJie/.m2/repository/org/nutz/nutzboot-core/2.3.9.v20200309/nutzboot-core-2.3.9.v20200309.jar!/custom/emtry.properties [DEBUG] 15:57:23.007 org.nutz.boot.config.impl.PropertiesConfigureLoader.init(PropertiesConfigureLoader.java:38) - load D:\ideaSpace\hfits\target\classes\application.properties [DEBUG] 15:57:23.156 org.nutz.resource.Scans.scan(Scans.java:280) - Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ ) [DEBUG] 15:57:23.156 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) - loading [emtry.json] [DEBUG] 15:57:23.158 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:57) - Loaded 0 bean define from path=[ioc/] --> [] [DEBUG] 15:57:23.339 org.nutz.castor.Castors.reload(Castors.java:116) - Using 107 castor for Castors [DEBUG] 15:57:23.397 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) - Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader [INFO ] 15:57:23.412 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:51) - > scan 'io.hfits' [DEBUG] 15:57:23.420 org.nutz.resource.Scans.scan(Scans.java:280) - Found 4 resource by src( io/hfits/ ) , regex( ^.+[.]class$ ) [INFO ] 15:57:23.440 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) - > add 'mainLauncher ' - io.hfits.MainLauncher [INFO ] 15:57:23.482 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) - > add 'timeModule ' - io.hfits.module.TimeModule [INFO ] 15:57:23.500 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) - > add 'hfits_WebSoketController ' - io.hfits.module.websocket.Hfits_WebSoketController [INFO ] 15:57:23.505 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:51) - > scan 'org.nutz.boot.starter' [DEBUG] 15:57:23.511 org.nutz.resource.Scans.scan(Scans.java:280) - Found 14 resource by src( org/nutz/boot/starter/ ) , regex( ^.+[.]class$ ) [INFO ] 15:57:23.567 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) - > add 'swaggerServletStarter ' - org.nutz.boot.starter.swagger.SwaggerServletStarter [DEBUG] 15:57:23.575 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:280) - Found @IocBean method : SwaggerServletStarter.createSwagger(...) define as name=swagger [DEBUG] 15:57:23.576 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:280) - Found @IocBean method : SwaggerServletStarter.createSwaggerInfo(...) define as name=swaggerInfo [INFO ] 15:57:23.578 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) - > add 'jettyStarter ' - org.nutz.boot.starter.jetty.JettyStarter [ERROR] 15:57:23.622 org.nutz.boot.NbApp.execute(NbApp.java:224) - something happen!! java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) at org.nutz.lang.Mirror._getFields(Mirror.java:574) at org.nutz.lang.Mirror.getFields(Mirror.java:537) at org.nutz.lang.Mirror.getFields(Mirror.java:523) at org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:136) at org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:53) at org.nutz.boot.NbApp.prepareIocLoader(NbApp.java:421) at org.nutz.boot.NbApp.prepare(NbApp.java:289) at org.nutz.boot.NbApp.execute(NbApp.java:201) at org.nutz.boot.NbApp.run(NbApp.java:182) at io.hfits.MainLauncher.main(MainLauncher.java:23) Caused by: java.lang.ClassNotFoundException: javax.websocket.server.ServerContainer at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 13 more Disconnected from the target VM, address: '127.0.0.1:62744', transport: 'socket'

pom.xml

 <properties>
        <nutzboot.version>2.3.9.v20200309</nutzboot.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.nutz</groupId>
                <artifactId>nutzboot-parent</artifactId>
                <version>${nutzboot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-swagger</artifactId>
        </dependency>
       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-jetty</artifactId>
        </dependency>
       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.websocket</groupId>
            <artifactId>javax.websocket-api</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz-plugins-websocket</artifactId>
            <version>1.r.62</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>nutz</id>
            <url>http://jfrog.nutz.cn/artifactory/libs-release</url>
        </repository>
        <repository>
            <id>nutz-snapshots</id>
            <url>http://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>nutz-snapshots</id>
            <url>http://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.nutz.boot</groupId>
                <artifactId>nutzboot-maven-plugin</artifactId>
                <version>${nutzboot.version}</version>
            </plugin>
        </plugins>
    </build>
3 回复

jetty/tomcat/undertow的starter已经全部自带nutz-plugins-websocket, 不要自己添加!!

javax.websocket 也删掉

好的 可以了 感谢!!!

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