研究dubbo2.6时,eclipse总报错:
cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only.
经查是因为配置文件有非法字符,有的是”看不见“的字符,需要换为其他字符集,才可以看到乱码字符。我这边的问题也是非法字符,但是多了一个">"符,报错的却是上一行,"<!-- current application configuration -->>"两个">"紧邻,很不容易发现。
原配置文件override-multi-protocol.xml内容如下:
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
">
<!-- current application configuration -->>
<dubbo:application name="demo-provider"/>
<!-- registry center configuration -->
<dubbo:registry address="N/A"/>
<!-- protocol configuration -->
<dubbo:protocol name="dubbo" port="20813"/>
<dubbo:protocol name="rmi" port="10913"/>
<dubbo:provider protocol="dubbo,rmi"/>
<!-- service configuration -->
<dubbo:service interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
<bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
</beans>
修改后的文件如下:
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
">
<!-- current application configuration -->
<dubbo:application name="demo-provider"/>
<!-- registry center configuration -->
<dubbo:registry address="N/A"/>
<!-- protocol configuration -->
<dubbo:protocol name="dubbo" port="20813"/>
<dubbo:protocol name="rmi" port="10913"/>
<dubbo:provider protocol="dubbo,rmi"/>
<!-- service configuration -->
<dubbo:service interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
<bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
</beans>
修改完override-multi-protocol.xml后,右键此文件,在弹出菜单点击[validate],Problems框下的错误提示消息