Category Archives: JAVA

[Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty

Mybatis insert error cause: Java sql. SQLException: SQL String cannot be empty

1. Error description

Scenario reproduction: when using mybatis to import a list for batch insertion, the code is as follows:

mapper

void insertTest(List<Test> list);

mapper.xml

<insert id="insertTest" parameterType="java.util.List">
	<if test="list != null and list.size() > 0"> 
		INSERT INTO test (test1, test2)
                VALUES
                <foreach collection="list" index="index" item="item" separator=",">
                    (#{item.test1}, #{item.test2})
                </foreach>
	</if>
</insert>

The reason for the error is that the list is passed in The list with size () 0 causes the SQL statement to be empty and an error is reported

Solution:

1. Make non empty judgment (list! = null &&! List. Isempty()) before using mapper, and set mapper If statement removal in XML

2. Use the choose, when and otherwise tags to judge. If it is empty, give a statement to query the empty string

Specific examples are as follows

	<insert id="insertTest" parameterType="java.util.List">
        <choose>
            <when test="list != null and list.size() > 0">
                INSERT INTO test (test1, test2)
                VALUES
                <foreach collection="list" index="index" item="item" separator=",">
                    (#{item.test1}, #{item.test2})
                </foreach>
            </when>
            <otherwise>
                select ""
            </otherwise>
        </choose>

    </insert>

If the scenario needs to implement the insert statement multiple times, it will not be elegant to judge the space multiple times in the code. You can consider using the following solutions for reference only. If there are better methods, you can exchange and discuss them

[Solved] GRPC-Server Error: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String; CLjava

Grpc server reports an error com google.common.base.Preconditions.checkArgument (ZLjava/lang/String;CLjava/lang/Object);

Problem background solution summary Lyric: I really want to take another bite, ผั๥๥๥ผั๥ณ, ผั๥ณ, ผั๥๥ณ This is the first song. It’s over. Have you guessed the title of the song?

Problem background

When working as grpc server, I can’t start it. The error report is printed as follows, but I can’t well see what’s wrong. Since grpc can be used when I test it alone, but as the project becomes more and more complex, more and more POM dependencies are introduced, so I began to find the reason from it

2022-01-25 11:01:39.896 ERROR [id-mapping-AsyncThread-1] o.s.a.i.SimpleAsyncUncaughtExceptionHandler.handleUncaughtException(SimpleAsyncUncaughtExceptionHandler.java:39): Unexpected exception occurred invoking async method: public void grpc.server.GrpcServer.start() throws java.io.IOException
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
	at io.grpc.Metadata$Key.validateName(Metadata.java:629)
	at io.grpc.Metadata$Key.<init>(Metadata.java:637)
	at io.grpc.Metadata$Key.<init>(Metadata.java:567)
	at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:742)
	at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:737)
	at io.grpc.Metadata$Key.of(Metadata.java:593)
	at io.grpc.Metadata$Key.of(Metadata.java:589)
	at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:86)
	at io.grpc.internal.AbstractServerImplBuilder.<clinit>(AbstractServerImplBuilder.java:60)
	at io.grpc.netty.shaded.io.grpc.netty.NettyServerProvider.builderForPort(NettyServerProvider.java:39)
	at io.grpc.netty.shaded.io.grpc.netty.NettyServerProvider.builderForPort(NettyServerProvider.java:24)
	at io.grpc.ServerBuilder.forPort(ServerBuilder.java:41)
	at server.Server.start(GrpcServer.java:30)
	at grpc.server.GrpcServer$$FastClassBySpringCGLIB$$be87d0e.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

 

Solution:

1. Analyze the imported jar package dependency and use file → setting to install Maven dependency helper dependency management

2 after installation, open the POM file, click dependency analyzer

