Tag Archives: jar

[Solved] SSM startup error: ClassNotFoundException: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

SSM Startup Error: ClassNotFoundException

Phenomenon

Error message after adding jar package again:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

 

Solution:

Select Project Structure in the file and then select Artifacts, right click on the rightmost project name and select Put into Output Root

Request processing failed; nested exception is java.lang.NullPointerException or UnsatisfiedDependencyE

1. Null pointer exception:

Request processing failed; nested exception is java.lang.NullPointerException

java.lang.NullPointerException
com.atguigu.mvc.controller.NodesController.getFilesAndSendId(NodesController.java:61)


See the exception address and check the control layer

Control level, line 61:

List<FilePath> files = fileService.getFiles();

current

@RequestMapping(value = "/getFilesAndSendId/{sensor_id}",method = RequestMethod.GET)

Parameter sensor_id is passed;

Solution to null pointer:
Original:

private FileService fileService;

Change to: add @Autowired annotation

 @Autowired
    private FileService fileService;

If there is any other error when you run the codes:

Servlet.init() of Servlet[DispatcherServlet] raises an exception.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘nodesController’: Unsatisfied dependency expressed through field ‘fileService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.atguigu.mvc.service.FileService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


Solution:
Check if the @Service annotation is added to the implementation class here

[Solved] JAVA Project Import jstl Error: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator

The following error is generated when using jstl with tomcat10.
HTTP status 500 – Internal server error
Type Exception Report
Message java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
Description The server encountered an unexpected condition that prevented it from completing the request.
Exceptions

jakarta.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Reason
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2516)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1408)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2516)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1408)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
org.apache.jasper.compiler.TagLibraryInfoImpl.createValidator(TagLibraryInfoImpl.java:355)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:195)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:487)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:391)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Reason
java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.TagLibraryValidator
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2516)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1408)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2516)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1408)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
org.apache.jasper.compiler.TagLibraryInfoImpl.createValidator(TagLibraryInfoImpl.java:355)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:195)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:487)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:391)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
): Note that the full stack information for the main issue can be viewed in the server logs
Apache Tomcat/10.0.16

 

Solution (I):
If you are using tomcat10 version need to change tomcat10 to tomcat8
Solution (II):
Tomcat10 version needs to be used with :
jakarta.servlet.jsp.jstl-2.0.0.jar
jakarta.servlet.jsp.jstl-api-2.0.0.jar
Note: Only these two jstl packages are allowed under lib, no other jstl packages, otherwise it will still report an error

IDEA: How to Solve Springboot Project install Error

Found multiple occurrences of org.json.JSONObject on the class path:

    jar:file:/C:/Users/Administrator/.m2/repository/org/json/json/20160810/json-20160810.jar!/org/json/JSONObject.class
    jar:file:/C:/Users/Administrator/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class

You may wish to exclude one of them to ensure predictable runtime behavior

Solution:

Add to pomz: com.vaadin.external.google dependency ignore can be

<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.vaadin.external.google</groupId>
					<artifactId>android-json</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

IDEA Import Servlet Package Error [How to Solve]

When we use idea to import packages related to servlets, we sometimes encounter errors, which leads to the problem that servlets cannot recognize. In fact, the reason for the problem is very simple, that is, we can’t find packages related to servlets in JDK

Solution:
1. Find the installation directory of Tomcat, here is C:\Program Files\Apache Software Foundation\Tomcat 8.5\lib (Note: not everyone’s directory is this, need to be based on the actual situation of your computer’s installation directory), find the Servlet-api.jar This file, copy it

2. then go to the JDK installation directory: C:\Program Files\Java\jdk1.8.0_241\jre\lib\ext, find the ext folder, and then copy the Servlet-api.jar file just copied to this folder

3. Back to the idea, the problem is solved, if the idea is still reporting errors, restart the idea refresh

[Solved] Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:

Running error

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.scheduling.quartz.SchedulerAccessor.registerListeners(SchedulerAccessor.java:351)

The following method did not exist:

    org.quartz.Scheduler.getListenerManager()Lorg/quartz/ListenerManager;

The method's class, org.quartz.Scheduler, is available from the following locations:

    jar:file:/D:/repository/org/opensymphony/quartz/quartz/1.6.1/quartz-1.6.1.jar!/org/quartz/Scheduler.class

It was loaded from the following location:

    file:/D:/repository/org/opensymphony/quartz/quartz/1.6.1/quartz-1.6.1.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.quartz.Scheduler

Analysis: it worked well before, but suddenly it didn’t work. Reading the report incorrectly may be caused by the jar package conflict of the scheduled task

1. A global check reveals that shiro-all has introduced this jar package

Solution:

When querying the dependency, I found that it is an optional part of shiro, so I exclude it directly.

<dependency>
    <groupId>org.apache.shiro</groupId>
    <artifactId>shiro-all</artifactId>
    <version>1.4.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-quartz</artifactId>
        </exclusion>
    </exclusions>
</dependency>

