Category Archives: JAVA

[Solved] Java XXX: unable to find topic engine in module path

# title1
(java:xxx):gtk -WARNING-:16:33:41.114:Unable to find the theme engine in the module path:“pixmap"
# method
sudo apt-get install gtk2-engines-pixbuf

# title2
(java:xxx):gtk -WARNING-:16:33:41.114:Unable to find the theme engine in the module path:“murrine"
# method
sudo apt-get install gtk2-engines-murrine

# title3
(java:xxx):gtk -WARNING-:16:3:41.115:Unable to find the theme engine in the module path:“adwaita”
# method
sudo apt-get install gnome-themes-standard

Springboot startup error “No bean named’org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry’ available”

1. Problem

springboot startup error

"D:\Program Files\Java\jdk-11\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx. enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=59473:D:\Program Files \JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath D:\workroomMy\demoSpring\out\production\classes;D:\workroomMy\demoSpring\out\production\resources;C:\ Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.3.0.RELEASE\459a5d406c56770d9616c5b272bae9fbc777a994\spring-boot-starter-web-2.3.0 .RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis.spring.boot\mybatis-spring-boot-starter\2.1.2\724ae339bf7d1087612c7186133ed9701f103ddd\mybatis-spring-boot-starter-2.1.2.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter- json\2.3.0.RELEASE\dfdd3336ee920e4bc75f4ed726c3894c7821c31b\spring-boot-starter-json-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework. boot\spring-boot-starter-jdbc\2.3.0.RELEASE\ddc9ee3da589998143de4cada9d5e3aa1dc39f83\spring-boot-starter-jdbc-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\ files-2.1\org.springframework.boot\spring-boot-starter\2.3.0.RELEASE\7b65ef478cf4d21ec70432e11055c2c83371b305\spring-boot-starter-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\ modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.3.0.RELEASE\a8038c9ce2beb7bd3c1980ecadd79f65f36d9311\spring-boot-starter-tomcat-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis.spring.boot\mybatis-spring-boot-autoconfigure\2.1.2\f322930f6a0d07c78481853e6625ffb779bcdeb7\mybatis-spring- boot-autoconfigure-2.1.2.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.3.0.RELEASE\63e909ec18045377f5bcbedbf29f54691dc54ba0\ spring-boot-autoconfigure-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.3.0.RELEASE\ 52fabd810811f5352ebf6a0a7049550f7d4ec1b9\spring-boot-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.3. 0.RELEASE\fe2b3809c5763dd7fe02ab174ebe5ee9ed708fbe\spring-boot-starter-logging-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.2.6.RELEASE\fc54ea95c4c96cd0ab5272319905d4da5d632383\spring-webmvc-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework. boot\spring-boot-devtools\2.3.0.RELEASE\e13dced857910467ff468bba0656a3857deda524\spring-boot-devtools-2.3.0.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.springframework\spring-web\5.2.6.RELEASE\8cc2dbd266eb8f02d2df0895c8e887269e8aed88\spring-web-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org. mybatis\mybatis\3.5.4\83853443357d61258d2634758079f355a0db69ee\mybatis-3.5.4.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.mybatis\mybatis-spring\2.0.4\ 3771548c4d9f78789be33bed01f42d6592757fe1\mybatis-spring-2.0.4.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.0\168b2d0e11478b9f0a1bfccd62d6b5e8547b1e6f\jackson-datatype-jsr310-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml. jackson.core\jackson-annotations\2.11.0\c626020ae55d19c690d25cb51c1532ba76e5890f\jackson-annotations-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson. datatype\jackson-datatype-jdk8\2.11.0\cca91d6375258fd7ff2a6abb7bf91eef492bd606\jackson-datatype-jdk8-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml. jackson.module\jackson-module-parameter-names\2.11.0\950a1e9a7c1093e7ffd92b216d5a0667f1e39058\jackson-module-parameter-names-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files- 2.1\com.fasterxml.jackson.core\jackson-core\2.11.0\f84302e14648f9f63c0c73951054aeb2ff0b810a\jackson-core-2.11.0.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.0\8f5aaf3878b0647ff3a16610af53b1a5c05d9f15\jackson-databind-2.11.0.jar;C:\Users\admin\.gradle\ caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.2\7e2845170ed4fdeb87f1fdc9131b743c61645da3\log4j-to-slf4j-2.13.2.jar;C:\Users\admin\. gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.2\567ea514dedd8679c429c5b5b39b0d67b6464c3c\log4j-api-2.13.2.jar;C:\Users\admin\.gradle\ caches\modules-2\files-2.1\org.springframework\spring-context\5.2.6.RELEASE\f8f4420f268b054db12bf0dc7128adc09ab39a7\spring-context-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\ modules-2\files-2.1\org.springframework\spring-aop\5.2.6.RELEASE\84fffb7cad5816763683a3f251f942aa9f667a7e\spring-aop-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules- 2\files-2.1\org.springframework\spring-jdbc\5.2.6.RELEASE\43747a50376e662c2d889ce7b3cd5b9204962ff3\spring-jdbc-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.springframework\spring-tx\5.2.6.RELEASE\965726c96c42025eedeec047c2afad884203145a\spring-tx-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org. springframework\spring-beans\5.2.6.RELEASE\d1b4c338e52dac001a48e29a605bb8f73572ad84\spring-beans-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\ spring-expression\5.2.6.RELEASE\ae0bc9fdf6cf08d885b9aee26c21efa24245d46c\spring-expression-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring- core\5.2.6.RELEASE\5533695a01f5a1163428932abf6c5ba70e837a2d\spring-core-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.2.6.RELEASE\47b092c5c7a97ad330ae29d84d64e42c63a11b7a\spring-jcl-5.2.6.RELEASE.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.glassfish\ jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\3.4.5\ aa1a2c00aae8e4ba8308e19940711bb9525b103d\HikariCP-3.4.5.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84eecd0d6163332ffkarta065f616\jakarta. api-1.3.5.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2. 3.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar; C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.30\d58bebff8cbf70ff52b59208586095f467656c30\jul-to-slf4j-1.7.30.jar; C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.30\b5a4b6d16ab13e34a88fae84c35cd5d68cac922c\slf4j-api-1.7.30.jar;C:\Users\admin \.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.26\a78a8747147d2c5807683e76ec2b633e95c14fe9\snakeyaml-1.26.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\ org.projectlombok\lombok\1.18.12\48e4e5d60309ebd833bc528dcf77668eab3cd72c\lombok-1.18.12.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat- embed-websocket\9.0.35\62ab2d7d7d029ea728ea8f8d3151ba93882b52ca\tomcat-embed-websocket-9.0.35.jar;C:\Users\admin\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\ tomcat-embed-core\9.0.35\8a99064fce4b152a7dc9bea1798ba828a2cecf0f\tomcat-embed-core-9.0.35.jar com.example.demo.DemoApplication

  . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