3 select conflicts and click refresh UI to refresh. You can see that guava: version 18.0 appears, which means there is a conflict with this dependency, It’s a repeated introduction,
but the introduction of a problem is to exclude which repeated guava. This problem has been bothering me. My approach is to exclude the displayed dependencies first, and then continue to compile. If not, find other versions of guava for exclusion

4 because there is no exclusion option in Guava in right-click conflicts, Therefore, select jump to left tree to display more clearly

5 exclude 18 versions, re import

6 Click conflicts, and it is found that there is no conflict

7 at that time, the problem that the grpc server cannot be started is also solved

[Solved] IDEA Error: Error running ‘Application‘: Command line is too long

Error running ‘application’ in idea: command line is too long Shorten command line for Application or also for Spring Boot default configuration

Problem background solution 1 (current project settings) solution 2 (global settings)

Lyric: I can’t go to a good school

Command line is too long. Shorten command line for Application or also for Spring Boot default configuration)

Problem background

When idea starts the project, it suddenly reports an error

Error running 'Application':
Command line is too long.Shorten command line for Application or also for Spring Boot default configuration.

Solution:

Method 1 (current project settings)

1 click Edit configurations

in the run drop-down box of the current project. 2 Click environment, select the short command line drop-down box, select classpath file or jar manifest, and click OK to confirm

Method 2 (global setting)

1. Since scheme 1 is the current project setting and other projects are not opened, you can set the global. Click file → new projects settings → run configuration templates for new projects

2. Click springboot project. Other projects are the same as scheme 1

IDEA Error: lombok.extern.slf4j is not exist [How to Solve]

Idea reports an error Lombok extern. Slf4j is not exist no solution exists

Problem background solution summary Lyric: maltose wine

Problem background

When you start the idea project, you suddenly report an error Lombok extern. It’s been a long time since I found that the version of 4fj is compatible with Maven

Solution

1 file → setting

2 build → build tools → maven → runner, check delegate ide build and click OK

[Solved] fragment error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}…

1. Error Messages:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #9 in com.example.myapplication:layout/activity_main: Binary XML file line #9 in com.example.myapplication:layout/activity_main: Error inflating class fragment.
2. Locating the problem
Check the logs and find that the problem is located at: at com.example.myapplication.MainActivity.onCreate(MainActivity.java:11), click to jump to the line of code that says

  setContentView(R.layout.activity_main);

It was found that it was an XML file problem, so I carefully checked a piece of code I used fragment

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <fragment
        android:name="com.example.myapplication.fragment.MyFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

It was found that the problem was caused by the fact that the fragment did not use the layout ID. after I added the ID to the fragment, the problem was successfully solved.

 <fragment
        android:id="@+id/my_fragment"
        android:name="com.example.myapplication.fragment.MyFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

[Solved] Flink TableAPI Error — > Class cannot be found

Console error:

