dubbo 常見錯誤

1. Caused by: java.lang.reflect.MalformedParameterizedTypeExceptionjava

啓動時報錯,緣由是dubbo 依賴 spring 2.5.6.SEC03,而我項目中有用spring 3.2.4.RELEASE,因此致使衝突。 在maven中把dubbo中的spring依賴去除就能夠了。spring

若是大家項目中也報這個錯,極可能也是由於jar包衝突形成的tomcat

		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>dubbo</artifactId>
			<exclusions>  
	            <exclusion>  
	                <artifactId>spring</artifactId>  
	                <groupId>org.springframework</groupId>  
	            </exclusion>  
            </exclusions>  
		</dependency>

2. Caused by: java.lang.IllegalStateException: Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higherapp

at org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
... 22 moremaven

錯誤緣由:http://stackoverflow.com/questions/23813369/spring-java-error-namespace-element-annotation-config-on-jdk-1-5-and-highspa

由於使用了 jdk1.8, 而dubbo 依賴 Spring 2.5 ,而Spring2.5僅僅支持 jdk1.5 到 jdk 1.7, 因此jdk 1.8 不被識別,因此報錯。.net

3. Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 46; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但沒法找到元素 'dubbo:application' 的聲明。code

該錯誤是由於沒有引入 dubbo jar包。加上依賴就好了:orm

		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>dubbo</artifactId>
                        <version>2.8.4</version>
	        </dependency>

4. Unsupported major.minor version 52.0 (unable to load classxml

出現該錯誤是因爲class編譯器的JDK版本高於運行期的JDK版本。

好比我在運行Tomcat servlet時出現該錯誤,是因爲tomcat運行時是1.7的JDK,Eclipse編譯時則是1.8

修改方法:保證編譯器和運行期的JDK版本一致。

 

 

5. cvc-complex-type.2.4.c

find dubbo.xsd in dubbo-master, copy to anthor directory.

Eclipse –> window –> Preferences –> XML –> XML Catalog

select User Specified Entries –> add

Location the dubbo.xsd path

Key type Schema location

Key http://code.alibabatech.com/schema/dubbo

 

then add other config

key http://code.alibabatech.com/schema/dubbo/dubbo.xsd

相關文章
相關標籤/搜索