<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: dubbo2.7.x GenericInvoke  dubbo2.5.x</li>
<li>Operating System version: all</li>
<li>Java version: 1.8/1.7</li>
</ul>
<p dir="auto">java serialization</p>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">Too simple , we can make any exception</p>
<p dir="auto">In this code</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="   if (result.hasException()
                        &amp;&amp; !(result.getException() instanceof GenericException)) {
                    return new RpcResult(new GenericException(result.getException()));
                }"><pre class="notranslate">   <span class="pl-k">if</span> (<span class="pl-s1">result</span>.<span class="pl-en">hasException</span>()
                        &amp;&amp; !(<span class="pl-s1">result</span>.<span class="pl-en">getException</span>() <span class="pl-k">instanceof</span> <span class="pl-smi">GenericException</span>)) {
                    <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">RpcResult</span>(<span class="pl-k">new</span> <span class="pl-smi">GenericException</span>(<span class="pl-s1">result</span>.<span class="pl-en">getException</span>()));
                }</pre></div>
<p dir="auto">We wrap all exceptions to GenericException.<br>
But dubbo 2.7.x rename package  to apache, so to make a new class like</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Deprecated
public class GenericException extends org.apache.dubbo.rpc.service.GenericException {

    public GenericException() {
    }

    public GenericException(String exceptionClass, String exceptionMessage) {
        super(exceptionClass, exceptionMessage);
    }

    public GenericException(Throwable cause) {
        super(cause);
    }
}"><pre class="notranslate"><code class="notranslate">@Deprecated
public class GenericException extends org.apache.dubbo.rpc.service.GenericException {

    public GenericException() {
    }

    public GenericException(String exceptionClass, String exceptionMessage) {
        super(exceptionClass, exceptionMessage);
    }

    public GenericException(Throwable cause) {
        super(cause);
    }
}
</code></pre></div>
<p dir="auto">No serialVersionUID is provided!</p>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">GenericException can be handled by consumer!</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: java.io.InvalidClassException: com.alibaba.dubbo.rpc.service.GenericException; local class incompatible: stream classdesc serialVersionUID = -1182299763306599962, local class serialVersionUID = -9195665492488780691
java.io.InvalidClassException: com.alibaba.dubbo.rpc.service.GenericException; local class incompatible: stream classdesc serialVersionUID = -1182299763306599962, local class serialVersionUID = -9195665492488780691
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1843)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2000)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
        at org.apache.dubbo.common.serialize.java.JavaObjectInput.readObject(JavaObjectInput.java:75)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.handleException(DecodeableRpcResult.java:144)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:86)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:112)
        at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:92)
        at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:122)
        at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:82)
        at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:48)
        at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:90)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)"><pre class="notranslate"><code class="notranslate">Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.RemotingException: java.io.InvalidClassException: com.alibaba.dubbo.rpc.service.GenericException; local class incompatible: stream classdesc serialVersionUID = -1182299763306599962, local class serialVersionUID = -9195665492488780691
java.io.InvalidClassException: com.alibaba.dubbo.rpc.service.GenericException; local class incompatible: stream classdesc serialVersionUID = -1182299763306599962, local class serialVersionUID = -9195665492488780691
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1843)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2000)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
        at org.apache.dubbo.common.serialize.java.JavaObjectInput.readObject(JavaObjectInput.java:75)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.handleException(DecodeableRpcResult.java:144)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:86)
        at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:112)
        at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:92)
        at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:122)
        at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:82)
        at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:48)
        at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:90)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.2-SNAPSHOT</li>
