org.apache.avro.specific.SpecificDatumReader$SchemaConstructable

java.lang.NoClassDefFoundError: org/apache/avro/specific/SpecificDatumReader$SchemaConstructable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at com.hcr.hadoop.avro.AvroMapRe.<clinit>(AvroMapRe.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.avro.specific.SpecificDatumReader$SchemaConstructable
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 13 more

Exception in thread "main"



今天写写avro的mapreduce的时候一直报错,但是发现其实这个类存在啊,调了半个小时,哎呀妈哎,竟然是版本冲突,之前用的是

<dependency>
			<groupId>org.apache.avro</groupId>
			<artifactId>avro</artifactId>
			<version>1.7.5</version>
		</dependency>

但是avro-mapred用的是1.52的

<dependency>
			<groupId>org.apache.avro</groupId>
			<artifactId>avro-mapred</artifactId>
			<version>1.5.2</version>
		</dependency>


1.75的SchemaConstructable 放到org.apache.avro.specific.SpecificData这个类下了,1.52的却是在org.apache.avro.specific.SpecificDatumReader这个类下

改成1.5.2运行通过

<dependency>
			<groupId>org.apache.avro</groupId>
			<artifactId>avro</artifactId>
			<version>1.5.2</version>
		</dependency>

太大意了.......




你可能感兴趣的:(apache)