XSSFWorkbook Creation failure - apache

I am creating .xlsx file using poi jars which are poi-3.15.jar, poi-ooxml->3.15.jar, poi-ooxml-schemas-3.15.jar, ooxml-schemas-1.3.jar, xml-apis->2.0.2.jar, xbean-2.2.0, xmlschema-1.4.7.jar and commons-collections4-.4.0.jar.> But still im getting follwoing error.Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.collections4.ListValuedMap
can you please help me to create simple .xlsx file using >XSSFWorkbook class.

ListValuedMap is contained in this jar: commons-collections4. You should also use Xml Beans 2.3.0 or later.

Related

Flink 1.9 SQL Client throws ClassNotFoundException: org.apache.kafka.clients.consumer.ConsumerRecord

Trying to use Flink 1.9 SQL-Client with Kafka without success.
After figuring out about the required jar files and copying them into the lib directory, I am getting the following run-time exception when doing SELECT * FROM table-name:
Flink SQL> select * from default_catalog.default_database.member_customer_newsletters ;
[ERROR] Could not execute SQL statement. Reason:
java.lang.ClassNotFoundException: org.apache.kafka.clients.consumer.ConsumerRecord
Doing jar -tf of the jar-file, I can see the class ConsumerRecord being there:
jar -tf ./lib/flink-sql-connector-kafka-0.11_2.12-1.9.0.jar|grep 'ConsumerRecord'
org/apache/flink/kafka011/shaded/org/apache/kafka/clients/consumer/ConsumerRecord.class
So, I am not sure why it is trhowing a ClassNotFoundException as the class is already in the jar-file?
I just need to add the run-time is looking for "org.apache.kafka.clients.consumer.ConsumerRecord" but because this jar-file is shaded the full qualified name for the class is "org.apache.flink.kafka011.shaded.org.apache.kafka.clients.consumer.ConsumerRecord.class"
But, this should be true with any other class in this shaded jar as well!
There are two different classes:
org.apache.kafka.clients.consumer.ConsumerRecord
org.apache.flink.kafka011.shaded.org.apache.kafka.clients.consumer.ConsumerRecord
In flink-sql-connector-kafka-0.11_2.12-1.9.0.jar, you found the class
org.apache.flink.kafka011.shaded.org.apache.kafka.clients.consumer.ConsumerRecord
while Flink is complaining about:
org.apache.kafka.clients.consumer.ConsumerRecord
The first is a class used internally by Flink, after a kind of copy-paste from Kafka.
The second one is a class in kafka-clients-0.11.0.2.jar.
So Flink is right to complain about a missing library.

Exception thrown when registering custom serializers in Storm's storm.yaml

I registered a custom serializer for a class in Storm's conf/storm.yaml in the following way:
topology.kryo.register:
- custom.Car: custom.MyCarSerializer
When I started storm by typing "bin/storm nimbus", exceptions are thrown:
Exception in thread "main" expected '<document start>', but found BlockMappingStart
in 'reader', line 27, column 1:
topology.kryo.register:
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:424)
at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:121)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:161)
at backtype.storm.config$read_storm_config.invoke(config.clj:101)
at backtype.storm.command.config_value$_main.invoke(config_value.clj:7)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at backtype.storm.command.config_value.main(Unknown Source)
Exception in thread "main" expected '<document start>', but found BlockMappingStart
in 'reader', line 27, column 1:
topology.kryo.register:
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:108)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:424)
at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:121)
at backtype.storm.utils.Utils.readStormConfig(Utils.java:161)
at backtype.storm.config$read_storm_config.invoke(config.clj:101)
at backtype.storm.command.config_value$_main.invoke(config_value.clj:7)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at backtype.storm.command.config_value.main(Unknown Source)
Without these registrations that I added Storm can run normally, so I'm sure the exceptions are thrown because of the registrations I added in conf/storm.yaml, not any other configuration in conf/storm.yaml. I guess there may be some format errors and Storm could not parse conf/storm.yaml correctly. But I have examined the lines I added, for example, 1) there is no tab before "- custom.Car: custom.MyCarSerializer" and instead they are blank spaces; 2) there is a blank space following "- custom.Car:". But this can not solve the problem. Who has a similar problem and how did you solve it?
My storm's version is 0.9.0.1, and I run it in remote mode.
Definitely, your storm.yaml isn't a valid YAML file. As #user2720864 said, post your storm.yaml file.
Meanwhile, validate your YAML file using YAML Lint service.

