Category Archives: JAVA

JNI ERROR (2354): JNI connection is NULL [How to Solve]

JNI error (2354) encountered by tdengine during springboot integration: JNI connection is null
possible problems are as follows
1. The client version of tdengine is inconsistent with the server version
2. The server version and jdbc driver version are not matched. The following figure shows the version correspondence figure

[JVM] stack overflow error stackoverflowerror [How to Solve]

Stackoverflowerror is an error, not an exception.

Method is placed in the stack space. By default, it is only 512k-1024k. By making recursive calls, you can fill up the stack space.

public class StackOverFlowErrorDemo {
    public static void main(String[] args) {
        // Exception in thread "main" java.lang.StackOverflowError
        stackOverflowError();
    }

    private static void stackOverflowError() {
        stackOverflowError();
    }
}

Java.lang.stackoverflowerror error [How to Solve]

I just started learning Java. If something is wrong, please show mercy
when practicing Maven’s integrated SSM framework, a java.lang.stackoverflowerror error occurs when performing multi condition query. Generally, this error is due to the problem of dead loop or recursion, but I do not use loop and recursion. The error is shown in the figure, It calls a method of servie to find all the data in a table from mapper

examination was found to be a very low-level mistake. I injected it wrong, injected myself into the service, and then invoked my own method, resulting in an overflow error. 
after injecting mapper, it runs successfully

[Solved] Error: caused by: java.net.bindexception: the address is already in use

Error Message:

08:35:28.542 [main] INFO  o.a.c.h.Http11NioProtocol - [log,173] - Destroying ProtocolHandler ["http-nio-8088"]
08:35:28.545 [main] ERROR o.s.b.SpringApplication - [reportFailure,826] - Application run failed
org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:212)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:296)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.ruoyi.InterphoneApplication.main(InterphoneApplication.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:244)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:265)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:196)
... 18 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1067)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:240)
... 20 common frames omitted
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:228)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:211)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1159)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1245)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:603)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1064)
... 22 common frames omitted
08:35:28.551 [main] INFO  o.q.c.QuartzScheduler - [shutdown,666] - Scheduler RuoyiScheduler_$_yuren1629419725223 shutting down.
08:35:28.552 [main] INFO  o.q.c.QuartzScheduler - [standby,585] - Scheduler RuoyiScheduler_$_yuren1629419725223 paused.
08:35:28.552 [main] INFO  o.q.c.QuartzScheduler - [shutdown,740] - Scheduler RuoyiScheduler_$_yuren1629419725223 shutdown complete.
08:35:28.552 [main] INFO  sys-user - [shutdownAsyncManager,31] - ====Close the background task task thread pool====
08:35:28.553 [main] WARN  o.s.c.a.CommonAnnotationBeanPostProcessor - [postProcessBeforeDestruction,185] - Destroy method on bean with name 'shutdownManager' threw an exception: java.lang.ExceptionInInitializerError
08:35:28.555 [main] INFO  c.a.d.p.DruidDataSource - [close,2043] - {dataSource-1} closing ...
08:35:28.559 [main] INFO  c.a.d.p.DruidDataSource - [close,2116] - {dataSource-1} closed
Exception in thread "Quartz Scheduler [RuoyiScheduler]" org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler after delay; nested exception is org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:754)
Caused by: org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:529)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:142)
at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:751)

 

Reason:
[root@yuren interphone]# ps -ef|grep interphone-admin.jar
root     29204 28182 10 08:34 pts/0    00:00:26 java -jar interphone-admin.jar
It’s already running
java -jar ***.jar When the log comes out, pressing enter doesn’t actually end the process, so starting it again will report this error. After reinstalling jdk, it must not be running anymore, and it must be OK to start the project again.

Solution:
ps -ef|grep ***.jar to find the process number
Kill the process, then restart the project.

Using java to call Jython, the error URI is not hierarchical

IllegalArgumentException: URI is not hierarchical] with root cause
java.lang.IllegalArgumentException: URI is not hierarchical
	at java.io.File.<init>(File.java:418)
	at org.python.core.PrePy.getJarFileNameFromURL(PrePy.java:427)
	at org.python.core.PrePy._getJarFileName(PrePy.java:362)
	at org.python.core.PrePy.getJarFileName(PrePy.java:345)
	at org.python.core.PySystemState.doInitialize(PySystemState.java:1195)
	at org.python.core.PySystemState.initialize(PySystemState.java:1130)
	at org.python.core.PySystemState.initialize(PySystemState.java:1085)
	at org.python.core.PySystemState.initialize(PySystemState.java:1080)
	at org.python.core.PySystemState.initialize(PySystemState.java:1075)
	at org.python.core.PySystemState.initialize(PySystemState.java:1070)
	at org.python.core.ThreadStateMapping.getThreadState(ThreadStateMapping.java:56)
	at org.python.core.Py.getThreadState(Py.java:1741)
	at org.python.core.Py.getThreadState(Py.java:1737)
	at org.python.core.Py.getSystemState(Py.java:1757)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:100)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:93)
	at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:70)
	at com.example.kimnara.controller.KafkaProducer.invokPy(KafkaProducer.java:138)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)

