In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to understand the integration of storm and mysql. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
First of all, explain the situation of the problem
1. My storm environment has been built, and it is no problem to test wordcount locally
2. I added a MysqlBolt to the wordcount. This Bolt simply stores the results of the wordcount in the mysql database. When testing the local mode, the results can be inserted into the specified table.
3. Each of my storm nodes has put mysql-connector-java-5.1.23.jar in the lib directory of storm.
4. Each node can access the specified database and the corresponding permissions have been activated.
5. And it is no problem to execute the original wordcount in remote mode
OK!
The problem is that there is an error when running wordcount that integrates mysql in remote mode. The exception is a null pointer. By looking up the code, you find the exception while getting the mysql connection.
The code is as follows: an exception is reported at the red mark
String host_port = "slaver1:3306"
String database = "test"
String username = "root"
String password = "hello"
String url = "jdbc:mysql://" + host_port + "/" + database
Connection conn = null
Try {
Class.forName ("com.mysql.jdbc.Driver")
Conn = DriverManager.getConnection (url, username, password)
} catch (ClassNotFoundException e) {
E.printStackTrace ()
} catch (SQLException e) {
E.printStackTrace ()
}
The cause of the problem is that third-party jar packages are not included when packaging with maven
The above is the editor for you to share how to understand the integration of storm and mysql, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.