"C:\Program Files\Java\jdk1.8.0_201\bin\java.exe" "-javaagent:D:\ideaSoftware\IntelliJ IDEA 2020.2.3\lib\idea_rt.jar=52126:D:\ideaSoftware\IntelliJ IDEA 2020.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_201\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\rt.jar;D:\Conding_pojoect\MyFlink\target\classes;D:\MyTools\repository\org\apache\flink\flink-clients_2.12\1.9.3\flink-clients_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-core\1.9.3\flink-core-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-annotations\1.9.3\flink-annotations-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-metrics-core\1.9.3\flink-metrics-core-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-asm-6\6.2.1-7.0\flink-shaded-asm-6-6.2.1-7.0.jar;D:\MyTools\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;D:\MyTools\repository\com\esotericsoftware\kryo\kryo\2.24.0\kryo-2.24.0.jar;D:\MyTools\repository\com\esotericsoftware\minlog\minlog\1.2\minlog-1.2.jar;D:\MyTools\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\MyTools\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\MyTools\repository\org\apache\commons\commons-compress\1.18\commons-compress-1.18.jar;D:\MyTools\repository\org\apache\flink\flink-runtime_2.12\1.9.3\flink-runtime_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-queryable-state-client-java\1.9.3\flink-queryable-state-client-java-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-hadoop-fs\1.9.3\flink-hadoop-fs-1.9.3.jar;D:\MyTools\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-netty\4.1.32.Final-7.0\flink-shaded-netty-4.1.32.Final-7.0.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-jackson\2.10.1-9.0\flink-shaded-jackson-2.10.1-9.0.jar;D:\MyTools\repository\org\javassist\javassist\3.19.0-GA\javassist-3.19.0-GA.jar;D:\MyTools\repository\org\scala-lang\scala-library\2.12.7\scala-library-2.12.7.jar;D:\MyTools\repository\com\typesafe\akka\akka-actor_2.12\2.5.21\akka-actor_2.12-2.5.21.jar;D:\MyTools\repository\com\typesafe\config\1.3.3\config-1.3.3.jar;D:\MyTools\repository\org\scala-lang\modules\scala-java8-compat_2.12\0.8.0\scala-java8-compat_2.12-0.8.0.jar;D:\MyTools\repository\com\typesafe\akka\akka-stream_2.12\2.5.21\akka-stream_2.12-2.5.21.jar;D:\MyTools\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;D:\MyTools\repository\com\typesafe\ssl-config-core_2.12\0.3.7\ssl-config-core_2.12-0.3.7.jar;D:\MyTools\repository\org\scala-lang\modules\scala-parser-combinators_2.12\1.1.1\scala-parser-combinators_2.12-1.1.1.jar;D:\MyTools\repository\com\typesafe\akka\akka-protobuf_2.12\2.5.21\akka-protobuf_2.12-2.5.21.jar;D:\MyTools\repository\com\typesafe\akka\akka-slf4j_2.12\2.5.21\akka-slf4j_2.12-2.5.21.jar;D:\MyTools\repository\org\clapper\grizzled-slf4j_2.12\1.3.2\grizzled-slf4j_2.12-1.3.2.jar;D:\MyTools\repository\com\github\scopt\scopt_2.12\3.5.0\scopt_2.12-3.5.0.jar;D:\MyTools\repository\org\xerial\snappy\snappy-java\1.1.4\snappy-java-1.1.4.jar;D:\MyTools\repository\com\twitter\chill_2.12\0.7.6\chill_2.12-0.7.6.jar;D:\MyTools\repository\com\twitter\chill-java\0.7.6\chill-java-0.7.6.jar;D:\MyTools\repository\org\apache\flink\flink-optimizer_2.12\1.9.3\flink-optimizer_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-java\1.9.3\flink-java-1.9.3.jar;D:\MyTools\repository\commons-cli\commons-cli\1.3.1\commons-cli-1.3.1.jar;D:\MyTools\repository\org\slf4j\slf4j-api\1.7.15\slf4j-api-1.7.15.jar;D:\MyTools\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;D:\MyTools\repository\org\apache\flink\force-shading\1.9.3\force-shading-1.9.3.jar;D:\MyTools\repository\org\projectlombok\lombok\1.18.2\lombok-1.18.2.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-java_2.12\1.9.3\flink-streaming-java_2.12-1.9.3.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-guava\18.0-7.0\flink-shaded-guava-18.0-7.0.jar;D:\MyTools\repository\org\apache\commons\commons-math3\3.5\commons-math3-3.5.jar;D:\MyTools\repository\org\apache\bahir\flink-connector-redis_2.11\1.0\flink-connector-redis_2.11-1.0.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-java_2.11\1.2.0\flink-streaming-java_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-runtime_2.11\1.2.0\flink-runtime_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-hadoop2\1.2.0\flink-shaded-hadoop2-1.2.0.jar;D:\MyTools\repository\org\tukaani\xz\1.0\xz-1.0.jar;D:\MyTools\repository\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;D:\MyTools\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;D:\MyTools\repository\commons-net\commons-net\3.1\commons-net-3.1.jar;D:\MyTools\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\MyTools\repository\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;D:\MyTools\repository\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;D:\MyTools\repository\commons-el\commons-el\1.0\commons-el-1.0.jar;D:\MyTools\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;D:\MyTools\repository\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;D:\MyTools\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\MyTools\repository\commons-configuration\commons-configuration\1.7\commons-configuration-1.7.jar;D:\MyTools\repository\commons-digester\commons-digester\1.8.1\commons-digester-1.8.1.jar;D:\MyTools\repository\org\codehaus\jackson\jackson-core-asl\1.8.8\jackson-core-asl-1.8.8.jar;D:\MyTools\repository\org\codehaus\jackson\jackson-mapper-asl\1.8.8\jackson-mapper-asl-1.8.8.jar;D:\MyTools\repository\org\apache\avro\avro\1.7.7\avro-1.7.7.jar;D:\MyTools\repository\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;D:\MyTools\repository\com\jcraft\jsch\0.1.42\jsch-0.1.42.jar;D:\MyTools\repository\commons-beanutils\commons-beanutils-bean-collections\1.8.3\commons-beanutils-bean-collections-1.8.3.jar;D:\MyTools\repository\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;D:\MyTools\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;D:\MyTools\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\MyTools\repository\javax\activation\activation\1.1\activation-1.1.jar;D:\MyTools\repository\io\netty\netty-all\4.0.27.Final\netty-all-4.0.27.Final.jar;D:\MyTools\repository\com\data-artisans\flakka-actor_2.11\2.3-custom\flakka-actor_2.11-2.3-custom.jar;D:\MyTools\repository\com\data-artisans\flakka-remote_2.11\2.3-custom\flakka-remote_2.11-2.3-custom.jar;D:\MyTools\repository\io\netty\netty\3.8.0.Final\netty-3.8.0.Final.jar;D:\MyTools\repository\org\uncommons\maths\uncommons-maths\1.2.2a\uncommons-maths-1.2.2a.jar;D:\MyTools\repository\com\data-artisans\flakka-slf4j_2.11\2.3-custom\flakka-slf4j_2.11-2.3-custom.jar;D:\MyTools\repository\org\clapper\grizzled-slf4j_2.11\1.0.2\grizzled-slf4j_2.11-1.0.2.jar;D:\MyTools\repository\com\github\scopt\scopt_2.11\3.2.0\scopt_2.11-3.2.0.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-core\2.7.4\jackson-core-2.7.4.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-databind\2.7.4\jackson-databind-2.7.4.jar;D:\MyTools\repository\com\fasterxml\jackson\core\jackson-annotations\2.7.0\jackson-annotations-2.7.0.jar;D:\MyTools\repository\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;D:\MyTools\repository\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;D:\MyTools\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\MyTools\repository\jline\jline\0.9.94\jline-0.9.94.jar;D:\MyTools\repository\junit\junit\3.8.1\junit-3.8.1.jar;D:\MyTools\repository\com\twitter\chill_2.11\0.7.4\chill_2.11-0.7.4.jar;D:\MyTools\repository\org\apache\flink\flink-clients_2.11\1.2.0\flink-clients_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\flink\flink-optimizer_2.11\1.2.0\flink-optimizer_2.11-1.2.0.jar;D:\MyTools\repository\org\apache\sling\org.apache.sling.commons.json\2.0.6\org.apache.sling.commons.json-2.0.6.jar;D:\MyTools\repository\redis\clients\jedis\2.8.0\jedis-2.8.0.jar;D:\MyTools\repository\org\apache\commons\commons-pool2\2.3\commons-pool2-2.3.jar;D:\MyTools\repository\org\apache\flink\flink-statebackend-rocksdb_2.12\1.10.1\flink-statebackend-rocksdb_2.12-1.10.1.jar;D:\MyTools\repository\com\data-artisans\frocksdbjni\5.17.2-artisans-2.0\frocksdbjni-5.17.2-artisans-2.0.jar;D:\MyTools\repository\mysql\mysql-connector-java\8.0.25\mysql-connector-java-8.0.25.jar;D:\MyTools\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;D:\MyTools\repository\org\apache\flink\flink-table-planner_2.12\1.10.1\flink-table-planner_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-common\1.10.1\flink-table-common-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-shaded-asm-7\7.1-9.0\flink-shaded-asm-7-7.1-9.0.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-java-bridge_2.12\1.10.1\flink-table-api-java-bridge_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-scala-bridge_2.12\1.10.1\flink-table-api-scala-bridge_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-scala_2.12\1.10.1\flink-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-streaming-scala_2.12\1.10.1\flink-streaming-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-planner-blink_2.12\1.10.1\flink-table-planner-blink_2.12-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-java\1.10.1\flink-table-api-java-1.10.1.jar;D:\MyTools\repository\org\apache\flink\flink-table-api-scala_2.12\1.10.1\flink-table-api-scala_2.12-1.10.1.jar;D:\MyTools\repository\org\scala-lang\scala-reflect\2.12.7\scala-reflect-2.12.7.jar;D:\MyTools\repository\org\scala-lang\scala-compiler\2.12.7\scala-compiler-2.12.7.jar;D:\MyTools\repository\org\scala-lang\modules\scala-xml_2.12\1.0.6\scala-xml_2.12-1.0.6.jar;D:\MyTools\repository\org\apache\flink\flink-table-runtime-blink_2.12\1.10.1\flink-table-runtime-blink_2.12-1.10.1.jar;D:\MyTools\repository\org\codehaus\janino\janino\3.0.9\janino-3.0.9.jar;D:\MyTools\repository\org\codehaus\janino\commons-compiler\3.0.9\commons-compiler-3.0.9.jar;D:\MyTools\repository\org\apache\calcite\avatica\avatica-core\1.15.0\avatica-core-1.15.0.jar;D:\MyTools\repository\org\reflections\reflections\0.9.10\reflections-0.9.10.jar" Com.ZQQQ.TableAPI.Example
21:39:36,292 INFO  org.apache.flink.api.java.typeutils.TypeExtractor             - class org.apache.flink.streaming.api.functions.source.TimestampedFileInputSplit does not contain a setter for field modificationTime
21:39:36,293 INFO  org.apache.flink.api.java.typeutils.TypeExtractor             - Class class org.apache.flink.streaming.api.functions.source.TimestampedFileInputSplit cannot be used as a POJO type because not all fields are valid POJO fields, and must be processed as GenericType. Please read the Flink documentation on "Data Types & Serialization" for details of the effect on performance.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/configuration/ReadableConfig
	at org.apache.flink.table.planner.StreamPlannerFactory.create(StreamPlannerFactory.java:49)
	at org.apache.flink.table.api.java.internal.StreamTableEnvironmentImpl.create(StreamTableEnvironmentImpl.java:120)
	at org.apache.flink.table.api.java.StreamTableEnvironment.create(StreamTableEnvironment.java:112)
	at org.apache.flink.table.api.java.StreamTableEnvironment.create(StreamTableEnvironment.java:83)
	at Com.ZQQQ.TableAPI.Example.main(Example.java:35)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.configuration.ReadableConfig
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 5 more