Remote breakpoint discovery through idea
the URL found is as follows: jar: File:/D:/Maven/apache-maven-3.3.9/repository/org/python/jython/2.7.2/jython-2.7.2.jar/ Org/Python/core/prep.class
nesting cannot be used
solution: Jython will be eliminated when Maven is packaged; Just load the external jar package at runtime.

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <layout>ZIP</layout>
                    <excludeGroupIds>
                        org.python
                    </excludeGroupIds>
                </configuration>
            </plugin>
        </plugins>
    </build>


java -Dloader.path=“lib/” -jar kimnara-0.0.1-SNAPSHOT.jar
The jar package placed inside the lib

Redis Startup Error: Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

Today, the redis service started in the window and reported an error:
Creating server TCP listening socket 127.0.0.1:6379: bind no error

The reason is that redis did not shut down normally after it was started;

The solution is as follows: enter the following commands in order to connect successfully

redis-cli.exe
shutdown
exit

Redis closes normally, exits, and then re-enter the command to start
redis-server.exe redis.windows.conf

OK!

Spring Project Error: Error creating bean with name [How to Solve]

This kind of mistake is always encountered when doing exercises recently

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.example.Demo2MybatisApplicationTests’: Unsatisfied dependency expressed through field ‘userDao’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.example.dao.UserDao’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

There is a long string of balabalabala at the beginning; There are many solutions on the Internet, and the problem I have is that I don’t add the annotation of package scanning

The @mapperscan (“interface path”) annotation is added to the spring startup class

Its function is to specify the package where the interface to become the implementation class is located, and then all interfaces under the package will generate corresponding implementation classes after compilation.

With this project, there will be no error that the bean is not found

Springboot integration shiro error: UnsatisfiedDependencyException: Error creating bean with name ‘getShiroFilterFact

Error content

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'getShiroFilterFactoryBean' defined in class path resource [com/gtlz/shiro/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'getShiroFilterFactoryBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityManager' defined in class path resource [com/gtlz/shiro/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'getDefaultWebSecurityManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userRealm': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.gtlz.shiro.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.9.jar:5.3.9]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-5.3.9.jar:5.3.9]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762) ~[spring-context-5.3.9.jar:5.3.9]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567) ~[spring-context-5.3.9.jar:5.3.9]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.4.jar:2.5.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.4.jar:2.5.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.4.jar:2.5.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.4.jar:2.5.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.4.jar:2.5.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.4.jar:2.5.4]
	at com.gtlz.shiro.ShiroApplication.main(ShiroApplication.java:12) [classes/:na]

The reason for my error is that the mapper package is not scanned by the startup class

Original code

@MapperScan(basePackages = { "com.gtlz.shiro.*.mapper" })

After modification

@MapperScan(basePackages = { "com.gtlz.shiro.mapper" })

The reason should be that there are no other packages outside my mapper package, so the scan failed. Please pay attention next time

[Solved] Error resolving template template might not exist or might not be accessible

Resolving error template template may not exist or may not be accessible

    1. there may be a problem with your controller annotation
    1. the difference between controller annotation and restcontroller annotation. Thymeleaf configures the corresponding path in the properties or YML configuration file
    1. about

      1. properties spring.web.resources.static-locations=classpath:/static/, classpath:/templates/ yml
	spring:
      thymeleaf:
        # thymeleaf The directory where the page is stored
        prefix: classpath:/templates/

Return path problem
there is no Maven clear in the return path

Error: unreachable statement [How to Solve]

Error: unreachable statement

The cause of this error is just like its name. The compiler will never execute it
the following situations will occur: unreachable statement:
(1) write a statement after the return statement
(2) write a statement after the throw statement
(3) define statements after the break and continue statements
(4) “\ u10100″// legal, equivalent to ‘\ u1010’ and string “0”
(5) the shift operator can be used for long int char short byte
(6) the access control character of a class can be public or nothing
(7) goto is a reserved word but not a keyword. Then is nothing
(8) when a superclass type is cast and assigned to an object of a subclass, there is no exception in compilation, but an exception will occur at run time
for example:

while(i<length&&len>0){
            if(strs[i].contains(com.substring(0,len))){
                continue;
                i++;
            }else{
                len--;
            }
        }

You can see that the position of I++ in this code is after its continue. After the compiler executes here, it will directly carry out the next cycle, and I++ will never execute.