opensolon / solon

🔥 Java "ecological" application development Framework: Restrained, concise, EFFICIENT, OPEN, ECOLOGICAL!! 300% higher concurrency 50% memory savings Startup is 10 times faster. Packing 90% smaller; Compatible with java8 ~ java23. (Replaceable spring)
https://solon.noear.org
Apache License 2.0
2.29k stars 224 forks source link

BUG: java.lang.NoClassDefFoundError: org/noear/socketd/utils/Utils #230

Closed fuzi1996 closed 10 months ago

fuzi1996 commented 10 months ago

说明

graphql-solon-plugin插件在适配websocket时采用smarthttp,建立websocket连接时报错

错误信息:

java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/noear/socketd/utils/Utils
    at org.smartboot.http.server.impl.HttpMessageProcessor.process0(HttpMessageProcessor.java:81)
    at org.smartboot.http.server.impl.HttpMessageProcessor.process0(HttpMessageProcessor.java:42)
    at org.smartboot.socket.extension.processor.AbstractMessageProcessor.process(AbstractMessageProcessor.java:79)
    at org.smartboot.socket.transport.TcpAioSession.signalRead(TcpAioSession.java:308)
    at org.smartboot.socket.transport.TcpAioSession.readCompleted(TcpAioSession.java:280)
    at org.smartboot.socket.transport.TcpAioSession$1.completed(TcpAioSession.java:66)
    at org.smartboot.socket.transport.TcpAioSession$1.completed(TcpAioSession.java:62)
    at org.smartboot.socket.enhance.EnhanceAsynchronousServerChannel.doRead(EnhanceAsynchronousServerChannel.java:281)
    at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup.lambda$new$0(EnhanceAsynchronousChannelGroup.java:76)
    at org.smartboot.socket.enhance.EnhanceAsynchronousChannelGroup$Worker.run(EnhanceAsynchronousChannelGroup.java:208)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/noear/socketd/utils/Utils
    at org.noear.solon.net.websocket.HandshakeImpl.<init>(HandshakeImpl.java:26)
    at org.noear.solon.net.websocket.WebSocketBase.init(WebSocketBase.java:27)
    at org.noear.solon.boot.smarthttp.websocket.WebSocketImpl.<init>(WebSocketImpl.java:23)
    at org.noear.solon.boot.smarthttp.websocket.SmWebSocketHandleImpl.onHandShake(SmWebSocketHandleImpl.java:26)
    at org.smartboot.http.server.handler.WebSocketDefaultHandler.whenHeaderComplete(WebSocketDefaultHandler.java:33)
    at org.smartboot.http.server.WebSocketHandler.onHeaderComplete(WebSocketHandler.java:75)
    at org.smartboot.http.server.WebSocketHandler.onHeaderComplete(WebSocketHandler.java:34)
    at org.smartboot.http.server.impl.HttpMessageProcessor.doHttpHeader(HttpMessageProcessor.java:231)
    at org.smartboot.http.server.impl.HttpMessageProcessor.process0(HttpMessageProcessor.java:55)
    ... 12 more

pom中引入情况:

        <dependency>
            <groupId>org.noear</groupId>
            <artifactId>solon</artifactId>
        </dependency>

        <dependency>
            <groupId>org.noear</groupId>
            <artifactId>solon.boot.smarthttp</artifactId>
        </dependency>

排查

最终发现solon.net中对org.noear.socketd引入是provided的,为什么会这样?如果是必须的jar包,它的引入方式不应该是provided的,难道是为了减少最终包的体积?

noear commented 10 months ago

是的,为了减少体积:)。。。但是排除了,又不小心用了里面的工具类。才出了这个错。。。你可以引入这个包,就不出错了。

noear commented 10 months ago

谢谢反馈,这几天会发新版本。修复这个问题(真是个乌龙)

noear commented 10 months ago

2.6.4 已发。此问题已解