(()\___ |'_ |'_| |'_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| |))))
  '|____| .__|_| |_|_| |_\__, | / / / /
 ==========|_|==============|___/=/_/_/_/
 :: Spring Boot :: (v2.3.0.RELEASE)

2020-05-29 09:42:41.536 INFO 6888 --- [restartedMain] com.example.demo.DemoApplication: Starting DemoApplication on A01 with PID 6888 (D:\workroomMy\demoSpring\out\production\classes started by admin in D:\workroomMy\demoSpring)
2020-05-29 09:42:41.540 INFO 6888 --- [restartedMain] com.example.demo.DemoApplication: No active profile set, falling back to default profiles: default
2020-05-29 09:42:41.592 INFO 6888 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor: Devtools property defaults active! Set'spring.devtools.add-properties' to'false' to disable
2020-05-29 09:42:41.593 INFO 6888 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor: For additional web related logging consider setting the'logging.level.web' property to'DEBUG'
2020-05-29 09:42:42.120 WARN 6888 --- [restartedMain] omsmapper.ClassPathMapperScanner: No MyBatis mapper was found in'[com.example.demo]' package. Please check your configuration.
2020-05-29 09:42:42.453 INFO 6888 --- [restartedMain] osbwembedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 8080 (http)
2020-05-29 09:42:42.461 INFO 6888 --- [restartedMain] o.apache.catalina.core.StandardService: Starting service [Tomcat]
2020-05-29 09:42:42.461 INFO 6888 --- [restartedMain] org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-05-29 09:42:42.529 INFO 6888 --- [restartedMain] oaccC[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
2020-05-29 09:42:42.529 INFO 6888 --- [restartedMain] osweb.context.ContextLoader: Root WebApplicationContext: initialization completed in 936 ms
2020-05-29 09:42:42.665 INFO 6888 --- [restartedMain] ossconcurrent.ThreadPoolTaskExecutor: Initializing ExecutorService'applicationTaskExecutor'
2020-05-29 09:42:42.753 WARN 6888 --- [restartedMain] ConfigServletWebServerApplicationContext: Exception encountered during context initialization-cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource ]: Factory method'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-05-29 09:42:42.753 INFO 6888 --- [restartedMain] ossconcurrent.ThreadPoolTaskExecutor: Shutting down ExecutorService'applicationTaskExecutor'
2020-05-29 09:42:42.755 INFO 6888 --- [restartedMain] o.apache.catalina.core.StandardService: Stopping service [Tomcat]
2020-05-29 09:42:42.766 INFO 6888 --- [restartedMain] ConditionEvaluationReportLoggingListener: 

Error starting ApplicationContext. To display the conditions report re-run your application with'debug' enabled.
2020-05-29 09:42:42.769 ERROR 6888 --- [restartedMain] osbdLoggingFailureAnalysisReporter: 

***************************
APPLICATION FAILED TO START
***************************

Description:

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


Action:

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).

