问题描述
----JAR所在的目录hadoop@hadoop-master:~$pwd/home/hadoophadoop@hadoop-master:~$lspiggybank.jarmysql-connector-java-5.1.24-bin.jarmysql-connector-java-5.1.24-bin.jarpiggybank.jar----脚本register'/home/hadoop/mysql-connector-java-5.1.24-bin.jar';register'/home/hadoop/piggybank.jar';alldata=load'/neuhospital/mysql/201508111230/kce1_test/part-m-00000'usingPigStorage('');insertdata=foreachalldatagenerate$6;storeinsertdatainto'test'USINGorg.apache.pig.piggybank.storage.DBStorage('com.mysql.jdbc.Driver','jdbc:mysql://192.168.162.231:3306/warehouse','hive','hive','insertintopatient_info_t(MedicalCareID)values(?)');----报错信息PigStackTrace---------------ERROR1200:Pigscriptfailedtoparse:<line4,column0>pigscriptfailedtovalidate:java.lang.RuntimeException:couldnotinstantiate'org.apache.pig.piggybank.storage.DBStorage'witharguments'[com.mysql.jdbc.Driver,jdbc:mysql://192.168.162.231:3306/warehouse,hive,hive,insertintopatient_info_t(MedicalCareID)values(?)]'Failedtoparse:Pigscriptfailedtoparse:<line4,column0>pigscriptfailedtovalidate:java.lang.RuntimeException:couldnotinstantiate'org.apache.pig.piggybank.storage.DBStorage'witharguments'[com.mysql.jdbc.Driver,jdbc:mysql://192.168.162.231:3306/warehouse,hive,hive,insertintopatient_info_t(MedicalCareID)values(?)]'atorg.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:199)atorg.apache.pig.PigServer$Graph.validateQuery(PigServer.java:1707)atorg.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1680)atorg.apache.pig.PigServer.registerQuery(PigServer.java:623)atorg.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:1082)atorg.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:505)atorg.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:230)atorg.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)atorg.apache.pig.tools.grunt.Grunt.run(Grunt.java:66)atorg.apache.pig.Main.run(Main.java:565)atorg.apache.pig.Main.main(Main.java:177)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:606)atorg.apache.hadoop.util.RunJar.run(RunJar.java:221)atorg.apache.hadoop.util.RunJar.main(RunJar.java:136)Causedby:<line4,column0>pigscriptfailedtovalidate:java.lang.RuntimeException:couldnotinstantiate'org.apache.pig.piggybank.storage.DBStorage'witharguments'[com.mysql.jdbc.Driver,jdbc:mysql://192.168.162.231:3306/warehouse,hive,hive,insertintopatient_info_t(MedicalCareID)values(?)]'atorg.apache.pig.parser.LogicalPlanBuilder.buildStoreOp(LogicalPlanBuilder.java:1009)atorg.apache.pig.parser.LogicalPlanGenerator.store_clause(LogicalPlanGenerator.java:7806)atorg.apache.pig.parser.LogicalPlanGenerator.op_clause(LogicalPlanGenerator.java:1669)atorg.apache.pig.parser.LogicalPlanGenerator.general_statement(LogicalPlanGenerator.java:1102)atorg.apache.pig.parser.LogicalPlanGenerator.statement(LogicalPlanGenerator.java:560)atorg.apache.pig.parser.LogicalPlanGenerator.query(LogicalPlanGenerator.java:421)atorg.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:191)...16moreCausedby:java.lang.RuntimeException:couldnotinstantiate'org.apache.pig.piggybank.storage.DBStorage'witharguments'[com.mysql.jdbc.Driver,jdbc:mysql://192.168.162.231:3306/warehouse,hive,hive,insertintopatient_info_t(MedicalCareID)values(?)]'atorg.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:772)atorg.apache.pig.parser.LogicalPlanBuilder.buildStoreOp(LogicalPlanBuilder.java:988)...22moreCausedby:java.lang.reflect.InvocationTargetExceptionatsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)atsun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)atjava.lang.reflect.Constructor.newInstance(Constructor.java:526)atorg.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:740)...23moreCausedby:java.lang.RuntimeException:Can'tloadDBDriveratorg.apache.pig.piggybank.storage.DBStorage.<init>(DBStorage.java:82)atorg.apache.pig.piggybank.storage.DBStorage.<init>(DBStorage.java:71)...28moreCausedby:java.lang.ClassNotFoundException:com.mysql.jdbc.Driveratjava.net.URLClassLoader$1.run(URLClassLoader.java:366)atjava.net.URLClassLoader$1.run(URLClassLoader.java:355)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.net.URLClassLoader.findClass(URLClassLoader.java:354)atjava.lang.ClassLoader.loadClass(ClassLoader.java:425)atsun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)atjava.lang.ClassLoader.loadClass(ClassLoader.java:358)atjava.lang.Class.forName0(NativeMethod)atjava.lang.Class.forName(Class.java:191)atorg.apache.pig.piggybank.storage.DBStorage.<init>(DBStorage.java:79)...29more