Tag Archives: intellectual idea

IDEA Maven Fail to Download Dependencies Error: ERROR – #org.jetbrains.idea.maven – Cannot reconnect.

Full Error Log:

2022-09-29 16:35:52,637 [  41134]  ERROR -      #org.jetbrains.idea.maven - Cannot reconnect. 
java.lang.RuntimeException: Cannot reconnect.
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
	at org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:526)
	at org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:394)
	at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:103)
	at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:62)
	at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:655)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:555)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.doAdd(MavenProjectsTree.java:500)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:461)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.updateAll(MavenProjectsTree.java:432)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessorReadingTask.perform(MavenProjectsProcessorReadingTask.java:60)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:132)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:32)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:107)
	at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:449)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.rmi.RemoteException: Cannot start maven service; nested exception is: 
	java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: 
	java.net.ConnectException: Connection refused: connect
	at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:161)
	at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:66)
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
	at org.jetbrains.idea.maven.server.MavenServerManager.lambda$applyProfiles$3(MavenServerManager.java:526)
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
	... 20 more
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: 
	java.net.ConnectException: Connection refused: connect
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
	at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
	at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
	at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
	at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
	at com.intellij.execution.rmi.RemoteProcessSupport.lambda$acquire$2(RemoteProcessSupport.java:260)
	at com.intellij.openapi.util.ClassLoaderUtil.runWithClassLoader(ClassLoaderUtil.java:66)
	at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:231)
	at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:258)
	at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:164)
	at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:158)
	... 24 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at java.net.Socket.<init>(Socket.java:434)
	at java.net.Socket.<init>(Socket.java:211)
	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
	... 34 more

Solution:
1.IntelliJ IDEA –> Preferences –> Build,Execution,Deployment –> Build Tools –> Maven –> Importing –>JDK for importer select the JDK version that We installed

If the problem is not solved, perform the following two actions
2.maven -> Importing -> VM options for importer
-Xmx768m -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Djava.net.preferIPv4Stack=true

3. maven -> Runner -> VM Options
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Djava.net.preferIPv4Stack=true

Here the JRE originally selected Project JDK, I changed to JAVA_HOME, I do not know if there is no effect, and finally is successful without error.

[Solved] Error launching IDEA: Failed to create JVM. JVM Path…

Error launching IDEA

This error is actually a modification of the /idea64.exe.vmoptions file, but you add something he can not recognize

Solution:

The solution is very simple to \idea64.exe.vmoptions in your added delete on it!

But note that in case you really do not know what you have added, you can add a pause to the end of the idea.bat file, you can know is not recognized that sentence

Then run it, find it and go to \idea64.exe.vmoptions file to delete it.

As for how to find this file, I learned is in the idea installation path of the bin, and then after a series of operations, even with other people’s configuration directly replace the file did not work, and finally Kung Fu does not bear any responsibility, in my efforts to learn that there is an identical file in the C disk, we need to modify the C disk files

[Solved]Error:java: Compilation failed: internal java compiler error

When you use Idea to import a new project or upgrade an idea or create a new project, the following exception information appears:

Error:java: Compilation failed: internal java compiler error 

This error is mainly caused by the jdk version. There are two reasons: the compiled version does not match, and the current project jdk version does not support it.

Solution:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

[Solved] springsecurity custom exceptions: Error: Parse Error: Response overflow

preface

In the process of writing the project, using springsecurity for permission management and customizing the token filter to be added before the authentication filter, there was a problem where the exception handling mechanism of springsecurity would be called when the token expired, instead of using my global exception handling

Solution:

Custom filter

package com.fruiter.filter;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.jsonwebtoken.ExpiredJwtException;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Handling exceptions thrown by Controller will be handled by this filter
 */
public class ControllerExceptionFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        try {
            filterChain.doFilter(request, response);
        } catch (ExpiredJwtException e) {
            e.printStackTrace();

            response.setStatus(401);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
            response.getWriter().print("token过期");
        }
    }

    public String convertObjectToJson(Object object) throws JsonProcessingException {
        if (object == null) {
            return null;
        }
        ObjectMapper mapper = new ObjectMapper();
        return mapper.writeValueAsString(object);
    }
}

Join for management

//WebAsyncManagerIntegrationFilter is the first exception handling filter
http.addFilterBefore(new ControllerExceptionFilter(), WebAsyncManagerIntegrationFilter.class);

be careful

Here, set the status code for response, that is, response.setStatus(401);
you can’t set an excessively large number such as 10010, otherwise an error will report error: parse error: response overflow

Modify it to 401.

[Solved] Idea Failed to recognize Maven and Project Error

All the data packages of the open project are red, and the startup reports an error. Don’t panic when you encounter such a situation.

(this is only useful for the downloaded jar package project. If the project is newly opened, you need to download the Maven file)

click File in idea > Invalideate Caches…/restart clear cache and restart

Clear and restart the project

Maven Project Right-Click -update project Error [How to Solve]

Maven project, right-click -update project after the error reported the following solution:

1.Description ResourcePathLocationType

