You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "GeekDaniel (GitHub)" <gi...@apache.org> on 2019/04/10 03:37:20 UTC

[GitHub] [incubator-dubbo] GeekDaniel opened issue #3841: Try to add an element to Arrays.ArrayList in convertProtocolIdsToProtocols method.

### Environment

* Dubbo version: 2.7.0
* Java version: 8
* spring version :4.1.6.RELEASE
* dependency details you might concern :
`
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ demo ---
[INFO] com.surpass:demo:jar:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-jdbc:jar:4.1.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] +- com.github.sgroschupf:zkclient:jar:0.9:compile
[INFO] |  \- org.apache.zookeeper:zookeeper:jar:3.4.8:compile
[INFO] |     +- jline:jline:jar:0.9.94:compile
[INFO] |     \- io.netty:netty:jar:3.7.0.Final:compile
[INFO] +- org.apache.dubbo:dubbo:jar:2.7.0:compile
[INFO] |  +- io.netty:netty-all:jar:4.1.25.Final:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.7.Final:compile
[INFO] |  +- org.jboss.resteasy:jaxrs-api:jar:3.0.7.Final:compile
[INFO] |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] |  +- javax.activation:activation:jar:1.1:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.2.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.2.1:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] +- org.jboss.resteasy:resteasy-client:jar:3.0.7.Final:compile
[INFO] +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] |  \- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] +- junit:junit:jar:4.10:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- log4j:log4j:jar:1.2.16:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.4:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.4:compile
[INFO] +- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- com.sun:tools:jar:1.8:system
[INFO] +- commons-net:commons-net:jar:3.3:compile
[INFO] +- com.opencsv:opencsv:jar:4.0:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] |  +- org.apache.commons:commons-text:jar:1.1:compile
[INFO] |  \- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] |     \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- com.github.nintha:webp-imageio-core:jar:0.1.1:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] +- org.apache.curator:curator-framework:jar:4.0.0:compile
[INFO] +- org.apache.curator:curator-client:jar:4.0.0:compile
[INFO] |  \- com.google.guava:guava:jar:20.0:compile
[INFO] \- org.apache.curator:curator-recipes:jar:4.0.0:compile

`

reproduce demo address : https://github.com/GeekDaniel/issuedemo.git

### core config about dubbo
`<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://code.alibabatech.com/schema/dubbo
       http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
       <dubbo:application name="demo" />

       <!--zookeeper注册中心 -->
       <dubbo:registry protocol="zookeeper" address="127.0.0.1:2181"/>

        <!-- 用于心跳配置 -->
       <dubbo:protocol name="rest" port="20881" />
       <dubbo:service interface="com.surpass.service.HeartBeat" ref="heartBeatImpl" protocol="rest"/>

       <!-- 具体服务配置 -->
       <dubbo:protocol name="dubbo" port="20880"/>
       <dubbo:provider filter="DoNoneFilter" protocol="dubbo" />

       <dubbo:service interface="com.surpass.service.CounterService" ref="counterServiceImpl" version="1.0.0"/>

</beans>
`

### Expected Result

dubbo can do multi protocols service export

### Actual Result

multi protocols service export failed when use Filter.

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

`Exception in thread "main" java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:148)
	at java.util.AbstractList.add(AbstractList.java:108)
	at org.apache.dubbo.config.ServiceConfig.lambda$convertProtocolIdsToProtocols$4(ServiceConfig.java:839)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at org.apache.dubbo.config.ServiceConfig.convertProtocolIdsToProtocols(ServiceConfig.java:837)
	at org.apache.dubbo.config.ServiceConfig.checkProtocol(ServiceConfig.java:808)
	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:271)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:328)
	at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:318)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:112)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:58)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
	at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
	at com.surpass.exec.Server.main(Server.java:29)`



[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3841 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh commented on issue #3841: Try to add an element to Arrays.ArrayList in convertProtocolIdsToProtocols method.

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
We should avoid using `Arrays.asList`. It most like a unmodified list. So `add` operation will throw exception.

See `java.util.Arrays.ArrayList` for more details.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3841 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on issue #3841: Try to add an element to Arrays.ArrayList in convertProtocolIdsToProtocols method.

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
Thx for your issue.
It will be fixed at next release.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3841 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org