Tag Archives: idea

[Solved] Command line is too long. Shorten command line for XXXXXXXTest.rmLogRecordOver Error running

The following error is reported when the test case is started:

Command line is too long. Shorten command line for XXXXXXTest. or also for JUnit default configuration?
Error running ‘XXXXXXXXXX.rmLogRecordOverDue’:

Error:Command line is too long
Solution 1:
Modify workspace.xml file,  add the following in <component name="PropertiesComponent">:

<property name="dynamic.classpath" value="true" />

It is also possible that the configuration file cannot be modified and will be automatically deleted after modification, so you can see solution 2

Solution 2:

Modify the startup scheme of local test cases as jar

select

finally select jar mainfest to start

Using Post no Body Error: socket hang up [How to Solve]

Project scenario:

Due to environmental problems, the server is only allowed to use the post and get methods to call the interface. The delete interface written using the post method can be called locally, but an error is reported in the server.


Problem description

Use the post method for logical deletion and error reporting, and use @pathvariable to obtain the front-end transmission parameters:

@PostMapping("/delete/{userGroupIds}")
public ResponseBean<Object> deleteUserGroup(@PathVariable("userGroupIds") String userGroupIds){
    return userGroupService.deleteUserGroup(userGroupIds);
}

When using postman to call the server interface, the following error messages appear:

The front-end page calls the interface and reports the following error, cross domain:


Cause analysis:

The post method needs to use @Rquestbody to obtain parameters. This problem occurs when null is passed. The specific details were not clarified.


Solution:

Change the @pathvariable method to @rquestbody .

@PostMapping("/delete")
public ResponseBean<Object> deleteUserGroup(@RequestBody UserGroupIdDTO userGroupIds){
    return userGroupService.deleteUserGroup(userGroupIds);
}

The parameters in UserGroupIdDTO are as follows:

@Data
public class UserGroupIdDTO {
    private String userGroupId;
}

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could [Solved]

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Error Messages:

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

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

 

Solution:

You need to add a configuration in your project’s POM file

<build>
	<resources>
        <!-- Resolving mapper binding exceptions -->
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.yml</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
        <!-- Resolve profile exceptions such as data source not found -->
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.yml</include>
            </includes>
        </resource>
    </resources>
</build>

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] Could not resolve placeholder ‘XXX‘ in value “${XXX}“

Problem overview:

The code is determined to be bug-free, but it cannot run after switching to a new environment or git from a remote warehouse.

Development environment:

IDEA

reason:

Because idea may have problems recognizing folder types. Especially when there are many switching spaces, GIT codes and new modules. We just need to set the folder type correctly.

Solution:

Set the Resources folder as a resource folder. If there are problems with other folders, the same is true.

After setting, the folder icon changes, indicating success.

IDEA was Filed to Start: error launching idea (Failed to create JVM )

Failed to start idea

reason:

There is a problem with the configuration file

Solution:

Find the path where idea loads the cache

C:\Users\chen\AppData\Roaming\JetBrains\IntelliJIdea2021.2

Set idea64 exe. The vmoptions parameter is adjusted reasonably, and the error parameters are removed.

You can start successfully!!!

Idea create Maven project Error: [error] no longer supports source option 1.5. Please use version 1.6 or higher, and the idea reports an error: error: Java does not support the error of release version 5

Project scenario:

As soon as the Maven project changes the POM file, the language level automatically becomes 5

Problem Description:

question 1: the Tomcat plug-in under move starts with an error
[error] the source option 1.5 is no longer supported. Please use version 1.6 or later
[error] target option 1.5 is no longer supported. Please use version 1.6 or later
idea error: error: Java does not support release version 5. This error


Cause analysis:

Maven is a project management tool. If you don’t tell it what JDK version to use for code compilation, it will be handled with the default JDK version of the compilation plug-in Maven compi ler plugin, which is prone to version mismatch, which may lead to failure of compilation


Solution:

to avoid this situation, the first step when building a maven project is to configure the Maven compiler plugin in the project POM XML file specifies the JDK version of the project source code, the compiled JDK version, and the encoding method

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>9</source>
          <target>9</target>
          <encoding>utf-8</encoding>
        </configuration>
      </plugin>


[Solved] IntelliJ idea error: error: Java does not support release 5

Method 1

1. Confirm to configure Maven

Find the path in Maven home path and find the Maven address \ conf \ setting xml

Select your own JDK version

<profile>
      <id>development</id>
      <activation>
        <jdk>1.8</jdk>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>

Restart idea

Method 2

In project POM Specify the JDK version in the XML file

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>