Process finished with exit code 1

Reason for the error.
It is caused by the inconsistency between the Flink version and the tableAPI version.
Solution.
Change all the pom.xml that involve flink version to the same version.

I configure the pom.xml file as follows

  <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-streaming-java -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-streaming-java_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.bahir/flink-connector-redis -->
    <dependency>
        <groupId>org.apache.bahir</groupId>
        <artifactId>flink-connector-redis_2.11</artifactId>
        <version>1.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-statebackend-rocksdb -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-statebackend-rocksdb_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
	
        <!--TableAPI-->
    <!-- https://mvnrepository.com/artifact/org.apache.flink/flink-table-planner -->
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-table-planner_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-table-planner-blink_2.12</artifactId>
        <version>1.10.1</version>
    </dependency>	

[Solved] Maven Multi-Project Compile Error: The POM for xxx is invalid

Reference address: the POM for XXX is invalid

Compilation warning:

[WARNING] The POM for com.gtcom:output-common:jar:1.0.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

Solution:

If there is no remote warehouse, select install on the parent project. If there is a remote warehouse, select deploy on the parent project.

Error message:

D:\Java\jdk-11.0.13\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\IdeaProjects\gtcom-output\output-backstage "-Dmaven.home=D:\JetBrains\IntelliJ IDEA 2021.3\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\JetBrains\IntelliJ IDEA 2021.3\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=D:\JetBrains\IntelliJ IDEA 2021.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\JetBrains\IntelliJ IDEA 2021.3\lib\idea_rt.jar=61663:D:\JetBrains\IntelliJ IDEA 2021.3\bin" -Dfile.encoding=UTF-8 -classpath "D:\JetBrains\IntelliJ IDEA 2021.3\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;D:\JetBrains\IntelliJ IDEA 2021.3\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.3 -DskipTests=true compile
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< com.gtcom:output-backstage >---------------------
[INFO] Building output-backstage 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.gtcom:output-common:jar:1.0.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ output-backstage ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ output-backstage ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 56 source files to D:\IdeaProjects\gtcom-output\output-backstage\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.074 s
[INFO] Finished at: 2022-01-20T19:57:55+08:00
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/conf/logging/
constituent[1]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/cdi-api-1.0.jar
constituent[2]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/commons-cli-1.4.jar
constituent[3]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/commons-io-2.5.jar
constituent[4]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/commons-lang3-3.8.1.jar
constituent[5]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/guava-25.1-android.jar
constituent[6]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/guice-4.2.1-no_aop.jar
constituent[7]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/jansi-1.17.1.jar
constituent[8]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/javax.inject-1.jar
constituent[9]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/jcl-over-slf4j-1.7.29.jar
constituent[10]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/jsoup-1.12.1.jar
constituent[11]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/jsr250-api-1.0.jar
constituent[12]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-artifact-3.8.1.jar
constituent[13]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-builder-support-3.8.1.jar
constituent[14]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-compat-3.8.1.jar
constituent[15]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-core-3.8.1.jar
constituent[16]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-embedder-3.8.1.jar
constituent[17]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-model-3.8.1.jar
constituent[18]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-model-builder-3.8.1.jar
constituent[19]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-plugin-api-3.8.1.jar
constituent[20]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.8.1.jar
constituent[21]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-api-1.6.2.jar
constituent[22]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-connector-basic-1.6.2.jar
constituent[23]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-impl-1.6.2.jar
constituent[24]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-provider-3.8.1.jar
constituent[25]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-spi-1.6.2.jar
constituent[26]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-transport-wagon-1.6.2.jar
constituent[27]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-resolver-util-1.6.2.jar
constituent[28]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-settings-3.8.1.jar
constituent[29]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-settings-builder-3.8.1.jar
constituent[30]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-shared-utils-3.2.1.jar
constituent[31]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/maven-slf4j-provider-3.8.1.jar
constituent[32]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/org.eclipse.sisu.inject-0.3.4.jar
constituent[33]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/org.eclipse.sisu.plexus-0.3.4.jar
constituent[34]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar
constituent[35]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/plexus-component-annotations-2.1.0.jar
constituent[36]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/plexus-interpolation-1.25.jar
constituent[37]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.4.jar
constituent[38]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/plexus-utils-3.2.1.jar
constituent[39]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/slf4j-api-1.7.29.jar
constituent[40]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/wagon-file-3.4.3.jar
constituent[41]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/wagon-http-3.4.3-shaded.jar
constituent[42]: file:/D:/JetBrains/IntelliJ%20IDEA%202021.3/plugins/maven/lib/maven3/lib/wagon-provider-api-3.4.3.jar
---------------------------------------------------
Exception in thread "main" java.lang.AssertionError
	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
	at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:247)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:837)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1535)
	at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
	at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1140)
	at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1066)
	at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
	at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
	at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:993)
	at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
	at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:199)
	at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:167)
	at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
	at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
	at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:185)
	at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:167)
	at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
	at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
	at jdk.compiler/com.sun.tools.javac.util.JCDiagnostic.getMessage(JCDiagnostic.java:788)
	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage(ClientCodeWrapper.java:799)
	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:149)
	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