Java compiler level does not match the version of the installed Java project facet.SSMDemo Maven WebUnknownFaceted Project Problem (Java Version Mismatch)

2.Description ResourcePathLocationType

JAX-RS (REST Web Services) 2.0 requires Java 1.7 or newer.SSMDemo Maven Webline 1Maven Java EE Configuration Problem

3.Description ResourcePathLocationType

One or more constraints have not been satisfied.SSMDemo Maven Web line 1Maven Java EE Configuration Problem

 

Solution: Add the following codes in pom.xml

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7(Modify to your own JDK version)</source>
<target>1.7(Modify to your own JDK version)</target>
</configuration>
</plugin>
</plugins>

 

[Solved] Mybatis Error: Resources.getResourceAsStream(resource) cannot find the method

Problem Description: mybatisdemo.java
when loading the core configuration file of mybatis and obtaining SqlSessionFactory, the getResourceAsStream() method is marked in red, and the idea indicates that there is no such method.

1, Load the core configuration file of mybatis and get the SqlSessionFactory
    String resource = "mybatis-config.xml";
    InputStream inputStream = Resources.getResourceAsStream(resource);
    SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
    
Error:Cannot resolve method ‘getResourceAsStream‘ in ‘Resources‘

Solution: import import.org.apache.ibatis.io.Resources

~~

If the error is still reported, it will display: org.apache.ibatis.io does not exist, check the setting information of Maven.

1. First, open the installation root directory of Maven and find settings.xml

Set up the storage repository in settings.xml:
<localRepository>E:\maven\apache-maven-3.6.1\mvn_repo</localRepository>

2. Enter the IDE and make settings
File-Settings-Build,Execution,Depolyment-BuildTools-Maven
take the following configuration as an example:

At this time, the problem was solved!

[Solved] IDEA java compile error: Error:java: Compilation failed: internal java compiler error

There are two possible cases of error: Java: compilation failed: internal java compiler error.

1. The JDK version may be inconsistent

Check whether the following three parts are consistent.

Preferences -> Compiler -> Version setting SDK version in Java compiler

File -> Project Structure -> SDK version in project

File -> Project Structure -> Module -> Module SDK version in each module dependencies

2. The memory setting of the compilation environment may be insufficient.

Preferences -> Compiler -> Shared build process heap size

Increase the default memory of 700M.

[Solved] Maven Startup Error: Malformed \uxxxx encoding

Problem Description:

The project started well in the morning, but not in the afternoon 😂 What is this situation… At first, the project could not be started because the HTTP resources would be filtered out after Maven version 3.8.1. Later, it was still impossible to change HTTP to HTTPS,

The best way is to modify the Maven version. I changed it to Maven version 3.6.3. After that, I can download the package. However, it didn’t take long before there was another problem. Malformed \uxxxx encoding.

Let’s start with this error report today: malformed \ uxxxx encoding (the problem encountered today has been solved for half an afternoon and the reason has finally been found…)

Solution Summary:

First of all, the solutions are nothing more than the following:

1, first check the project .properties, .yml, pom.xml, logback and other configurations, whether there is a path error in the use of

2, update the maven repository, re-download the jar package

3, delete the path-to-the-library or resolver-status.properties file

In either case, it is recommended to restart the editor. For idea, click the Invalidate Caches/ Restart button to clear the cache and restart the idea

After opening IDEA and updating the project to start.

1, suddenly found build failure reported a strange error: Malformed \uxxxx encoding.

2. The <project> tag in the pom.xml file is also marked in red with the error.

But but but the code in the pom is exactly the same as on master, others are fine, but not their own, some of the import classes in the file will also report an error Can’t find.

Reason: When updating the jar packages that the project depends on, the downloaded jar packages may be incomplete due to network problems.

Solution: Delete the downloaded jar package and download it again.

In fact, it is not necessary to delete and re-download the package in general, so I think there must be a way to find the problematic package. To do accurate deletion

The quick solution is:

# Use the -X parameter to type out the error file information
mvn pakage -X
# Check the log, then delete or change the name of the file with the error to something else
# This will allow you to re-download the wrong file

I solved this problem through method 3

(1) In the . /m2/ folder (modify as you see fit), find path-to-the-library and delete it (if this file is not present, you can simply ignore this step).
(2) In the . /m2/repository (modify according to your situation) folder, search globally for the file: resolver-status.properties, delete all the files found, and recompile.

[Solved] IDEA jsp File Error: pageContext.setAttribute(“APP_PATH“,request.getContextPath());

IDEA jsp file report an error:

pageContext.setAttribute(“APP_PATH“,request.getContextPath())

 

Solution: import the jar package

<!-- https://mvnrepository.com/artifact/javax.servlet/jsp-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

[Solved] Failed to load resource: the server responded with a status of 404 ()

Failed to load resource: the server responded with a status of 404 ()

There is a problem with server compilation. Some resources are not compiled in the server compilation and packaging, resulting in no accessed resources in the server.

Solution:

1. Put the resources that cannot be scanned into the corresponding location of the out folder

For example:

Put the folder at (1) on (2)

Method 2:

Repackage