Tag Archives: java

Keytool error: java.io.FileNotFoundException : MyAndroidKey.keystore (access denied)

This is the problem I encountered when I used java keytool to generate certificates this afternoon

Cause error:

Keytool error: java.io.FileNotFoundException : MyAndroidKey.keystore (access denied)

Analyze the problem:

When the certificate is generated, the permissions are not enough when writing to disk C. The properties of all the directories under C disk are read-only.

terms of settlement:

Method 1:
the path of JDK is in disk C. you can move JDK to other disk letters.
Method 2:
this method is the simplest to open CMD as an administrator, so that the error will not occur when writing something.

IntelliJ idea error: error: Java does not support release 5

Recommended solution: thanks to another blogger in the comments area, Fu moon, for his solution: https://blog.csdn.net/qq_ 42583206/article/details/108375173   

If the problem is solved in the above way, it can be ignored below.    

—————————————————————————————————————————————————————————————————————————————–

A new Maven project is created in IntelliJ idea. The running error is as follows: error: Java does not support release 5

Jdk9 is used for local operation. When testing Java stream operation, the error should be that the Java version used in the project compilation configuration is wrong. You need to check the Java compilation version configuration used in the project and environment.

Click “file” – & gt; “project structure” in IntelliJ to see if the Java version in “project” and “module” columns is consistent with the local version

 

If not, change to the local java version.

Click “Settings” – & gt; “bulid, execution, deployment” – & gt; “java compiler”, and set the target bytecode version to the local java version. (you can configure project bytecode version to local java version once and for all in default settings)

Default Settings:

After the above two steps have been configured, the above error will not be reported after re running.

 

Once and for all reform through labor:

Thanks to another blogger in the comments area, fumion, for his proposal: https://blog.csdn.net/qq_ 42583206/article/details/108375173

Solve the previous one bean.xml “Error while downloading” in < bean > tag http://www.springframework.org/schema/beans/sprin…

In the XML file, the error in the header is as follows

At the beginning of the query, it was said that “& lt;?XML version =” 1.0 “encoding =” UTF-8 “?& gt;” was missing in the header, but I didn’t have this problem, which may be encountered by someone.

And this error does not affect the operation of the project, of course, it may be that I did not notice or did not write the relevant reference code.

Now I know that the original reason is that the tool is relatively new and may lack tags. Just add the & lt; XML body & gt; tag

That’s good

 

Reproduced in: https://www.cnblogs.com/zhangyuanbo/p/11250563.html

IntelliJ idea startup error: error statuslogger log4j2 could not find a logging implementation

The following error occurred when starting the project:

    ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console…

Reason: the jar package of log4j is not downloaded locally. Cause the startup error.

resolvent:

1. Find the log4j folder of local Maven warehouse and delete it.

2. Update Maven dependency and download the jar package of log4j again.

Select project — & gt; right mouse button — & gt; Maven — & gt; reimport

When using idea to start a project, an error is reported: Error:java : Compilation failed: internal java compiler error

When using idea to start a project, an error is reported: Error:java : Compilation failed: internal java compiler error

(1) Error reason: the setting in Java compiler is inconsistent with the Java version used in the current project.

(2) Solution: if Java 1.8 is used in the project, it should be set to 1.8 in Java compiler.

The settings are as follows:

References: Click to open the link

About error statuslogger no log4j2 configuration file found

Error statuslogger no log4j2 configuration file found. Using default configuration: logging only errors to the console

Create a new resources folder in the project and add the log4j2. XML file as follows

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
        </Console>
        <RollingFile name="RollingFile" fileName="logs/strutslog1.log"
                     filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
            <PatternLayout>
                <Pattern>%d{MM-dd-yyyy} %p %c{1.} [%t] -%M-%L- %m%n</Pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="1 KB"/>
            </Policies>
            <DefaultRolloverStrategy fileIndex="max" max="2"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Logger name="com.opensymphony.xwork2" level="WAN"/>
        <Logger name="org.apache.struts2" level="WAN"/>
        <Root level="warn">
            <AppenderRef ref="STDOUT"/>
        </Root>
    </Loggers>

</Configuration>

Select user entries in the classpath of the project corresponding to run – run configurations, click Advanced, and select add folder to add the Resources folder.

Error: could not create the Java virtual machine Error:A Fatal exception has occurred

The error report is as follows:

Prompt that the Java virtual machine could not be created successfully.

The main reason for the above error is that eclipse can’t find the JDK installed on the machine when it starts (if it doesn’t install, please go to Baidu installation tutorial to install it). At this time, we need to manually guide eclipse to load the JDK path.

Open the eclipse installation path and find the eclipse.ini File, pay attention to open the file suffix display, as shown in the following figure:

Open with Notepad + + and other text editing tools eclipse.ini File:

Add two lines of code out of the rectangular box in the file, pay attention to the path, fill in the bin directory under the JDK installation path of your own machine, save and restart eclipse. This problem can be solved.

Resourceaccessexception: I / O error on post request for and connection timed out

1. Cause of error:

When the resttemplate is used to call the third-party API, the local test is normal, but when it is deployed to the server, it will report: Dan, 19:06 org.springframework.web . client.ResourceAccessException : I/O error on POST request for "XXX": No route to host (Host unreachable); nested exception is java.net.NoRouteToHostException : no route to host (host unreachable) , at first, I thought that the timeout was not set, so I configured it through online methods

 SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
 requestFactory.setConnectTimeout(10*1000);
 requestFactory.setReadTimeout(10*1000);
 RestTemplate rest = new RestTemplate(requestFactory);	

Deployment or error

2. Solutions

Finally, the interface setting the timeout time is replaced with httpcomponentsclienthttprequestfactory to solve the problem successfully

 HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
 requestFactory.setConnectTimeout(10*1000);
 requestFactory.setReadTimeout(10*1000);
 RestTemplate rest = new RestTemplate(requestFactory);