2020-05-29 09:42:42.780 WARN 6888 --- [restartedMain] osboot.SpringApplication: Unable to close ApplicationContext

org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.example.demo.DemoApplication.main(DemoApplication.java:12) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 33 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessBeforeInitialization(ConfigurationClassPostProcessor.java:456) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 56 common frames omitted


Process finished with exit code 0

 

2. Solution

Authentication see error prompt

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).

 

The error may be due to the lack of configuration database related information. If the project does not need to configure the database, you can add it to the startup class:

(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})

 

 perfect!

[Solved] Spring AOP Error creating bean with name

When learning the AOP configuration of spring, I encountered an error as follows:

Warning: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/jeremy/service/userServiceImpl (wrong name: com/jeremy/service/UserServiceImpl)

An error occurred when creating the bean because the class NoClassDefFoundError could not be found

Cause of the problem: the class name of pointcut configured in execution is filled in lowercase by mistake, so an error is reported
solution: change the class name to the correct uppercase

    <aop:config>
        <aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.userServiceImpl.*(..))"/>

        <aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
        <aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
    </aop:config>

Change to

 <aop:config>
     <aop:pointcut id="pointcut" expression="execution(* com.jeremy.service.UserServiceImpl.*(..))"/>

     <aop:advisor advice-ref="afterLog" pointcut-ref="pointcut"/>
     <aop:advisor advice-ref="beforeLog" pointcut-ref="pointcut"/>
 </aop:config>

RabbitMQ The channelMax limit is reached. Try later. [How to Solve]

Anomaly interpretation

In a high concurrency scenario, the number of channels reaches the limit, so they cannot continue to be created

Self-built rabbitmq solution

1. Custom configuration

@Configuration
@Slf4j
public class RabbitMQConfig {


