Category Archives: Error

[Solved] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘deptController’: Unsatisfied dependency expressed through field ‘departmentMapper

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘deptController’: Unsatisfied dependency expressed through field ‘departmentMapper’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘departmentMapper’ defined in fileNo object can be created because
The problem is:
In springboot’s application.yml or application.properties can not use the following two configurations at the same time, in other words, only one of the two configuration methods can be taken.
mybatis:
config-location: classpath:mybatis/mybatis-config.xml
configuration:
map-underscore-to-camel-case: true

Solution: Comment out it.

[Solved] kafka Startup Error: Error: VM option ‘UseG1GC’ is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.

The node hung up the next day after the Kirin server installed Kafka

Prompt VM option ‘useg1gc’ is empirical and must be enabled via – XX: + unlockexperimentalvmoptions

Find this configuration directly and delete it
the configuration path is as follows:
/APP/Kafka/Kafka_2.12-2.8.0/bin/kafka-run-class.SH
after opening, find:
Kafka_JVM_PERFORMANCE_OPTS=”-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20

Directly delete – XX: + useg1gc. Restart ZK cluster and start Kafka cluster

The service is normal.

[Solved] Using JDK dynamic agent to customize SPI Error: UndeclaredThrowableException

preface

In the last article, we talked about how to integrate custom SPI with sentinel to realize fuse current limiting. In the process of implementing integration testing, an interesting exception Java lang.reflect.Undeclaredtowableexception. At that time, a global exception was caught in the code layer. The example is as follows

@RestControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(Exception.class)
    public AjaxResult handleException(Exception e) {
        String msg = e.getMessage();
        return AjaxResult.error(msg,500);
    }


    @ExceptionHandler(BlockException.class)
    public AjaxResult handleBlockException(BlockException e) {
        String msg = e.getMessage();
        return AjaxResult.error(msg,429);
    }

}

Originally, it was expected that blockexception would be captured when current limiting was triggered, and then a layer of rendering would be encapsulated. Unexpectedly, blockexception could not be captured alive and dead.

Troubleshooting

Through debugging, it is found that the problem is caused by the JDK dynamic agent. Later, I found some information. Later, I found a paragraph in the official API document

The main idea is that if the invoke method of the call handler of the proxy instance throws a checked exception (which cannot be assigned to runtimeException or throwable of error), and the exception cannot be assigned to any exception class declared by the throws sub Office of the method, the method call on the proxy instance throws an undeclaredtrowableexception.

In this passage, we can analyze the following scenarios

1. There is no declared exception on the real instance method, and the checked exception is thrown when the proxy instance is called

2. The real instance method declares a non checked exception, and the proxy instance throws a checked exception when calling

Solution

Method 1: the real instance also declares the detected exception

Example:

public class SqlServerDialect implements SqlDialect {
    @Override
    public String dialect() throws Exception{
        return "sqlserver";
    }

Method 2: JDK can capture the invoke of dynamic agent, and can customize the exception thrown at the same time

Example:

 @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        CircuitBreakerInvocation invocation = new CircuitBreakerInvocation(target,method,args);

        try {

            return new CircuitBreakerInvoker().proceed(invocation);
        } catch (Throwable e) {
            throw new CircuitBreakerException(429,"too many request");
        }

    }

Method 3: catch the invocationtargetexception exception and throw the real exception

The reason why we need invocationtargetexception is that our custom exception will be wrapped by invocationtargetexception

Example

  @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        CircuitBreakerInvocation invocation = new CircuitBreakerInvocation(target,method,args);

        try {

            return new CircuitBreakerInvoker().proceed(invocation);
            //Use InvocationTargetException is java.lang.reflect.UndeclaredThrowableException
        } catch (InvocationTargetException e) {
            throw e.getTargetException();
        }

    }

summary

If it is a component implemented by ourselves, we recommend directly using scheme 3, that is, capturing invocationtargetexception exceptions.

If the component is implemented by a third party, the recommended scheme 1 is to declare an exception in the called instance method. For example, when using springcloud Alibaba sentinel, there is a probability that an undeclaredtowableexception exception will occur, because it is also based on a dynamic agent, and the blockexception thrown by it is also a checked exception. Examples are as follows