<li>Operating System version: xxx</li>
<li>Java version: xxx</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">�the override rule logic is different between Provider and Consumer.</p>
<p dir="auto">Provider check ProviderConfigurationListener and then the ServiceConfigurationListener,</p>
<p dir="auto">Consumer check ConsumerConfigurationListener and then the ReferenceConfigurationListener</p>
<p dir="auto">i think we should keep them consistent and ServiceConfigurationListener should override ProviderConfigurationListener.</p>
<p dir="auto">provider:<br>
org.apache.dubbo.registry.integration.RegistryProtocol.OverrideListener#doOverrideIfNecessary</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public synchronized void doOverrideIfNecessary() {
            final Invoker&lt;?&gt; invoker;
            if (originInvoker instanceof InvokerDelegate) {
                invoker = ((InvokerDelegate&lt;?&gt;) originInvoker).getInvoker();
            } else {
                invoker = originInvoker;
            }
            //The origin invoker
            URL originUrl = RegistryProtocol.this.getProviderUrl(invoker);
            String key = getCacheKey(originInvoker);
            ExporterChangeableWrapper&lt;?&gt; exporter = bounds.get(key);
            if (exporter == null) {
                logger.warn(new IllegalStateException(&quot;error state, exporter should not be null&quot;));
                return;
            }
            //The current, may have been merged many times
            URL currentUrl = exporter.getInvoker().getUrl();
            //Merged with this configuration
            URL newUrl = getConfigedInvokerUrl(configurators, originUrl);
            newUrl = getConfigedInvokerUrl(serviceConfigurationListeners.get(originUrl.getServiceKey())
                    .getConfigurators(), newUrl);
            newUrl = getConfigedInvokerUrl(providerConfigurationListener.getConfigurators(), newUrl);
            if (!currentUrl.equals(newUrl)) {
                RegistryProtocol.this.reExport(originInvoker, newUrl);
                logger.info(&quot;exported provider url changed, origin url: &quot; + originUrl +
                        &quot;, old export url: &quot; + currentUrl + &quot;, new export url: &quot; + newUrl);
            }
        }"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-k">synchronized</span> <span class="pl-smi">void</span> <span class="pl-s1">doOverrideIfNecessary</span>() {
            <span class="pl-k">final</span> <span class="pl-smi">Invoker</span>&lt;?&gt; <span class="pl-s1">invoker</span>;
            <span class="pl-k">if</span> (<span class="pl-s1">originInvoker</span> <span class="pl-k">instanceof</span> <span class="pl-smi">InvokerDelegate</span>) {
                <span class="pl-s1">invoker</span> = ((<span class="pl-smi">InvokerDelegate</span>&lt;?&gt;) <span class="pl-s1">originInvoker</span>).<span class="pl-en">getInvoker</span>();
            } <span class="pl-k">else</span> {
                <span class="pl-s1">invoker</span> = <span class="pl-s1">originInvoker</span>;
            }
            <span class="pl-c">//The origin invoker</span>
            <span class="pl-smi">URL</span> <span class="pl-s1">originUrl</span> = <span class="pl-smi">RegistryProtocol</span>.<span class="pl-smi">this</span>.<span class="pl-en">getProviderUrl</span>(<span class="pl-s1">invoker</span>);
            <span class="pl-smi">String</span> <span class="pl-s1">key</span> = <span class="pl-en">getCacheKey</span>(<span class="pl-s1">originInvoker</span>);
            <span class="pl-smi">ExporterChangeableWrapper</span>&lt;?&gt; <span class="pl-s1">exporter</span> = <span class="pl-s1">bounds</span>.<span class="pl-en">get</span>(<span class="pl-s1">key</span>);
            <span class="pl-k">if</span> (<span class="pl-s1">exporter</span> == <span class="pl-c1">null</span>) {
                <span class="pl-s1">logger</span>.<span class="pl-en">warn</span>(<span class="pl-k">new</span> <span class="pl-smi">IllegalStateException</span>(<span class="pl-s">"error state, exporter should not be null"</span>));
                <span class="pl-k">return</span>;
            }
            <span class="pl-c">//The current, may have been merged many times</span>
            <span class="pl-smi">URL</span> <span class="pl-s1">currentUrl</span> = <span class="pl-s1">exporter</span>.<span class="pl-en">getInvoker</span>().<span class="pl-en">getUrl</span>();
            <span class="pl-c">//Merged with this configuration</span>
            <span class="pl-smi">URL</span> <span class="pl-s1">newUrl</span> = <span class="pl-en">getConfigedInvokerUrl</span>(<span class="pl-s1">configurators</span>, <span class="pl-s1">originUrl</span>);
            <span class="pl-s1">newUrl</span> = <span class="pl-en">getConfigedInvokerUrl</span>(<span class="pl-s1">serviceConfigurationListeners</span>.<span class="pl-en">get</span>(<span class="pl-s1">originUrl</span>.<span class="pl-en">getServiceKey</span>())
                    .<span class="pl-en">getConfigurators</span>(), <span class="pl-s1">newUrl</span>);
            <span class="pl-s1">newUrl</span> = <span class="pl-en">getConfigedInvokerUrl</span>(<span class="pl-s1">providerConfigurationListener</span>.<span class="pl-en">getConfigurators</span>(), <span class="pl-s1">newUrl</span>);
            <span class="pl-k">if</span> (!<span class="pl-s1">currentUrl</span>.<span class="pl-en">equals</span>(<span class="pl-s1">newUrl</span>)) {
                <span class="pl-smi">RegistryProtocol</span>.<span class="pl-smi">this</span>.<span class="pl-en">reExport</span>(<span class="pl-s1">originInvoker</span>, <span class="pl-s1">newUrl</span>);
                <span class="pl-s1">logger</span>.<span class="pl-en">info</span>(<span class="pl-s">"exported provider url changed, origin url: "</span> + <span class="pl-s1">originUrl</span> +
                        <span class="pl-s">", old export url: "</span> + <span class="pl-s1">currentUrl</span> + <span class="pl-s">", new export url: "</span> + <span class="pl-s1">newUrl</span>);
            }
        }</pre></div>