The process has ended, exit code 1

Spring Error: Transaction synchronization is not active

First, make sure that the @Transactional annotation is added to the calling method
1. Add the @Transactional annotation where transaction management is required. The @Transactional annotation can be applied to interface definitions and interface methods, class definitions and public methods of classes.
2. @Transactional annotations can only be applied to public visibility methods. If you use the @Transactional annotation on a protected, private, or package-visible method, it will not report an error, but the annotated method will not display the configured transaction settings.
3. Note that the mere presence of the @Transactional annotation is not sufficient to enable transactional behavior, it is only a metadata. You must use the configuration element in the configuration file to actually enable the transaction behavior. (spring configuration file, turn on declarative transactions)
The value of the “proxy-target-class” attribute of the element controls whether interface-based or class-based proxies are created. If the “proxy-target-class” property is set to “true”, then the class-based proxy will work (this requires the CGLIB library cglib.jar in the CLASSPATH). If the “proxy-target-class” property is set to “false” or if this property is omitted, then the standard JDK interface-based proxy will work.
5. The Spring team recommends using @Transactional annotations on specific classes (or methods of classes) and not on any interfaces that the class is intended to implement. Using @Transactional annotations on interfaces will only work if you set up an interface-based proxy. Because annotations are not inheritable, this means that if a class-based proxy is being used, then the transaction settings will not be recognized by the class-based proxy and the object will not be wrapped by the transaction proxy.
6. @Transactional transactions are opened, either by interface-based or class-based proxies are created. So in the same class a non-transactional method calls another transactional method, the transaction will not work.
Pay special attention to point 6: a non-transactional method in the same class calls another transactional method, the transaction will not work. This point caught my attention, maybe my annotated @Transactional departingCar method is also called by another method in the class that does not open a transaction, if this is true, everything makes sense.

