Category Archives: JAVA

[Solved] org.springframework.context.ApplicationContextException: Failed to start bean ‘org.springframework.a


org.springframework .context.ApplicationContextException: Failed to start bean &#39 ;org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup

Errors reported when using RabbitMq to test switches and queues

Think hard

At first I thought it was the queue’s listener configuration information and listener code that were written wrong,I checked it repeatedly and there was no error.
Then continue to read the error ,there are these two errors,instant epiphany.

Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
Caused by: org.springframework.amqp. AmqpAuthenticationException: com. rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED

Suddenly realized

ACCESS_REFUSEDSuch a big word, I read it several times, but I didn’t expect this error, It is probably the wrong copy when configuring the password

    port: 5672
    virtual-host: /hotel
    username: hotel
    password: hotel

hotel was resolutely written as guest

Ok, change the password, successfully run, also warn everyone to be careful!!!

idea Error: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource


Error Message:



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


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:- [ ] List item
Just check the nacos port and change it to the port used by the project you are running.

How to Solve Image Upload Error: Uncaught (in promise) DOMException: Failed to execute ‘put‘ on ‘IDBObjectStore‘

I encountered a small problem in a recent project,when the system uploads pictures on the front-end page,the background reports 400 errors: Uncaught (in promise) DOMException: Failed to execute ‘put’ on ‘IDBObjectStore ‘: HTMLInputElement object could not be cloned.

Investigation ideas

  1. Analyze from the error 400,http status code is 400,bad request means it is a bad request,invalid hostname means the domain name does not exist. The cause of 400 is generally:
  • The field name or field type of the data submitted by the front-end is inconsistent with the entity class of the back-end, which cannot be encapsulated.
  • The data submitted by the front-end to the back-end should be of json string type, and the front-end has no conversion type.
    Since the back-end interface uses File to receive the picture, the file transmitted by the front-end through the form form, obviously has nothing to do with the parameter type.
  1. So breakpoint debugging at the Controller layer, found that the request did not enter the breakpoint at all, This is a bit strange.
    Roll back the code and repackage it for deployment, This picture can be uploaded normally.
  2. Change my way of thinking to find the answer from the code submission records, I browsed carefully, I found that a colleague submitted a filter, This is a bit relevant, Immediately click in to see the source code. After viewing, it was found that a filter, was added for the POST request, and the file stream was not excluded in the filte, which resulted in the file upload request being directly filtered out.


Exclude specific requested URLs in SpringBoot filters, example below:

@WebFilter(urlPatterns = "/*")
@Order(value = 1)
public class TestFilter implements Filter {
    private static final Set EXCLUDED_PATHS = Collections.unmodifiableSet(new HashSet(
            Arrays.asList("/login", "/register")));
    public void init(FilterConfig filterConfig) throws ServletException {
        //init filter
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        String path = request.getRequestURI().substring(request.getContextPath().length()).replaceAll("[/]+$", "&# 34;);
        boolean excludedPath = EXCLUDED_PATHS.contains(path);
        if (excludedPath) {
            // Exclude URLs that do not need filtering
            chain.doFilter(req, res);
        } else {
            // URL that needs to be filtered
            // TODO
    public void destroy() {
        // destroy filter

[2022 New Solution] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder

Problem introduction:

insert image description here

Problem Analysis:

According to the error message, we can know that the cause of the error is “failed to load the class file org.slf4j.impl.StaticLoggerBinder”, and the error mainly lies in the jar package of slf4j.

Official website explanation:

This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop .jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.



Add a dependency configuration of one of the above package files to the pom file of the Maven project, as follows:

<dependency span>>


[2022 New Solution] Error:java: Compilation failed: internal java compiler error

Error Reason

The reason for this error is mainly because of the jdk version problem, There are two reasons here, One is that the compiled version does not match, The other is that the current project jdk version does not support.

1:mac select Preferences

windows find Setting

Find Java Compiler

Select 1.8 on the right

2: Find File ->Project Structure->Project Settings

Choose 8

Choose 8

[Solved] nacos Error: failed to req API:/nacos/v1/ns/instance

2021-12-18 11:39:44.536 ERROR 26756 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, cs-qq-guild register failed...NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='xxxx:8848', endpoint='', namespace='xxxx', watchDelay=30000, logName='', service='xxx', weight=1.0, clusterName='DEFAULT', group='xxx', namingLoadCacheAtStart='false', metadata={appname=xxx, preserved.register.source=SPRING_CLOUD, version=0.0.1}, registerEnabled=true, ip='xxx', networkInterface='', port=5203, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null, failFast=true}}, Request nacos server failed: 
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	at ~[spring-cloud-starter-alibaba-nacos-discovery-2.2.7.RELEASE.jar:2.2.7.RELEASE]
	at [spring-cloud-commons-2.2.9.RELEASE.jar:2.2.9.RELEASE]
	at [spring-cloud-starter-alibaba-nacos-discovery-2.2.7.RELEASE.jar:2.2.7.RELEASE]
	at [spring-cloud-commons-2.2.9.RELEASE.jar:2.2.9.RELEASE]
	at [spring-cloud-commons-2.2.9.RELEASE.jar:2.2.9.RELEASE]
	at [spring-cloud-commons-2.2.9.RELEASE.jar:2.2.9.RELEASE]
	at [spring-cloud-commons-2.2.9.RELEASE.jar:2.2.9.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener( [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener( [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent( [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh( [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at [spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh( [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at org.springframework.boot.SpringApplication.refresh( [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext( [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]
	at com.yzycoc.discord.QqGuildApplication.main( [classes/:na]
Caused by: Client not connected,current status:STARTING
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	at ~[nacos-client-2.0.3.jar:na]
	... 25 common frames omitted

nacos can start normally, but the microservice can’t be registered, resulting in compilation errors
The previous day it worked fine, but today the above error appears in the startup

My side because the address of nacos is localhost:8848 as configured in application.yml
And the address of nacos we started is (why suddenly become this address? I don’t understand)


Modify nacos/conf/ file


2. If it doesn’t work, you can try to delete the nacos cache

Local cache directory default path: ${user.home}/nacos/naming/public

3. If you can’t do it, we recommend uninstalling and reinstalling.

[Solved] JPA query data error: Page 1 of 0 containing UNKNOWN instances

The reason for the error is that there is an empty object according to your query condition, that is, it is not checked. Then double-check the conditions you wrote.
I reported an error because the previous code used cb.equal(root.get(“userName”), res.getName()), which is an absolute query. I copied the previous code directly, but now I want to change it to a fuzzy query, cb.equal(root.get(“userName”), “%” + res.getName().trim() + “%”), here you can see that I only changed the parameter value to a fuzzy query, but the condition is still used equal absolute query reported an error, I searched for more than half an hour to find, and then changed to“userName “), “%” + res.getName().trim() + “%”) and it works.

Specification<TUser> specification = (root, query, cb) -> {
            List<Predicate> predicates = Lists.newArrayList();
            predicates.add(cb.or(cb.equal(root.get("role"),, cb.equal(root.get("role"),;
            //Add name condition
            if (res.getName() != null) {
                predicates.add("userName"), "%" + res.getName().trim() + "%"));
            if (res.getPhoneno() != null) {
                predicates.add("phone"), "%" + res.getPhoneno().trim() + "%"));
            return cb.and(predicates.toArray(new Predicate[predicates.size()]));

To sum up, if you use absolute queries in the future, write it like this

//Add name condition
if (res.getName() != null) {
    predicates.add(cb.equal(root.get("userName"), res.getName().trim()));

Fuzzy queries are written like this.

//Add name condition
if (res.getName() != null) {
    predicates.add(cb.equal(root.get("userName"), "%" + res.getName().trim() + "%"));

This will not be wrong.

Also note that the paging inside the JPA, page is from 0, there is root.get(“property”), the name of this property is the name of the entity class inside, is this private String userName, this @Column(name = “user_name”) is the name of the database, do not get confused.

@Column(name = "user_name")
private String userName;

[Solved] Maven Project Packaging Error: Unable to find main class

I. Description of the problem

When I use the Maven aggregation project to package the parent project for packaging, I get an error :Unable to find main class which probably means that the main startup class cannot be found

insert image description here

2. How to Solve

The project contains modules of some tool classes, and the tool class modules do not need us to be started, It is only provided for other interface service references, No need to start means no main startup class, but the pom file of the parent project references the springboot packaging plugin spring-boot-maven-plugin, namely:

                <groupId>org.springframework.boot</ groupId>
                <artifactId>spring-boot-maven-plugin&lt ;/artifactId>
                            <groupId>org.projectlombok</groupId&gt ;

So when packaging, mvn will scan all dependent modules. If it finds that there is no main startup class under a module, it will report an error.

3. Solution

My solution is: Comment out the packaged plugin spring-boot-maven-plugin of the parent project and then package/install it

Insert picture description here
You can see that the packaging is successful

[Solved] IDEA Maven Error: Cannot resolve xxx & Maven Dependencies Error


Premise: Make sure the dependencies in Maven are correct, Don’t make mistakes such as missing letters.
If you are worried, you can go to the official website to search, and copy and paste it again.
Official website link:


Importing a new project,or other reasons,maven refresh is also useless, it reports error as show below:


1. First, Clear the cache, Click and restart IDEA.

2. Close IDEA, Open the project folder

Find .idea in the project, delete workspace.xml

3. Re-open IDEA, find Maven on the right

Double-click clean

Wait for the console to appear BUILD SUCCESS

Find install under maven again, Double-click it and the download log shown below will appear.

Wait it over, and BUILD SUCCESS will appear:

Click the Reload button in the Maven component again, wait for the bottom progress bar to end

4. Solve the Dependencis report in Maven

First, Open the file pom.xml

Then delete the content in the tag dependencies [recommended to use Ctrl + x]

Click the Reload button in the Maven component again, wait for the bottom progress bar to finish. [dependencies disappears at this time]

Then in pom.xml, use the shortcut key Ctrl + z to return

(If you are using Ctrl + x , you can use Ctrl + v to paste)

Let the dependencies content appear again,return to the previous state.

The last step: click the Reload button in the Maven component again, wait for the bottom progress bar to finish. [At this time,dependencies appears and no longer reports an error]

Final effect:

Finally, it is solved.

Gephi cannot find Java 1.8 or higher [How to Solve]

Previously installed Gephi and configured the Java environment, but not used for more than a year, recently opened Gephi reported an error:

cannot find Java 1.8 or higher

I followed the [online tutorial] to set the jdkhome variable in Gephi.conf as follows:

jdkhome="C:/Users/username/AppData/LocalLow/Oracle/Java/jdk11.0.9_x64& #34;

Another error was reported:

Cannot locate java installation in specified jdkhome

I read a bunch of posts on the Internet again, guess that my Java is not installed in the default path, but installed in the D drive, And the Gephi.conf file should only use Associate to the installation path of Java to, reconfigure:

jdkhome="D:/Program Files/JAVA sdk"

Gephi can be opened normally.

[Solved] Axis Failed to Import webService: No support for attachments

The client generated by Axis, Error when importing webService:

 faultCode: {}Server.userException
 faultString: java.lang.RuntimeException: No support for attachments
{}stackTrace:java.lang.RuntimeException: No support for attachments
at org.apache.axis.Message.setup(
at org.apache.axis.Message.&lt;init&gt;(
at org.apache.axis.transport.http.HTTPSender.readFromSocket(
at org.apache.axis.transport.http.HTTPSender.invoke(
at org.apache.axis.strategies.InvocationStrategy.visit(
at org.apache.axis.SimpleChain.doVisiting(
at org.apache.axis.SimpleChain.invoke(
at org.apache.axis.client.AxisClient.invoke(
at org.apache.axis.client.Call.invokeEngine(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(
at org.apache.axis.client.Call.invoke(

Problem Reason

Missing jars: mail.jar and activation.jar


Introduce dependencies