<p dir="auto">consumer:<br>
org.apache.dubbo.registry.integration.RegistryDirectory#overrideWithConfigurator</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private URL overrideWithConfigurator(URL providerUrl) {
        // override url with configurator from &quot;override://&quot; URL for dubbo 2.6 and before
        providerUrl = overrideWithConfigurators(this.configurators, providerUrl);

        // override url with configurator from configurator from &quot;app-name.configurators&quot;
        providerUrl = overrideWithConfigurators(CONSUMER_CONFIGURATION_LISTENER.getConfigurators(), providerUrl);

        // override url with configurator from configurators from &quot;service-name.configurators&quot;
        if (serviceConfigurationListener != null) {
            providerUrl = overrideWithConfigurators(serviceConfigurationListener.getConfigurators(), providerUrl);
        }

        return providerUrl;
    }"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-smi">URL</span> <span class="pl-s1">overrideWithConfigurator</span>(<span class="pl-smi">URL</span> <span class="pl-s1">providerUrl</span>) {
        <span class="pl-c">// override url with configurator from "override://" URL for dubbo 2.6 and before</span>
        <span class="pl-s1">providerUrl</span> = <span class="pl-en">overrideWithConfigurators</span>(<span class="pl-smi">this</span>.<span class="pl-s1">configurators</span>, <span class="pl-s1">providerUrl</span>);

        <span class="pl-c">// override url with configurator from configurator from "app-name.configurators"</span>
        <span class="pl-s1">providerUrl</span> = <span class="pl-en">overrideWithConfigurators</span>(<span class="pl-smi">CONSUMER_CONFIGURATION_LISTENER</span>.<span class="pl-en">getConfigurators</span>(), <span class="pl-s1">providerUrl</span>);

        <span class="pl-c">// override url with configurator from configurators from "service-name.configurators"</span>
        <span class="pl-k">if</span> (<span class="pl-s1">serviceConfigurationListener</span> != <span class="pl-c1">null</span>) {
            <span class="pl-s1">providerUrl</span> = <span class="pl-en">overrideWithConfigurators</span>(<span class="pl-s1">serviceConfigurationListener</span>.<span class="pl-en">getConfigurators</span>(), <span class="pl-s1">providerUrl</span>);
        }

        <span class="pl-k">return</span> <span class="pl-s1">providerUrl</span>;
    }</pre></div>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>