Tag Archives: intellectual idea

[Solved] IDEA: Internal error (java.lang.UnsupportedClassVersionError)

After creating a spark project and testing a “hello word”, I encountered the following error:

Internal error (java.lang.UnsupportedClassVersionError): org/intellij/erlang/jps/model/JpsErlangModelSerializerExtension 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
java.lang.UnsupportedClassVersionError: org/intellij/erlang/jps/model/JpsErlangModelSerializerExtension 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: Close the Erlang plugin and restart IDEA
Steps: Intel iJ IDEA -> Preferences -> Pluglinis -> (search Erlang) Remove the checkbox

Referencehttps://youtrack.jetbrains.com/issue/IDEA-256900

[Solved] Spring Boot Startup Error: Failed to load property source from location ‘classpath:/application-dev.yml‘

Application.yml file format problem

If your project has no configuration errors and the configuration file name is normal, and you still have this problem, it must be a problem with the encoding of your yml file.

Because the encoding format of this file is GBK, the encoding format of the project is UTF-8, there are comments in it, and the comments are garbled, which leads to compilation failure.

Solution:

IDEA open path: File –> Settings –> File Encodings, then change the format of /application.yml to the same as the project, i.e.: UTF-8.
To be on the safe side, change “Project Encoding” to UTF-8 as well.
Restart IDEA, then start the project, OK.

Translated with www.DeepL.com/Translator (free version)

Vue Browser Error: Failed to load resource: the server responded with a status of 404 (Not Found)

When you create a maven project in idea and use Vue to modify the content in HTML, you find that the HTML page is not modified successfully. F12 opens the background and displays an error: failed to load resource: the server responded with a status of 404 (not found). The browser does not find Vue JS file
reason:
(1) maven project to introduce vue.js file after the project needs to be packaged, double-click the package button.

(2) Since the vue.js file is stored in a static resource, check whether the project’s configuration file springMVC.xml opens access to the static resource.

After completing the above steps, the browser F12 background shows that vue.js was successfully fetched and the page content was successfully modified!

[Solved] Error creating bean with name ‘mvcContentNegotiationManager‘: Lookup method resolution failed

Recently, I encountered various strange exceptions when I used idea to build an aggregation project. Here is an exception reported by the operation of its sub module:

The prompt of exception information is:

Error creating bean with name ‘mvcContentNegotiationManager’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean] from ClassLoader [sun.misc.Launcher$ AppClassLoader@18b4aac2 ]

Solution 1:

Check whether the POM file of the sub module depends on the parent class. Of course, many people will find that when wearing the submodule, the POM file of the sub module will automatically depend on the parent class (as shown in the figure below)

If the dependency in the above figure is not automatically generated after inspection, and you have the same exception as me, then the parent project dependency is added to solve the exception with a high probability

After consulting relevant posts on the Internet and repeated experiments for many times, I found that:

This bug is because we created a module with the same name before, and then we removed it. Then we automatically generate webapp module through the skeleton, so that the module generated by the skeleton will completely overwrite your original POM file!!!

Unfortunately, you need the parent project dependency to start the project, then you will have this bug!

The safest and most reliable solution to avoid problem reproduction: check the dependency of POM file every time you create a sub module. If not, solve it manually

Of course, there are various online solutions, but I have tried and found that it can temporarily solve the problem, but it will still be overwritten the next time I use the skeleton to generate a module with the same name

Solution 2 (slightly reliable):

Setting — build — Maven — ignored files, cancel the ignored POM file, and the parent project dependency will be automatically added!

Summary:

The root cause is that we have created modules with the same name before, but they are not really removed There is still a lot of information about deleting modules in the idea, so when creating a new module, the idea will automatically ignore the new module with the same name we wrote

Of course, a large part of the impact is because we use automatic skeleton generation!

[Solved] IDEA Start Maven Project Error: “Error starting ApplicationContext. To display the conditions report …”

When IDEA starts a maven project, it fails to start and displays an error reporting:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2021-12-22 09:21:42.183 ERROR 14964 — [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
***************************
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 (the profiles local are currently active).

Cause:
The datasource related package environment is referenced, but no related configuration is performed

Solution:
1, start the class to add automatic configuration parameters: (exclude = {DataSourceAutoConfiguration.class})

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class ApiserviceApplication {

    public static void main(final String[] args) {
        SpringApplication.run(ApiserviceApplication.class, args);
    }
}

2. If the code does not use the relevant package environment, the relevant Maven package can be deleted

<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-data-cassandra-jpa</artifactId>-->
<!--        </dependency>-->

3. If used, add relevant configurations

IDEA pom.xml dependency version error [How to Solve]

Self problem solving record, tossed all morning and finally solved:

I tried other solutions first, but there was no response. You can still try:

1. Modify the Maven version number, download the old version again, configure the environment variables, and install cleanLastUpdated.bat small script to clear the package that has not been downloaded successfully/completely. It is useless

Share this script:

Copy to Notepad and save the file as cleanLastUpdated.bat, select the file format as all file formats.

set REPOSITORY_PATH=Absolute path to your own local repository
rem is searching...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
    del /s /q %%i
)
rem search completed
pause

2. Re-check other configurations in settings \ Maven and check these two again. It’s useless

3. Final solution

I went to the local warehouse and found that the jar package had been downloaded, but it was inconsistent with the version number that my pom.xml relied on, so the modification was over.

[Solved] IDEA globally replace yml Error: you have entered malformed replacement

Problem Description: because the YML configuration file needs to be replaced uniformly in the microservice project, but the replacement string contains’ $’, the editor reports an illegal format error.

Solution:

Just transfer the ‘$’ symbol and add the escape character ‘\’ in front of it: http://nacos-headless \.\${info.namespace}\.svc\.cluster\.local:8848

[Solved] IDEA plug-in jrbel hot deployment cannot be started error

The idea plug-in jrbel hot deployment fails to start, and an error is reported: jrebel JVMTI [fat] a fatal error occurred while processing the base Java classes The JVM has been shut down (1).

due to JDK charges, openjdk has been replaced. Recently, it cannot be used due to hot deployment. The reason for the error is the openjdk problem. Maybe the openjdk file has been rewritten. Just replace it with another JDK.