apache flink not able to resolve imports - java

Hi iam working on the flink introduction but iam not able to import properly
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.walkthrough.common.sink.AlertSink;
import org.apache.flink.walkthrough.common.entity.Alert;
import org.apache.flink.walkthrough.common.entity.Transaction;
import org.apache.flink.walkthrough.common.source.TransactionSource;
these above packages are not able to import
i have used from the following site link
in this link i have imported the project via mvn command
please help me resolve this

I just tried this myself, and found that in order to run the application in my IDE (IntelliJ) I had to select the option under Run / Edit Configurations to 'Include dependencies with "Provided" scope'. Once I did that, everything worked fine.
I was able to build the application from the command line (via "mvn clean package") without making any changes.

Can you please verify the below artifact in your maven pom.xml?
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.12</artifactId>
<version>1.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-walkthrough-table-java</artifactId>
<version>1.11.1</version>
</dependency>

Related

How to import Xodus in Java?

I have added the dependency to my pom.xml:
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-openAPI</artifactId>
<version>1.3.124</version>
</dependency>
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-environment</artifactId>
<version>1.3.124</version>
</dependency>
But it's the only one that doesn't seem to work when I import it in a Java class. I tried many different ways to import it, such as import org.jetbrains.exodus.env.Environments; but none of them work.
I am using JDK 11 and Netbeans 11.2.
Right package for Environments API is jetbrains.exodus.env, so import jetbrains.exodus.env.Environments;should work.

The import org.mybatis.dynamic cannot be resolved

I want to try the example of dynamic update statement on this tutorial link : http://www.mybatis.org/mybatis-dynamic-sql/docs/update.html. I saw that it needs the import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider; , So i've searched for dependency in the maven central and added below dependency on my pom.xml
<!-- https://mvnrepository.com/artifact/org.mybatis.dynamic-sql/mybatis-dynamic-sql -->
<dependency>
<groupId>org.mybatis.dynamic-sql</groupId>
<artifactId>mybatis-dynamic-sql</artifactId>
<version>1.0.0</version>
</dependency>
Already tried mvn clean install -U on maven build but still The import org.mybatis.dynamic cannot be resolved error always shows. Where can i have the correct maven dependency for this. Or you can suggest me other dynamic update statement approach on mybatis using xml mapper.
I also added the newest version of it and everything worked as expected. I had the problem, that mybatis-spring-boot-starter did not include mybatis-dynamic-sql.
<dependency>
<groupId>org.mybatis.dynamic-sql</groupId>
<artifactId>mybatis-dynamic-sql</artifactId>
<version>1.3.1</version>
</dependency>

NoSuchMethodError: com.fasterxml.jackson.module.scala.deser.BigDecimalDeserializer

sc.newAPIHadoopRDD is continuously giving me the error.
val hBaseRDD = sc.newAPIHadoopRDD(hbase_conf, classOf[TableInputFormat], classOf[org.apache.hadoop.hbase.io.ImmutableBytesWritable], classOf[org.apache.hadoop.hbase.client.Result]);
java.lang.NoSuchMethodError: ava.lang.NoSuchMethodError: com.fasterxml.jackson.module.scala.deser.BigDecimalDeserializer$.handledType()Ljava/lang/Class;
at com.fasterxml.jackson.module.scala.deser.NumberDeserializers$.<init>(ScalaNumberDeserializersModule.scala:49)
at com.fasterxml.jackson.module.scala.deser.NumberDeserializers$.<clinit>(ScalaNumberDeserializersModule.scala)
at com.fasterxml.jackson.module.scala.deser.ScalaNumberDeserializersModule$class.$init$(ScalaNumberDeserializersModule.scala:61)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.<init>(DefaultScalaModule.scala:20)
at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<init>(DefaultScalaModule.scala:37)
at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<clinit>(DefaultScalaModule.scala)
at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
at org.apache.spark.SparkContext.withScope(SparkContext.scala:701)
at org.apache.spark.SparkContext.newAPIHadoopRDD(SparkContext.scala:1132)
I am trying to fetch values from Hbase.it is working perfectly fine in my local system already gone through many other answers related to this topic but nothing has helped me out yet.
But whenever I try to run it on my cluster it gives me error as mentioned above.
Already done all these imports
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.mapreduce.TableInputFormat
import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.{HTableDescriptor,HColumnDescriptor}
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.client.{Put,HTable}
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hbase._
import org.apache.hadoop.hbase.client._
import org.apache.hadoop.hbase.util._
import org.apache.spark._
import org.apache.hadoop.hbase.client.{HBaseAdmin, Result}
import org.apache.hadoop.hbase.{ HBaseConfiguration, HTableDescriptor }
import org.apache.hadoop.hbase.mapreduce.TableInputFormat
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
Followed all the steps of installation as well as classpath from
https://acadgild.com/blog/apache-spark-hbase/
Please Help me.
I got my problem after searching and exploring other jars
My Hadoop Version 2.7.3
My Hbase Version 1.4.2
Libraries I was using was of version 1.4.2 only but straight away using them as
--driver-class-path $HBASE_HOME
As mentioned in the Link which I referred from.
But the issue was it was giving me some JARS incompatibility and also multiple occurrences of JARS with same name.
Actually the only Dependencies that are needed to run Hbase successfully are
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>1.3.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<version>1.3.1</version>
</dependency>
Updated Libraries of Hbase doesnt have the required classes to implement Hbase.
After using these version of libraries it worked for me perfectly fine.

Import / Dependency Cannot be Resolved in Maven

I'm using a program that relies on the following two imports:
import org.lwjgl.opencl.CLDevice;
import org.lwjgl.opencl.CLPlatform;
Eclipse is reporting that the "import cannot be resolved" even though I've added LWJGL OpenCL as a dependency to my project.
Here's a snapshot of my POM file:
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-opencl</artifactId>
<version>3.1.6</version>
</dependency>
I've read somewhere that these classes only exist in an earlier version so I tried changing the version to all of the versions found here ( from 3.1.0 to 3.1.6) but none of them resolved the issue.
Is there an earlier/different version that is not on the Maven repository page? If not where could I find the said class?
Thanks
It seems that you are using the abandoned lwjgl v2 library. It can be found in another Maven repository:
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>2.9.3</version>
</dependency>

mvn package org.apache.pdfbox not found

I have these imports (among others):
import org.apache.pdfbox.*;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
I have this dependency in my pom.xml:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.4</version>
</dependency>
I see this line in my eclipse maven dependencies:
pdfbox-2.0.4.jar - C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar
I check the build path in eclipse, and see pdfbox-2.0.4.jar in the Maven Dependencies part.
I run mvn clean compile in a command prompt (Windows).
I get the error "package org.apache.pdfbox does not exist"
I run mvn dependency:build-classpath -Dmdep.outputFile=cp.txt
The following lines are listed in the class path (at the front of the class path):
C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar;
C:\Users\Paul\.m2\repository\org\apache\pdfbox\fontbox\2.0.4\fontbox-2.0.4.jar;
I look in C:\Users\Paul.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\
and I see pdfbox-2.0.4.jar
So what am I missing? Why is the pdfbox jar not being found?
remove this line:
import org.apache.pdfbox.*;
because that package does indeed not exist. The other ones (with deeper levels) are OK.

Categories

Resources