Java published to the server jar package could not be found

for example, there is no problem for the project to run locally. Once deployed to the server, a class cannot find an error

root cause

        
java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Hex
com.mal.util.code.MD5Utils.md5Hex(MD5Utils.java:105)
com.mal.util.code.MD5Utils.verify(MD5Utils.java:95)
com.mal.service.impl.UserBaseServiceImpl.login(UserBaseServiceImpl.java:40)
com.mal.service.impl.UserBaseServiceImpl.login(UserBaseServiceImpl.java:51)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
com.sun.proxy.$Proxy22.login(Unknown Source)
com.alibaba.dubbo.common.bytecode.Wrapper2.invokeMethod(Wrapper2.java)
com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)
com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)
com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)
com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108)
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)
com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
    

clipboard.png
controller Hex.class.getProtectionDomain().getCodeSource().getLocation()
file:/usr/local/tomcat/tomcat8083/webapps/ROOT/WEB-INF/lib/commons-codec-1.9.jar
jar...

clipboard.png

I can also find it on the server"s folder when I search it. What happens when I do this?

Mar.29,2021

NoClassDefFoundError is different from ClassNotFoundException. NoClassDefFoundError means that the current ClassLoader cannot load this class, which is different from the fact that ClassNotFoundException physically does not have this file (whether it is .class or .class in jar), so it needs to be analyzed from the runtime. For example, whether ClassLoader loads this classpath. Whether there is a conflict and other directions to consider.


agree to go upstairs. By the way, according to personal experience, this situation is mostly caused by packet conflicts. It is recommended to check


= correct answer =
to find the correct service, to find jar packet conflicts caused by solrj. In addition: solrj may cause a lot of jar package conflicts, so you should pay attention to

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb2890-481a5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb2890-481a5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?