apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.51k stars 26.43k forks source link

java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException #12242

Closed Heiffeng closed 10 months ago

Heiffeng commented 1 year ago

Environment

启动项目没有问题,但触发请求后,开始报错。在java17中应该用jakarta.validation代替javax.validation包对吗? 麻烦问下应该怎么解决

If there is an exception, please attach the exception trace:

2023-05-06T10:04:39.283Z ERROR 97901 --- [DubboServerHandler-192.168.100.109:25802-thread-4] o.a.dubbo.rpc.filter.ExceptionFilter     :  [DUBBO] Got unchecked and undeclared exception which called by 192.168.100.109. service: site.achun.file.api.modules.file.FileRemoveFacade, method: removeFile, exception: java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException, dubbo version: 3.2.0, current host: 192.168.100.109, error code: 5-36. This may be caused by , go to https://dubbo.apache.org/faq/5/36 to find instructions.

java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException
        at org.apache.dubbo.validation.support.jvalidation.JValidation.createValidator(JValidation.java:37) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.validation.support.AbstractValidation.getValidator(AbstractValidation.java:43) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.validation.Validation$Adaptive.getValidator(Validation$Adaptive.java) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.validation.filter.ValidationFilter.invoke(ValidationFilter.java:88) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:79) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:44) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:101) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:54) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.AccessLogFilter.invoke(AccessLogFilter.java:118) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.metrics.observation.ObservationReceiverFilter.invoke(ObservationReceiverFilter.java:56) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.metrics.filter.MetricsFilter.invoke(MetricsFilter.java:51) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:192) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:54) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.ProfilerServerFilter.invoke(ProfilerServerFilter.java:64) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:144) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:331) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CallbackRegistrationInvoker.invoke(FilterChainBuilder.java:194) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:155) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:103) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:186) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:53) ~[dubbo-3.2.0.jar!/:3.2.0]
        at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:62) ~[dubbo-3.2.0.jar!/:3.2.0]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
        at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41) ~[dubbo-3.2.0.jar!/:3.2.0]
        at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: java.lang.ClassNotFoundException: javax.validation.ConstraintViolationException
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[achun-file-app.jar:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
        ... 39 common frames omitted
liudaac commented 1 year ago

貌似Java9之后就迁到Jakarta下了

songxiaosheng commented 1 year ago

jdk升级以后移除了很多类型,不能改代码就手动引入兼容的包临时用