    @Bean
    public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
        CachingConnectionFactory cachingConnectionFactory = (CachingConnectionFactory) connectionFactory;
        // set ChannelMax as 4095
        cachingConnectionFactory.getRabbitConnectionFactory().setRequestedChannelMax(4095);
        final RabbitTemplate rabbitTemplate = new RabbitTemplate(cachingConnectionFactory);
        rabbitTemplate.setMessageConverter(jackson2MessageConverter());
        rabbitTemplate.setMandatory(true);
        rabbitTemplate.setConfirmCallback((correlationData, b, s) -> {
            if(!b){
                log.error("confirmCallBack Sending failed data: {}",correlationData);
                log.error("confirmCallBack Confirmation status: {}",b);
                log.error("ConfirmCallBack Reason for sending failure: {}",s);
            }
        });
        rabbitTemplate.setReturnCallback((message, i, s, s1, s2) -> {
            log.error("returnCallBack message: {}",message);
            log.error("returnCallBack response code: {}",i);
            log.error("returnCallBack response message: {}",s);
            log.error("returnCallBack Switch: {}",s1);
            log.error("returnCallBack Routing Key.{}",s2);
        });
        return rabbitTemplate;
    }

    @Bean
    public Jackson2JsonMessageConverter jackson2MessageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}

2. Modify the configuration of MQ server synchronously
rabbitmq.conf

## Set the max permissible number of channels per connection.
## 0 means "no limit".
##In the configuration file, just enter the following parameters and the value you want to set, if you don't use 2047, then you don't need to configure
# channel_max = 128

Rabbitmq solution for cloud services

For paid versions of MQ cloud services, you can try the following to configure rabbitMq connection caching

springBoot 2.3+

  rabbitmq:
    cache:
      connection:
        size: 1000
      channel:
        size: 64

[Solved] Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;

Add a method to Java controller to solve the problem

    /**
     * Solution: Failed to convert value of type 'java.lang.String' to required type 'java.util;
     * The main reason for this error is that the required type in the Controller class is Date, but the type passed on the page side is String, which eventually leads to this error.
     */
    @InitBinder
    public void initBinder(WebDataBinder binder, WebRequest request) {
        //convert the date Note that the conversion here should always be in the same format as the string passed in, e.g. 2015-9-9 should be yyyy-MM-dd
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor is a custom date editor
    }

Error creating bean with name [How to Solve]

I ran into a bug today

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'skuController'


The solution:

1. Maybe the implementation class didn’t add @servcie annotation. After you add it, click start, and the error still exists. Heartbreak X1 2. It may be that @mapperscan (“com. XXX. Mapper”) is not added to the startup class. After you add it, click start, and the error still exists. Heartbreak x2 3. Maybe the Dao package in serviceimpl is not imported into @ Autowired. After you add it, click start, and the error still exists. How about heartbreak X3
is it endless fun to be immortal and die? In the end, you have listed three possibilities, but you still need a note:
@ enable autoconfiguration

@The main functions of enable autoconfiguration are as follows:

Enable automatic configuration of the spring application context and try to guess and configure the beans you may need. Automatic configuration classes are usually based on class paths and defined bean applications. For example, if you have
tomcat-embedded.jar in your classpath, you may want a Tomcat embedded servletcontainerfactory (unless you define your own embedded servletcontainerfactory
bean). When using springbootapplication, automatic configuration of the context is automatically enabled and this annotation is added, so there is no extra effect
autoconfiguration tries to be as intelligent as possible and will be backed up when you define more of your own configurations. You can always manually exclude () any configuration you don’t want to apply (if you can’t access them). You can also exclude them through spring.
autoconfigure. Exclude attributes. After the user-defined bean is registered, auto configuration is always applied. Packages of classes annotated with @
enable autoconfiguration, usually through @
spring boot application, have special significance and are often used as “default”. For example, it will be used to scan the @ entity class. It is generally recommended to place @
enable autoconfiguration in the root package (if you do not use @ springbootapplication) so that you can search all subpackages and classes conditionalonclass and @ conditionalonsingbean).

The above explanations about @ enableautoconfiguration are copied from other places by bloggers. If it’s a bit difficult to understand, you just need to know that it’s Bean’s automatic assembly tool. Maybe you will ask, why do I do this?Can’t I use @ import directly in my project?Of course, since it is automatic configuration, of course, you want the project to start and load.

 

How to Solve Tomcat Error: Could not resolve view with name ‘xxx/xxxxxxx‘ in servlet with

Click the control to not receive the returned JSON object, Tomcat reports an error.

reason:

Because the return information is a JSON object, the annotation added to the entry class where the controller method is located is: @ controller

The @controller is not suitable for returning JSON content