public class SqlServerDialect implements SqlDialect {
    @Override
    public String dialect() throws BlockException{
        return "sqlserver";
    }

If you use a third-party component instead of scheme 1, you can also add a layer of agent on the basis of the third-party component, or intercept the third-party component.

[Solved] gbase8s Error: Caused by: java.sql.SQLException: Transactions not supported

Error Messages:

ERROR [Thread-58] 2021-12-09 15:45:22 (AcquireTimerJobsRunnable.java:85) exception during timer job acquisition: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Transactions not supported
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Transactions not supported
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:304) ~[spring-jdbc-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:378) ~[spring-tx-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137) ~[spring-tx-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) ~[activiti-spring-5.22.0.jar:5.22.0]
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) ~[activiti-engine-5.22.0-hussar-1.jar:5.22.0]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) ~[activiti-engine-5.22.0-hussar-1.jar:5.22.0]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) ~[activiti-engine-5.22.0-hussar-1.jar:5.22.0]
at org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable.run(AcquireTimerJobsRunnable.java:52) [activiti-engine-5.22.0-hussar-1.jar:5.22.0]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: java.sql.SQLException: Transactions not supported
at com.gbasedbt.util.IfxErrMsg.getSQLException(IfxErrMsg.java:408) ~[gbase8s-jdbc-2.0.jar:?]
at com.gbasedbt.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:2274) ~[gbase8s-jdbc-2.0.jar:?]
at com.alibaba.druid.filter.FilterChainImpl.connection_setAutoCommit(FilterChainImpl.java:738) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.filter.logging.LogFilter.connection_setAutoCommit(LogFilter.java:445) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.filter.FilterChainImpl.connection_setAutoCommit(FilterChainImpl.java:733) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.filter.FilterAdapter.connection_setAutoCommit(FilterAdapter.java:986) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.filter.FilterChainImpl.connection_setAutoCommit(FilterChainImpl.java:733) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.setAutoCommit(ConnectionProxyImpl.java:429) ~[druid-1.99.2.jar:1.99.2]
at com.alibaba.druid.pool.DruidPooledConnection.setAutoCommit(DruidPooledConnection.java:713) ~[druid-1.99.2.jar:1.99.2]
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:282) ~[spring-jdbc-5.1.18.RELEASE.jar:5.1.18.RELEASE]
... 8 more
ERROR [Thread-59] 2021-12-09 15:45:22 (AcquireAsyncJobsDueRunnable.java:85) exception during async job acquisition: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Transactions not supported

 

Cause.
When the database is imported, the logging mode is not set, so transactions are not supported
Solution.
Execute the following command
Modify to unbuffer logging mode
ontape -s -L 0 -t /dev/null -U database name

[gbasedbt@localhost bin]$ ontape -s -L 0 -t /dev/null -U test
Your evaluation license will expire on 2022-06-04 00:00:00
Archive to tape device '/dev/null' is complete.

 

[Solved] Springboot integrate swagger Error: Failed to start bean ‘documentationPluginsBootstrapper‘

The compilation error of ‘documentationpluginsbootstrapper’ of failed to start bean appears after springboot integrates swagger:

org.springframework.context.ApplicationContextException:Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException

Solution: add a comment in the startup class: @enablewebmvc

ERROR 3021 (HY000): This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL ” first.

The MySQL master-slave service stops the slave server from executing the start replication command on the machine. An error occurred

Troubleshooting

The slave server cannot be modified while the IO thread is on, so we need to close the IO thread

mysql> STOP SLAVE IO_THREAD;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='192.168.0.99',master_port=3307,master_user='copy',master_password='copy',master_log_file='mysql-bin.000001',master_log_pos=154;
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> START SLAVE IO_THREAD;
Query OK, 0 rows affected (0.00 sec)

 

plink Error: File read failure [How to Solve]

1. Problem, the following problem occurred inexplicably. After tossing for a long time, I didn’t find out the reason. Later, I simply solved it by violence. I directly decompressed the file to see what happened. After decompressing for a long time, it prompted that the file was damaged,….

Error: File read failure.

2. Download the file again and test

root@PC1:/home/GWA_tutorial/2_Population_stratification#plink --vcf ALL.2of4intersection.20100804.genotypes.vcf.gz --make-bed --out ALL.2of4intersection.20100804.genotypes
PLINK v1.90b6.24 64-bit (6 Jun 2021)           www.cog-genomics.org/plink/1.9/
(C) 2005-2021 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to ALL.2of4intersection.20100804.genotypes.log.
Options in effect:
  --make-bed
  --out ALL.2of4intersection.20100804.genotypes
  --vcf ALL.2of4intersection.20100804.genotypes.vcf.gz

15974 MB RAM detected; reserving 7987 MB for main workspace.
--vcf: ALL.2of4intersection.20100804.genotypes-temporary.bed +
ALL.2of4intersection.20100804.genotypes-temporary.bim +
ALL.2of4intersection.20100804.genotypes-temporary.fam written.
25488488 variants loaded from .bim file.
629 people (0 males, 0 females, 629 ambiguous) loaded from .fam.
Ambiguous sex IDs written to ALL.2of4intersection.20100804.genotypes.nosex .
Using 1 thread (no multithreaded calculations invoked).
Before main variant filters, 629 founders and 0 nonfounders present.
Calculating allele frequencies... done.
Total genotyping rate is 0.615305.
25488488 variants and 629 people pass filters and QC.
Note: No phenotypes present.
--make-bed to ALL.2of4intersection.20100804.genotypes.bed +
ALL.2of4intersection.20100804.genotypes.bim +
ALL.2of4intersection.20100804.genotypes.fam ... done.

There was no error this time.

Error: file read failure error occurs when Plink processes large files One possibility is file corruption!

[Solved] M1 chip uses pod to report error: * * * for architecture arm64

1. Add the following configuration

2. Add the following code to podfile

post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['VALID_ARCHS'] = 'arm64 arm64e armv7 armv7s x86_64 i386'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end

end

3.pod install