If the shiro-all package is introduced in a jar package, the following code can be placed under the parent package introduced by the project

     <exclusions>
        <exclusion>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-quartz</artifactId>
        </exclusion>
    </exclusions>

 

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [hello scope], template mi

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [hello scope], template might not exist or might not be accessible by any of the configured Template Resolvers
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362) [thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:189) [thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) [tomcat-embed-core-9.0.41.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [tomcat-embed-core-9.0.41.jar:4.0.FR]
at

 

Solution: The method I wrote in the controller layer was wrongly written

[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] IDEA error: sun.security.pkcs not found

Abnormal scene

When Java 8 switches to Java 11, there is an error and sun is not found security 。

Problem analysis

Jar package and source code are available. The probability is due to the security policy in the new JDK.

Solution:

In the compiler’s settings -> Build,Execution -> Compiler-> Disable in Java compiler:

Use ‘–release’ option for cross-compilation

Then rebuild

If there is no exception after build, check it again.

[Solved] Powermock error: Java.Lang.linkageerror: load constraint violation

Use powermock to report an error Java Lang. linkageerror: load constraint violation

Error reporting information (limited to deletion of space): analysis and solution extension

Error reporting information (limited to deletion of space):

java.lang.LinkageError: Loading constraint violation: loaders“org/powermock/core/classloader/javassist/JavassistMockClassLoader@47ab16ce”先前已启动由装入器“com/ibm/oti/vm/BootstrapClassLoader@ba626924”定义的名为“javax/security/auth/x500/X500Principal”的另一种类型的装入

\tat java.lang.ClassLoader.defineClassImpl(Native Method)
\tat java.lang.ClassLoader.defineClass(ClassLoader.java:346)
\tat org.powermock.core.classloader.javassist.JavassistMockClassLoader.loadUnmockedClass(JavassistMockClassLoader.java:90)
\tat org.powermock.core.classloader.MockClassLoader.loadClassByThisClassLoader(MockClassLoader.java:104)
\tat 、ock.core.MockInvocation.init(MockInvocation.java:31)
\tat org.powermock.core.MockInvocation.<init>(MockInvocation.java:22)
\tat org.powermock.core.MockGateway.doMethodCall(MockGateway.java:155)
\tat org.powermock.core.MockGateway.methodCall(MockGateway.java:138)

analysis

java.Lang.linkageerror this exception is often encountered in applications using multiple classloaders
the reason for this error is the class conflict caused by the cross use of class classes with the same qualified name after being loaded by multiple different classloaders. Classes with the same qualified name belong to different class instances in different classloaders. When loading a class, the JVM needs to load all imported classes. In this case, if there is a class with the same qualified name in the custom classloader as that in the parent classloader, Java. Net will be thrown Lang.LinkageError.
from the error message, you can see that the javax/security/auth/X500/X500 principal class is loaded by the classloader and bootstrapclassloader customized by powermock at the same time.

Solution:

Use @powermockignore to make javassistmockclassloader ignore the loading of javax/security/auth/X500/X500 principal:

@PowerMockIgnore({"javax.security.*"})

[Solved] jar file Execute Error: power shell error: unable to access jarfile

 

Problem description

When using the configuration task of vscode, there are problems in executing the jar file, so there are the following solutions.

preparation

Software: vscode
environment: windows10

How to configure

1. Create a task and execute the jar file:

2. Configurable parameters must be placed later

-Dkafka.base.client.bootstrapServers=192.168.75.129:9092

How does it work

1. Run profile location

2. Find the executable file name

More

Building Java code
You can use Maven to perform multiple build lifecycle goals, including compiling project code, creating library packages (such as JAR files), and installing libraries in a local Maven dependency repository
To attempt a build, issue the following command from the command line.
mvn compile

This will run Maven and tell it to perform a compile of the target. When it is done, you should find the compiled .class file in the target/classes directory.
Since you are unlikely to want to distribute or use the .class files directly, you may want to run the package target instead:
mvn package

The package target will compile the Java code, run any tests, and package the code up in the completion target directory via an internal JAR file. the name of the JAR file will be based on the project's <artifactId> and <version>.
For example, given the previous minimal pom.xml file, the JAR file will be named kiwi-0.7.0.jar.

To execute the JAR file, run.
java -jar F:\WorkSoftware\Kafka\kiwi-0.7.0.jar -Dkafka.base.client.bootstrapServers=192.168.75.129:9092

If you change the value of <packaging> "jar" to "war", the result will be a WAR file in the target directory instead of a JAR file.

[Solved] docker Start jar package and Set JVM parameter Error

Error Messages:
Unrecognized option: -server -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms512m -Xmx1024m -Xmn512m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -Dtask=true
Error: Could not create the Java Virtual Machine.
Background:
Setting JVM parameters and then using docker file to start jar package reported an error.
Solution:
Use the ENTRYPOINT exec command.
ENV jvm_opts=”-server -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Xms512m -Xmx1024m -Xmn512m -Xss256k -XX:S
urvivorRatio=8 -XX:+UseConcMarkSweepGC -Dtask=true”

ENTRYPOINT exec java -jar $jvm_opts trade-chat.jar $app_arg