Method 1: change the @ controller annotation to @restcontroller without affecting the use of other methods

Method 2: add @ ResponseBody annotation to the method that needs to request to return the JSON object

Some of the other methods in the class of this method in the project return to the specified page, so @restcontroller cannot be used to replace @ controller directly, so method 2 is adopted to solve the problem.

The difference between @controller and @restcontroller is as follows

@Restcontroller is a stereotype annotation that combines @ ResponseBody and @ controller.
it means:
@restcontroller annotation is equivalent to the combined function of @ ResponseBody + @controller.

1) If you only use @restcontroller to annotate the controller, the methods in the controller cannot return the JSP page, the configured view parser internalresourceviewresolver does not work, and the returned content is the content in return.

For example, if you should go to the success.jsp page, success.jsp will be displayed

2) If you need to return to the specified page, you need to use @ controller with the view parser internalresourceviewresolver
3) if you need to return JSON, XML or custom media type content to the page, you need to add @ ResponseBody annotation to the corresponding method

Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution

The source code is as follows:

        Point[] points = new Point[n];//Point is a class
         for ( int i=0;i<n;i++ ) { 
            System.out.print( "Please enter x:" ); 
            points[i]. setX(in.nextInt());//The 29th line 
            System.out.print( "Please enter y:" ); 
            points[i].setY(in.nextInt()); 
        }

The error message is as follows:

Exception in thread “main” java.lang.NullPointerException
at test.Main.zjd(Main.java:29)
at test.Main.main(Main.java:9)

analysis:

Point[] points=new Point[n];//After defining the class array, I thought that the above code could be used directly, but the above error was reported. 
So I set line 29 as a breakpoint, and 
when I started Debug and run to this point, I found the problem:

It is found in the variable list that the values ​​of points[0] and points[1] are all null

It seems that there is no problem at a glance, but when you think about it, each element in the array is an object. Since it is an object, how can we use it without allocating space (without new)?

Modified code:

        Point[] points= new Point[n];
         for ( int i=0;i<n;i++ ) {
            points[i] =new Point(); //Solution: apply for allocating space for the elements in the class array here . 
            System.out.print( "Please enter x:" ); 
            points[i].setX(in.nextInt()); 
            System.out.print( "Please enter y:" ); 
            points[i].setY(in .nextInt()); 
        }

Solve the use of declaration transactions in spring java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable

The declarative transaction configuration used in spring is as follows:

<!– ================================Transaction related control=========== ============= –>
<bean name=”transactionManager”
class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”>
<property name=”dataSource” ref=”dataSource”> </property>
</bean>
<tx:advice id=”txAdvice” transaction-manager=”transactionManager”>
<tx:attributes>
<tx:method name=”delete*” propagation=”REQUIRED” read-only=” false”
rollback-for=”java.lang.Exception” no-rollback-for=”java.lang.RuntimeException” />
<tx:method name=”insert*” propagation=”REQUIRED” read-only=”false”
rollback-for=”java.lang.RuntimeException” />
<tx:method name=”update*” propagation=”REQUIRED” read-only=”false”
rollback-for=”java.lang.Exception” />
<tx:method name=”find*” propagation=”SUPPORTS” />
<tx:method name=”get*” propagation=”SUPPORTS” />
<tx: method name=”select*” propagation=”SUPPORTS” />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id=”pc”
expression=”execution(public * com.framework ..*.*(..))” />
<aop:advisor pointcut-ref=”pc” advice-ref=”txAdvice” />
</aop:config>

The console reports an error when starting the program: java.lang. NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable.
Reason for error: missing jar package, aspectjweaver-1.5.2.jar

JAVA Error: package org.apache.commons.codec.binary does not exist

I added commons-codec-1.4.jar in my project file and added 

 

import org.apache.commons.codec.binary.Base64;

But whenever I build it it will give me an error: The package org.apache.commons.codec.binary does not exist.
Why does it not work?

I also faced the same problem.
Solved this problem by adding commons-codec.jar 

You can download it from http://mvnrepository.com/artifact/commons-codec/commons-codec/1.7