load properties file from class path

I created a "AppProp.java" file to write 3 properties(dabase hostname,dbuser name,dbpassword) in "config.properties".I tried load properties file from classpath.but it gives error as following ....
**Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:434)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at App.main(App.java:18)**
Now,I want to know why it gives error?

apache.commons.configuration Unable to load the configuration from the URL

For a project I'm working on I need to change some property values at run time and save them. Looking for a solution I found the apache commons configuration.
I have looked at some others topics solving my first problems but now, an error that says:
org.apache.commons.configuration.ConfigurationException: Unable to load the configuration from the URL file:/C:/Users/sensor/Documents/NetBeansProjects/HermanWijn/dist/run1776677076/HermanWijn.jar!/Database/DataProptester.properties
Looking at this toppic: Property file not reflecting the modified changes using Apache Commons Configuration
My code should be working but for some reason I get an error.
The JDBCWijnDAO is a class in the same package as the properties file, Of course I want to do more than just load the prop file, but at the moment when creating the new propconfig, gives an error which I need to solve.
code:
URL resource = JDBCWijnDAO.class.getResource("DataProptester.properties");
PropertiesConfiguration config = new PropertiesConfiguration(resource.getPath());
Okay, i think i "know" what the problem is but I don't really know how to fix it, in the trace there is a:
Caused by: java.io.FileNotFoundException: C:\Users\Sensor\Documents\NetBeansProjects\HermanWijn\dist\run1776677076\HermanWijn.jar!\Database\DataProptester.properties (The system cannot find the path specified)
I assume there is something wrong with the total path.
errors:
org.apache.commons.configuration.ConfigurationException: Unable to load the configuration from the URL file:/C:/Users/Sander/Documents/NetBeansProjects/HermanWijn/dist/run1776677076/HermanWijn.jar!/Database/DataProptester.properties
at org.apache.commons.configuration.DefaultFileSystem.getInputStream(DefaultFileSystem.java:86)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:323)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:261)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:238)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:158)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:253)
at hermanwijn.knophandlers.DataBestandLocatieSelectieHandler.handle(DataBestandLocatieSelectieHandler.java:49)
at hermanwijn.knophandlers.DataBestandLocatieSelectieHandler.handle(DataBestandLocatieSelectieHandler.java:29)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Node.fireEvent(Node.java:6863)
at javafx.scene.control.Button.fire(Button.java:179)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3324)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
at com.sun.glass.ui.View.notifyMouse(View.java:922)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.FileNotFoundException: C:\Users\Sander\Documents\NetBeansProjects\HermanWijn\dist\run1776677076\HermanWijn.jar!\Database\DataProptester.properties (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1035)
at org.apache.commons.configuration.DefaultFileSystem.getInputStream(DefaultFileSystem.java:82)
Fixed, the problem was the package name was not included, it must be:
URL resource = JDBCWijnDAO.class.getResource("/Database/DataProptester.properties");

Error when run Hive-0.9.0 Exception in thread "main" java.lang.NoSuchFieldError: type

