Tag Archives: JAVA error

JAVA Error: Error attempting to get column ‘XXX’ from result set. Cause java.sql.

The entity class in Java uses the LocalDateTime type
Convert error: Error attempting to get column ‘XXX’ from result set. Cause: java.sql.

The solution is the simplest:
Switch the version number of com.alibaba to 1.1.22

   <dependency>
         <groupId>com.alibaba</groupId>
         <artifactId>druid-spring-boot-starter</artifactId>
         <version>1.1.22</version>
   </dependency>

ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration…

ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property ‘log4j2.debug’ to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2

This text probably means that there is no Log4j 2 configuration file
Create a new Log4j 2.xml file and paste the code of this text in the file, then run the file and it’s OK

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
        </Console>

        <RollingFile name="RollingFile" filename="log/test.log"
                     filepattern="${logPath}/%d{YYYYMMddHHmmss}-fargo.log">
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB" />
            </Policies>
            <DefaultRolloverStrategy max="20" />
        </RollingFile>

    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="Console" />
            <AppenderRef ref="RollingFile" />
        </Root>
    </Loggers>
</Configuration>

JAVA Error: package org.apache.commons.codec.binary does not exist

I added commons-codec-1.4.jar in my project file and added 

 

import org.apache.commons.codec.binary.Base64;

But whenever I build it it will give me an error: The package org.apache.commons.codec.binary does not exist.
Why does it not work?

I also faced the same problem.
Solved this problem by adding commons-codec.jar 

You can download it from http://mvnrepository.com/artifact/commons-codec/commons-codec/1.7

JAVA Error Illegal access: this web application instance has been stopped already. Could not load net.sf

This exception occurs when you restart tomcat, but it does not affect the normal function.

Exception code:

Message: Illegal access: this web application instance has been stopped already.  Could not load net.sf.ehcache.store.disk.DiskStore$KeySet.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1776)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734)
	at net.sf.ehcache.store.disk.DiskStore.keySet(DiskStore.java:521)
	at net.sf.ehcache.store.disk.DiskStorageFactory$DiskExpiryTask.run(DiskStorageFactory.java:828)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

Exception analysis: restart Tomcat repeatedly and frequently, resulting in the thread in the last tomat not closing normally
solutions:

Change the reloadable in server.xml in Tomcat from true to false.

After setting reloadable = “true”, Tomcat will monitor the source code of the project in real time, and restart the Tomcat server in case of any change. When debugging a program, relaodable = true is usually not set. It is unreasonable to restart Tomcat frequently. If you set reloadable = false, or do not set this property, only when you add, delete or rename method or instance fields, do you require the service to restart, which is suitable for you to debug programs.

File settings: server.xml & gt; reloadable=“false”。

JAVA ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit erro

When running the program is suddenly the following exception occurs

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [util.c:840]

The reason:

1.JDK1.6.1
2. There is an error in the last debugging code, which causes the process not to terminate and take up the Console output, and such error occurs when starting debugging later.

Solutions:

At the end of the program, the main() function adds: System.exit(0);
System.exit(0); will cause the program to be terminated immediately, and if there are threads in the program that are still executing tasks, subsequent tasks will not be able to continue.

 

Java command line uses a JNI error has occurred, please check your installation and try again

Error: a JNI error has occurred, please check your installation and try again
exception in thread “main” java.lang.UnsupportedClassVersionError : Demo has been compiled by a more recent version of the Java Runtime (class file version 55.0), This version of the Java runtime only recognizes class file versions up to 52.0

solution:
jre8u164 was installed once before in the system, and jdk11.0.2 was installed without uninstalling. It is estimated that there is a conflict. Just delete jre8u164.

Extended content

For the concepts and differences of JDK, JRE, Java se, Java EE and java me, please refer to https://www.cnblogs.com/In-order-to-tomorrow/p/3652315.html

[How to Fix]No executorfactory found to execute the application

Error information

Cause of error

Starting from Flink 1.11, the dependency of flink-streaming-java on flink-clients has been removed and the clients dependency needs to be added manually.

How to Fix

Modify the POM file and add the Flink clients dependency

 <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-clients_2.12</artifactId>
        <version>1.12.2</version>
 </dependency>

Java error: unable to find or load main class (package name in source file)

1. Problem orientation

This type of error occurs when compiling (javac) and executing (Java) Java programs: the main class cannot be found or loaded:

First of all, the problem caused by improper configuration of environment variables is excluded. As long as the command line interface can recognize javac / Java commands, there is no problem with the configuration of environment variables. This problem often occurs because there is a package name in the Java source file, such as the file C:: code\ Hello.java :

package com.example;

public class Hello{
    public static void main(String[]args){
        System.out.println("Hello");
    }
}

It seems that there is no problem

C:\code>javac Hello.java
C:\code>java Hello
Error: Main class not found or could not be loaded Hello

2. Solutions

Delete the package name from the source file (not recommended); create a file path structure with the same package name under code (C:: – Code ⁃ com ⁃ example)\ Hello.java )

Compilation:C:\code>javac com/example/Hello.java
Run:C:\code>java com.example.Hello

A JNI error has occurred, please check your installation and try again

1. The question is:
A JNI error has occurred once again, please check your installation and try again

 
2. Analysis:
The JDK was installed repeatedly and there were different versions on the computer
 
3. Solution:
The command line through “Java-version” and “Javac-version” query SDK version
Delete the unwanted version (uninstall in the control panel)
(3) Adjust the environment variable to leave the JDK related information
Recompile to see whether there is still an error
 
4. The validation:
Javac is the same version as the Java directive