Tag Archives: back-end

[Solved] Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException Error Messages:

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
	at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ~[mysql-connector-java-8.0.13.jar:8.0.13]
	... 9 common frames omitted

In fact, this error message is to use version 5.1.33 of MySQL JDBC Driver with UTC time zone. Servertimezone must be explicitly specified in the connection string.

Properties configuration file before modification:

server.port=8080

#jdbc
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/testdb09
spring.datasource.username=root
spring.datasource.password=root

#MyBatis
mybatis.mapper-locations=classpath:com/test/dao/*.xml
mybatis.type-aliases-package=com.test.domain

After modification

server.port=8080

#jdbc
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/testdb09?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root

#MyBatis
mybatis.mapper-locations=classpath:com/test/dao/*.xml
mybatis.type-aliases-package=com.test.domain

Modify:

PHP artisan cache: clear command reports an error

Use the clear cache command when building projects with laravel version 5.7 or above:

php artisan cache:clear  

Sometimes, the following errors are reported:

“Failed to clear cache. Make sure you have the appropriate permissions”

The reason is that there are two directories. You need to create a new directory.

mkdir -p storage/framework/cache/data

You also need to set directory permissions  

chmod 777 /home/www/dir/bootstrap/cache && amp; chmod 777 /home/www/dir/bootstrap/cache/*

 

reference resources:

“Failed to clear cache. Make sure you have the appropriate permissions” in Laravel 5.7_ Yang level blog – CSDN blog

[Solved] JPA sett in parameter error: Java.lang.illegalargumentexception

[error]

Java.lang.illegalargumentexception: encrypted array valued parameter binding, but was expecting [java.lang.string (n/a)]
JPA user-defined query statement fills the placeholder of in() with parameter value, and an error is reported

[reason]

The parameter value I passed in is of array type, but the in parameter value of JPA does not support array

[solution]

When setting the in parameter, the passed in parameter must be of type list.

[Solved] Minio Error: javax.xml.stream.XMLStreamException: ParseError

Invocation of init method failed; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3]
Message: The tags preceding the root element in the document must be properly formatted.
Caused by: io.minio.errors.XmlParserException: null

Configuration file outgoing error
the 127.0.0.1:9001 port in the configuration is changed to 9000
the 9001 port is a command line operation, so this error is caused

Error creating bean with name ‘captchaController‘: Unsatisfied dependency expressed through field ‘c

Error creating bean with name 'captchaController': Unsatisfied dependency expressed through field 'configService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysConfigServiceImpl': Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
Check start Redis or not

[Solved] ERROR: While executing gem … (Gem::FilePermissionError)

Environment: MAC.

When learning rails, follow the official documents. Errors may be reported at this step

 gem install rails

ERROR: While executing gem … (Gem::FilePermissionError)

Even if sudo is used to force the installation, an error will be reported in the next step.

rails new blog

`auth_ data=’: couldn’t set additional authenticated data

Solution:

Installing Ruby under MacOS – 🎄 Adomikao Yu Yongjian

The reason for the error is that the MAC installs ruby in the/usr/bin directory by default. This directory has strict permissions, resulting in code execution failure. The solution is to use RVM to install ruby in the user directory without affecting the system environment.

[Solved] Openfegn Remote Call Error: java.lang.NullPointerException: null

Problem Description:

tip: version dependency is the worst problem


Solution:

Introduce spring cloud loadbalancer dependency

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    <version>3.0.3</version>
</dependency>

Due to the version problem, some must exclude ribbon dependencies from Nacos, otherwise the loadbalancer is invalid

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    <!--Client-side load balancing without Ribbon-->
    <exclusions>
        <exclusion>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
        </exclusion>
    </exclusions>
</dependency>

How to Solve shiro Set sessionIdUrlRewritingEnabled Error (jessionid Removed)

Project scenario:

When using Shiro for authority authentication, the login address always carries the jeonid automatically for the first access. Now it needs to be removed and cannot be displayed.

Problem Description:

First, I searched Baidu and found that most solutions are to set SessionManager when defaultwebsecuritymanager is injected. This method also needs Shiro 1.3.2 or above. Coincidentally, my 1.3.0 is definitely not good. Go to POM directly to change the version number
annotation method:

    @Bean
    public DefaultWebSessionManager sessionManager(){
        DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
        sessionManager.setSessionIdUrlRewritingEnabled(false);
        return sessionManager;
    }

    @Bean
    public DefaultWebSecurityManager securityManager(){
        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
        securityManager.setSessionManager(sessionManager());
        return securityManager;
    }

XML mode:

		<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
		<property name="sessionIdUrlRewritingEnabled" value="false"/>
	</bean>

	<!-- Shiro Security Manager -->
	<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
		<property name="sessionManager" ref="sessionManager"/>
	</bean>

Remember to add package scanning in XML mode.My:

<context:component-scan base-package="config" />

Then run the project and report the same error as before. Anyway, there is no getter method.

Cause analysis:

During debugging, it is found that there are three versions of Shiro in the project, and two are from other modules, so it doesn’t matter. However, during debugging, it is found that the number of lines is not matched. After downloading the source code, it is found that this.sessionidurlrewritingenabled = true; There are no breakpoints in this line, and then the rebuild project, MVN clean install, repackaging and restarting idea are all used, and then the breakpoints can be interrupted. However, after debugging starts, the breakpoint icon turns into a circle slash, which is not the Shiro version of my current project at all
finally, you can only guess whether there are problems with multiple versions at the same time.

Solution:

It is found that one of the three versions is very old 1.2.4, but there is no place to import the whole project. Then, according to the warehouse, it is still imported in the way of Shiro all, so the name is temporarily modified. After running the project, it can run as expected

Tinyint error: java.lang.NullPointerException… [How to Solve]

Tinyint error reporting record
I wrote the wrong set before, which is easy to use when it is written as setid, and then I changed it to setType to report an error, and then I transformed it down to byte. After the change, it will be null pointer. Below are the error reporting information and error reporting line position




Finally, change the position as follows. Change the type from integer to string to solve the problem
the specific principle is not clear. For the time being, record it first. A great God who knows the principle can leave a message. Thank you

Node.js Error: “Error: EBUSY: resource busy or locked, stat“

abnormal

Error: EBUSY: resource busy or locked, stat 'C:\swapfile.sys'
    at Object.statSync (node:fs:1536:3)
    at D:\NodeJs\node-demo\demo\world.js:7:24
    at FSReqCallback.oncomplete (node:fs:188:23) {
  errno: -4082,
  syscall: 'stat',
  code: 'EBUSY',
  path: 'C:\\swapfile.sys'
}

Node.js v17.1.0

error code

var fs = require('fs');

var rootPath = 'C:\\';
fs.readdir(rootPath, function (err, files) {
    for (var i = 0; i < files.length; i++) {
        var p = rootPath + files[i];
        var stats = fs.statSync(p);
        console.log(rootPath + 'Is it a directory:' + stats.isDirectory())
    }
});

Reason

Prompt error: EBUSY: resource busy or locked, stat indicates that the resource file is busy or locked, that is, the C:\swapfile.Sys file. But there is no such file in the C disk directory, even in the hidden file. But it can be found by opening everything software
is a system file.

Solution:

I don’t know how to solve it. The online solution seems to be invalid, so I can only block the file.

Correct code

var fs = require('fs');

var rootPath = 'C:\\';
fs.readdir(rootPath, function (err, files) {
    for (var i = 0; i < files.length; i++) {
        var p = rootPath + files[i];
        // Skip when encountering swapfile.sys file or System Volume Information directory
        if (p.endsWith('swapfile.sys') || p.endsWith('System Volume Information')) {
            continue;
        }
        var stats = fs.statSync(p);
        console.log(rootPath + 'Is it a directory:' + stats.isDirectory())
    }
});

ERROR c.z.hikari.pool.HikariPool:594 restartedMain HikariPool-1 -Exception

  [problem description]: when starting the springboot project, the following stack error is reported

32.014 ERROR c.z.hikari.pool.HikariPool    :594  restartedMain                    HikariPool-1 - Exception during pool initialization.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:833)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
        at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158)
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116)
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:330)
        at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.isEmbedded(EmbeddedDatabaseConnection.java:184)
        at org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer.isEmbeddedDatabase(DataSourceScriptDatabaseInitializer.java:64)
        at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.isEnabled(AbstractScriptDatabaseInitializer.java:87)
        at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.initializeDatabase(AbstractScriptDatabaseInitializer.java:74)
        at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.afterPropertiesSet(AbstractScriptDatabaseInitializer.java:65)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at com.abc.wiki.WikiApplication.main(WikiApplication.java:19)
        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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
        at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
        at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823)
        ... 42 common frames omitted
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
        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 com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
        ... 45 common frames omitted

[cause of problem]: when debugging the project locally today, the WiFi connected to the computer changed, resulting in the change of IP, which finally led to this problem.

[solution]: modify the configuration of the project connection database to a new IP address.