Springboot2.6.X configurate swagger error [How to Solve]

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
	at java.lang.Iterable.forEach(Iterable.java:75)

Modify YML file

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

[Solved] Hive On Spark Error: Remote Spark Driver – HiveServer2 connection has been closed

Error Messages:

Failed to monitor Job[-1] with exception ‘java.lang.IllegalStateException(Connection to remote Spark driver was lost)’ Last known state = SENT
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.spark.SparkTask. Unable to send message SyncJobRequest{job=org.apache.hadoop.hive.ql.exec.spark.status.impl.RemoteSparkJobStatus$GetAppIDJob@7805478c} because the Remote Spark Driver - HiveServer2 connection has been closed.

The real cause of this problem requires going to Yarn and looking at the Application’s detailed logs at

It turns out that the executor-memory is too small and needs to be modified in the hive configuration page

Save the changes and restart the relevant components, the problem is solved.

[Solved] Springboot Project Error: Mail server connection failed;

 

Error background

Using springboot2 Error in 2.0 integrated mail function


Error message:

org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
; message exception details (1) are:Failed message 1:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;
  nested exception is:


Solution:

Modify the configuration file (in the context of using QQ mailbox)

spring:
  mail:
    host: smtp.qq.com
    port: 587
    username: e-mail
    password: Authorization Code
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          socketFactory:
            class: javax.net.ssl.SSLSocketFactory

result

After modifying the configuration, the problem is solved!