Tag Archives: development language

[Solved] activiti integrate error: GlobalAuthenticationConfigurerAdapter.class does not exist

@EnableSwagger2
@SpringBootApplication(scanBasePackages = {"cn.com.ten"} ,exclude = {org.activiti.spring.boot.SecurityAutoConfiguration.class})
@MapperScan(basePackages = {"cn.com.ten.**.dao"})
public class SystemEtlApplication {

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

}

Springboot integration activiti reported an error

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class]
cannot be opened because it does not exist

 

Solution:

Add springbootapplication on the startup class

exclude = {org.activiti.spring.boot.SecurityAutoConfiguration.class}

[Solved] Python operate Kafka error: SyntaxError: invalid syntax

Python operation Kafka reports an error: return ‘& lt; SimpleProducer batch=%s>’ %self.async

return ‘< SimpleProducer batch=%s>’ % self. async
^^^^^
SyntaxError: invalid syntax

reason:

Because PY3 Async has become a keyword in 7. This leads to incompatibility.

Solution:

Method 1:

The latest Kafka version is used, but the Kafka on pypi has not been replaced with the latest one. You can upgrade Kafka Python using the following method
PIP install Kafka python

Method 2:

Just switch to version 3.6 and wait for subsequent upgrades

How to Solve Log4j 2.5 upgrade to 2.15 error

Question

Log4j2 is used in the project. Due to the use of global asynchronous log printing, it is also necessary to introduce the dependency of disruptor. The version dependency of log4j2 and disruptor used last is as follows:

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.11.1</version>
</dependency>
<!-- log4j2 AsyncLogger need disruptor-->
<dependency>
    <groupId>com.lmax</groupId>
    <artifactId>disruptor</artifactId>
    <version>3.2.0</version>
</dependency>

At the beginning of the project (before the logger of log4j2 is used for the first time), enable global asynchronous log printing through code:

// use asyncLogger for log4j2 framework
System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");

However, the errors reported after starting the project are as follows:

java.lang.NoSuchMethodError: com.lmax.disruptor.dsl.Disruptor.<init>(Lcom/lmax/disruptor/EventFactory;ILjava/util/concurrent/ThreadFactory;Lcom/lmax/disruptor/dsl/ProducerType;Lcom/lmax/disruptor/WaitStrategy;)V
        at org.apache.logging.log4j.core.async.AsyncLoggerDisruptor.start(AsyncLoggerDisruptor.java:97)
        at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:75)
	at .......

Solution:

The problem is caused by the lower version of the disruptor. Just change the version to the newer version:

<dependency>
    <groupId>com.lmax</groupId>
    <artifactId>disruptor</artifactId>
    <version>3.4.2</version>
</dependency>

JUnit tests mybatis-plus error: null pointer [How to Solve]

Question:

Because the project uses microservices, a service is created in the microservices to write mybatis plus in order to save trouble. However, a null pointer error occurs when JUnit tests after writing according to the official website documents.

Test class of official website document:

An error occurred:

The value of usermapper was found to be empty

By checking the data, it is found that this is because ordinary classes can’t use springbeans, so ordinary test classes can’t get beans, so they report null pointers. Therefore, we need to make the test class get the bean.

Solution:

Add test dependency:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

And add notes on the test class:

@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)

solve the problem

Java error: java.lang.NoSuchMethodError

The Java runtime reports an error
the postman test reports an error of 500. The exception information is displayed as follows:


reason: first, check whether there is a method of this attribute in the previous class. If so, it is mostly a problem of dependency conflict. In general, it may be that classes with the same package name and class name are introduced. The order in which dependencies are introduced in the POM file of the project is inconsistent, resulting in the use of other people’s classes with the same package and the same name, and there is no corresponding entity class attribute paramscheckresult. An error will be reported in the result. Query the full path name of the class you introduced.

 

Methods:

ProtectionDomain pd = Response.class.getProtectionDomain();
CodeSource cs = pd.getCodeSource();
System.out.println(cs.getLocation().toString());

Print result: the full path name of the imported class will be displayed

fatal error: libusb.h: No such file or directory [How to Solve]

1. Error Messages:
In file included from /home/joes/jiao/ROS_Project/09_catkin_laser_Project/src/laser_myself/src/sick_tim310_1130000m01.cpp:2:0:
/home/joes/jiao/ROS_Project/09_catkin_laser_Project/src/laser_myself/include/laser_myself/sick_tim_common_mockup.h:42:20: fatal error: libusb.h: No such file or directory
compilation terminated.

 

2. Solution:
The original program header file is: #include <libusb.h>
Modify to: #include <libusb-1.0/libusb.h>

[Solved] error: Unexpected console statement (no-console)

Solution:

Modify package Eslintconfig in JSON: “rules”: {} in {}, add a line of code: “no console”: “off”

NPM install after saving

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ?'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ?'warn' : 'off',
    "no-console":"off"
  }
}

Or directly use:

window.console.log(“…”) (I haven’t tried)

[Solved] BeanCreationNotAllowedException Error: Error creating bean with name ‘rabbitConnectionFactory‘

org.springframework.beans.factory.BeanCreationNotAllowedException:

Error creating bean with name ‘rabbitConnectionFactory’:

Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

Once the project reports this error, in most cases, the sub paths in the control layer are repeated, and non unique channels appear during compilation, as shown below

After copying, the sub path of the control layer access path has been changed accordingly

[Solved] sbatch: error: Batch script contains DOS line breaks (\r\n)

When using the school HPC cluster, it is found that the batch task written by win10 reports an error, which can be solved with dos2unix.

Bugs and Solutions

This problem is due to the difference between UNIX and DOS blank line format. Just use code conversion
errors are reported as follows:

sbatch: error: Batch script contains DOS line breaks (\r\n)
sbatch: error: instead of expected UNIX line breaks (\n).

Enter dos2unix:

dos2unix yourfilename