Really sorry for stupid question, but struggling to find answer. I am trying to start up Hive on my 3 node Hadoop cluster, HDFS runs OK as does PIG, Hbase but for the life of me I can not get Hive to run properly.
This is the classpath output >
:/home/hduser/hive-0.9.0/conf:/home/hduser/hive-0.9.0/lib/antlr-runtime-3.0.1.jar:/home/hduser/hive-0.9.0/lib/commons-cli-1.2.jar:/home/hduser/hive-0.9.0/lib/commons-codec-1.3.jar:/home/hduser/hive-0.9.0/lib/commons-collections-3.2.1.jar:/home/hduser/hive-0.9.0/lib/commons-dbcp-1.4.jar:/home/hduser/hive-0.9.0/lib/commons-lang-2.4.jar:/home/hduser/hive-0.9.0/lib/commons-logging-1.0.4.jar:/home/hduser/hive-0.9.0/lib/commons-logging-api-1.0.4.jar:/home/hduser/hive-0.9.0/lib/commons-pool-1.5.4.jar:/home/hduser/hive-0.9.0/lib/datanucleus-connectionpool-2.0.3.jar:/home/hduser/hive-0.9.0/lib/datanucleus-core-2.0.3.jar:/home/hduser/hive-0.9.0/lib/datanucleus-enhancer-2.0.3.jar:/home/hduser/hive-0.9.0/lib/datanucleus-rdbms-2.0.3.jar:/home/hduser/hive-0.9.0/lib/derby-10.4.2.0.jar:/home/hduser/hive-0.9.0/lib/guava-r09.jar:/home/hduser/hive-0.9.0/lib/hadoop-0.20.2-core.jar:/home/hduser/hive-0.9.0/lib/hbase-0.92.0.jar:/home/hduser/hive-0.9.0/lib/hbase-0.92.0-tests.jar:/home/hduser/hive-0.9.0/lib/hive-builtins-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-cli-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-common-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-contrib-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive_contrib.jar:/home/hduser/hive-0.9.0/lib/hive-exec-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-hbase-handler-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-hwi-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-jdbc-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-metastore-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-pdk-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-serde-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-service-0.9.0.jar:/home/hduser/hive-0.9.0/lib/hive-shims-0.9.0.jar:/home/hduser/hive-0.9.0/lib/jackson-core-asl-1.8.8.jar:/home/hduser/hive-0.9.0/lib/jackson-jaxrs-1.8.8.jar:/home/hduser/hive-0.9.0/lib/jackson-mapper-asl-1.8.8.jar:/home/hduser/hive-0.9.0/lib/jackson-xc-1.8.8.jar:/home/hduser/hive-0.9.0/lib/JavaEWAH-0.3.2.jar:/home/hduser/hive-0.9.0/lib/jdo2-api-2.3-ec.jar:/home/hduser/hive-0.9.0/lib/jline-0.9.94.jar:/home/hduser/hive-0.9.0/lib/json-20090211.jar:/home/hduser/hive-0.9.0/lib/libfb303-0.7.0.jar:/home/hduser/hive-0.9.0/lib/libfb303.jar:/home/hduser/hive-0.9.0/lib/libthrift-0.7.0.jar:/home/hduser/hive-0.9.0/lib/libthrift.jar:/home/hduser/hive-0.9.0/lib/log4j-1.2.16.jar:/home/hduser/hive-0.9.0/lib/slf4j-api-1.6.1.jar:/home/hduser/hive-0.9.0/lib/slf4j-log4j12-1.6.1.jar:/home/hduser/hive-0.9.0/lib/stringtemplate-3.1-b1.jar:/home/hduser/hive-0.9.0/lib/zookeeper-3.4.3.jar:
Logging initialized using configuration in file:/home/hduser/hive-0.9.0/conf/hive-log4j.properties
Hive history file=/tmp/hduser/hive_job_log_hduser_201212181716_326152902.txt
and then from HIVE command line I run this:
hive> CREATE TABLE pokes (foo INT, bar STRING);
however I get the following error:
Exception in thread "main" java.lang.NoSuchFieldError: type
at org.apache.hadoop.hive.ql.parse.HiveLexer.mKW_CREATE(HiveLexer.java:1602)
at org.apache.hadoop.hive.ql.parse.HiveLexer.mTokens(HiveLexer.java:6380)
at org.antlr.runtime.Lexer.nextToken(Lexer.java:89)
at org.antlr.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:133)
at org.antlr.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:127)
at org.antlr.runtime.CommonTokenStream.setup(CommonTokenStream.java:132)
at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:91)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:547)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:438)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:416)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:336)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:909)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:258)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:215)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:406)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:689)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:557)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Make sure you don't have any other antlr-*.jar in your classpath except the one which is there in HIVE_HOME/lib folder. If still doesn't work download the latest version from the antlr's website and put it into the HIVE_HOME/lib folder and give it a try.
HTH
just remove all the files with prefix jackson*
and copy new version of jackson* files from hive.
rm /opt/hadoop/hadoop/lib/jackson*
cp /opt/hive/hive/lib/jackson* /opt/hadoop/hadoop/lib
I did it this way, and it worked perfectly fine!
I hope it helps.