incubator-gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yumeng <yumeng11...@gmail.com>
Subject A bug when the method Class.getCanonicalName() is used in org.apache.gora.util.IOUtils.java
Date Thu, 04 Nov 2010 12:27:41 GMT
Hi all:
   I have run some test in Gora-core, but I get some exceptions as belows:

10/11/04 20:19:15 WARN mapred.JobClient: No job jar file set.  User
classes may not be found. See JobConf(Class) or
JobConf#setJar(String).
Exception in thread "main" java.lang.RuntimeException:
java.io.IOException: java.lang.ClassNotFoundException:
org.apache.gora.memory.store.MemStore.MemQuery
	at org.apache.gora.mapreduce.GoraInputFormat.setConf(GoraInputFormat.java:109)
	at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
	at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
	at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:882)
	at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:779)
	at org.apache.hadoop.mapreduce.Job.submit(Job.java:432)
	at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:447)
	at org.apache.gora.examples.mapreduce.WordCount.wordCount(WordCount.java:142)
	at org.apache.gora.examples.mapreduce.WordCount.run(WordCount.java:166)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
	at org.apache.gora.examples.mapreduce.WordCount.main(WordCount.java:175)
Caused by: java.io.IOException: java.lang.ClassNotFoundException:
org.apache.gora.memory.store.MemStore.MemQuery
	at org.apache.gora.util.IOUtils.loadFromConf(IOUtils.java:485)
	at org.apache.gora.mapreduce.GoraInputFormat.getQuery(GoraInputFormat.java:119)
	at org.apache.gora.mapreduce.GoraInputFormat.setConf(GoraInputFormat.java:106)
	... 11 more
Caused by: java.lang.ClassNotFoundException:
org.apache.gora.memory.store.MemStore.MemQuery
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.apache.gora.util.IOUtils.loadFromConf(IOUtils.java:482)
	... 13 more

================================
Obviously, Class.forName() can't find the Class:
org.apache.gora.memory.store.MemStore.MemQuery.    In fact, MemQuery
is a static inner Class in MemStore.  Its name should be
"org.apache.gora.memory.store.MemStore$MemQuery" ,  but not
"org.apache.gora.memory.store.MemStore.MemQuery".

When we invoke Class.forName(), we can get the result as
"org.apache.gora.memory.store.MemStore$MemQuery",while
Class.getCanonicalName() only return
"org.apache.gora.memory.store.MemStore.MemQuery".   Class.forName()
can only recognize the the result of Class.getName().  Do you will
change the code from getCanonicalName()  to getName()  in
org.apache.gora.util.IOUtils.java???  There are two places where
getCanonicalName() is used.

After I change all getCanonicalName()  to getName()  in
org.apache.gora.util.IOUtils.java, everything looks OK!

My JDK is 1.6.22.
Both in windows and in ubuntu, there exists this problem.

Mime
View raw message