Tag Archives: java

[Solved] nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data mo

FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model

The following error is reported when starting a project inherited from Flowable and Spring Boot:

05.824 INFO  o.f.s.SpringProcessEngineConfiguration:922  main                    Executing configure() of class org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator (priority:200000)
09.818 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
19.821 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
29.825 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
39.835 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
49.851 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
59.859 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
09.864 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
19.879 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
29.894 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
39.907 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
49.911 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
59.930 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
09.939 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
19.944 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
29.966 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
39.975 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
49.989 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
00.000 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
10.013 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
20.022 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
30.035 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
40.052 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
50.058 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
00.065 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
10.075 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
20.078 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
30.097 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
40.114 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
50.129 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
00.142 INFO  liquibase.lockservice         :26   main                    Waiting for changelog lock....
10.377 WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext:591  main                    Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appletLeaveController': Unsatisfied dependency expressed through field 'leaveService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appletLeaveServiceImpl': Unsatisfied dependency expressed through field 'flowableProcessInstanceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowableProcessInstanceServiceImpl': Unsatisfied dependency expressed through field 'historyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'historyServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'historyServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
10.572 INFO  c.a.druid.pool.DruidDataSource:2071 main                    {dataSource-1} closing ...
10.638 INFO  c.a.druid.pool.DruidDataSource:2144 main                    {dataSource-1} closed
10.697 INFO  o.a.c.core.StandardService    :173  main                    Stopping service [Tomcat]
10.981 ERROR o.s.boot.SpringApplication    :830  main                    Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appletLeaveController': Unsatisfied dependency expressed through field 'leaveService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appletLeaveServiceImpl': Unsatisfied dependency expressed through field 'flowableProcessInstanceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowableProcessInstanceServiceImpl': Unsatisfied dependency expressed through field 'historyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'historyServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'historyServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	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.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
	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:740)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at com.sinosoft.MobileAppletBusinessApplication.main(MobileAppletBusinessApplication.java:32)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appletLeaveServiceImpl': Unsatisfied dependency expressed through field 'flowableProcessInstanceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowableProcessInstanceServiceImpl': Unsatisfied dependency expressed through field 'historyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'historyServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'historyServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	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.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
	... 18 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flowableProcessInstanceServiceImpl': Unsatisfied dependency expressed through field 'historyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'historyServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'historyServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	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.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
	... 32 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'historyServiceBean' defined in class path resource [org/flowable/spring/boot/ProcessEngineServicesAutoConfiguration.class]: Unsatisfied dependency expressed through method 'historyServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	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.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
	... 46 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:176)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1884)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1284)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:345)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 59 common frames omitted
Caused by: org.flowable.common.engine.api.FlowableException: Error initialising dmn data model
	at org.flowable.common.engine.impl.db.LiquibaseBasedSchemaManager.initSchema(LiquibaseBasedSchemaManager.java:68)
	at org.flowable.dmn.engine.impl.db.DmnDbSchemaManager.initSchema(DmnDbSchemaManager.java:36)
	at org.flowable.dmn.engine.impl.cmd.SchemaOperationsDmnEngineBuild.execute(SchemaOperationsDmnEngineBuild.java:27)
	at org.flowable.dmn.engine.impl.cmd.SchemaOperationsDmnEngineBuild.execute(SchemaOperationsDmnEngineBuild.java:23)
	at org.flowable.common.engine.impl.interceptor.DefaultCommandInvoker.execute(DefaultCommandInvoker.java:22)
	at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
	at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
	at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:56)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:56)
	at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
	at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
	at org.flowable.dmn.engine.impl.DmnEngineImpl.<init>(DmnEngineImpl.java:48)
	at org.flowable.dmn.engine.DmnEngineConfiguration.buildDmnEngine(DmnEngineConfiguration.java:217)
	at org.flowable.dmn.spring.SpringDmnEngineConfiguration.buildDmnEngine(SpringDmnEngineConfiguration.java:69)
	at org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator.initDmnEngine(SpringDmnEngineConfigurator.java:68)
	at org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator.configure(SpringDmnEngineConfigurator.java:57)
	at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(AbstractEngineConfiguration.java:923)
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:1016)
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:915)
	at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:72)
	at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:60)
	at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169)
	... 69 common frames omitted
Caused by: org.flowable.common.engine.api.FlowableException: Error updating dmn engine tables
	at org.flowable.common.engine.impl.db.LiquibaseBasedSchemaManager.schemaUpdate(LiquibaseBasedSchemaManager.java:105)
	at org.flowable.common.engine.impl.db.LiquibaseBasedSchemaManager.initSchema(LiquibaseBasedSchemaManager.java:61)
	... 92 common frames omitted
Caused by: liquibase.exception.LockException: Could not acquire change log lock.  Currently locked by DESKTOP-T9LSH1H (192.168.1.108) since 22-6-15 上午9:27
	at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:234)
	at liquibase.Liquibase.lambda$update$1(Liquibase.java:214)
	at liquibase.Scope.lambda$child$0(Scope.java:177)
	at liquibase.Scope.child(Scope.java:186)
	at liquibase.Scope.child(Scope.java:176)
	at liquibase.Scope.child(Scope.java:155)
	at liquibase.Liquibase.runInScope(Liquibase.java:2404)
	at liquibase.Liquibase.update(Liquibase.java:211)
	at liquibase.Liquibase.update(Liquibase.java:197)
	at liquibase.Liquibase.update(Liquibase.java:193)
	at liquibase.Liquibase.update(Liquibase.java:185)
	at org.flowable.common.engine.impl.db.LiquibaseBasedSchemaManager.schemaUpdate(LiquibaseBasedSchemaManager.java:103)
	... 93 common frames omitted

Process finished with exit code 1

After investigation, it was found that the problem was MySQL

Solution: find a table whose table name is suffixed with databasechangeloglock and change it to the format shown in the following figure to solve the problem

Note: all tables suffixed with databasechangeloglock should be checked

XML read process error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content not allowed in preamble

com. sun. xml. internal. ws. streaming. Xmlstreamreaderexception: XML read process error: javax xml. stream. Xmlstreamexception: parseError at [row, col]: [1,1] message: content is not allowed in the preface

The error contents are as follows

com.sun.xml.internal.ws.streaming.XMLStreamReaderException: XML read process error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: No content is allowed in the preamble.
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:311)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:84)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:154)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:89)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.hasWSDLDefinitions(RuntimeWSDLParser.java:310)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:217)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)
at javax.xml.ws.Service.<init>(Service.java:77)
at cn.gov.ynhrss.psp.Ynhrsspspservice.<init>(Ynhrsspspservice.java:39)
at com.neusoft.xtpt.web.PspWebService.send(PspWebService.java:38)
at com.neusoft.xtpt.controller.PspCtl.basic(PspCtl.java:25)
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)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: No content is allowed in the preamble.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:604)
at com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter.next(XMLStreamReaderFilter.java:81)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:65)
... 66 more

Background

I call WebService in Java and report an error when I call new xxxxxxxservice().

Cause analysis

When WebService creates new xxxxxxxservice(), it needs to load the URL in xxxxxxxservice first. If the URL is not loaded or the URL is null, the above error may be reported.

There are two solutions

Method 1: Add the url of the webservice’s access address to the static method, as follows:

static {
        URL url = null;
        WebServiceException e = null;
        try {
            url = new URL("http://127.0.0.1:8088/ynhrs/services/info?wsdl");
        } catch (MalformedURLException ex) {
            e = new WebServiceException(ex);
        }
        BIZSERVICE_WSDL_LOCATION = url;
        BIZSERVICE_EXCEPTION = e;
    }

You can also configure the address of WebService file, etc

Method 2: directly add the URL to new xxxxxxxservice(), as follows:

Ynhrsspspservice pspService = new Ynhrsspspservice(new URL("http://127.0.0.1:8088/ynhrs/services/info?wsdl"));

http://127.0.0.1:8088/ynhrs/services/info?wsdl is the URL of webservice

[Solved] Java Run Error: For input string: “XXX”

Background

Today, a small partner of front-end joint commissioning said that an interface reported an error.

I first glanced at the code and found no problem.

First post the code of the place where the error is reported

...
IntegralRecord integralRecord = new IntegralRecord();
integralRecord.setUid(uid);
integralRecord.setLinkType(IntegralRecordConstants.TYPE_SIGN);
integralRecord.setTitle(IntegralRecordConstants.INTEGRAL_TASK);
integralRecord.setIntegral(Integer.parseInt(amount));
integralRecord.setStatus(1);
integralRecord.setType(IntegralRecordConstants.TYPE_ADD); 
integralRecord.setMark(StrUtil.format("Free {} points for completing tasks", amount));
userIntegralRecordService.save(integralRecord);
...

Problem location
There is no choice but to debugger a line to run.

After running to

integralRecord.setIntegral(Integer.parseInt(amount));

This line, then reported an error message For input string.

This line of code, when I look at it, just does a conversion operation on the type.

Is there something wrong with the passed data?

I ran it again and found that amount=2.00

Explanation: Because the amount is shared by several places, considering that there may be a decimal situation, a String is used in the front-end pass, and the back-end uses the corresponding type for conversion according to the actual situation.

When converting, it is indeed this line that has a problem.

The specific test situation is shown below:

Then we changed it to

amount=”2″

The results are as follows

Then the problem can be defined because integer cannot recognize the case with decimals during conversion.

Problem follow up

Integer.parseInt source code

We found that parseInt finally called the following code.

public static int parseInt(String s, int radix) throws NumberFormatException{

        if (s == null) {
            throw new NumberFormatException("null");
        }

        if (radix < Character.MIN_RADIX) {
            throw new NumberFormatException("radix " + radix +
                                            " less than Character.MIN_RADIX");
        }

        if (radix > Character.MAX_RADIX) {
            throw new NumberFormatException("radix " + radix +
                                            " greater than Character.MAX_RADIX");
        }

        boolean negative = false;
        int i = 0, len = s.length();
        int limit = -Integer.MAX_VALUE;

        if (len > 0) {
            char firstChar = s.charAt(0);
            if (firstChar < '0') { // Possible leading "+" or "-"
                if (firstChar == '-') {
                    negative = true;
                    limit = Integer.MIN_VALUE;
                } else if (firstChar != '+') {
                    throw NumberFormatException.forInputString(s);
                }

                if (len == 1) { // Cannot have lone "+" or "-"
                    throw NumberFormatException.forInputString(s);
                }
                i++;
            }
            int multmin = limit/radix;
            int result = 0;
            while (i < len) {
                int digit = Character.digit(s.charAt(i++), radix);
                if (digit < 0 || result < multmin) {
                    throw NumberFormatException.forInputString(s);
                }
                result *= radix;
                if (result < limit + digit) {
                    throw NumberFormatException.forInputString(s);
                }
                result -= digit;
            }
            return negative ?result : -result;
        } else {
            throw NumberFormatException.forInputString(s);
        }
    }

Source code positioning

In the code, we can see that an error will be reported if the range is no longer specified

int digit = Character.digit(s.charAt(i++), radix);
  if (digit < 0 || result < multmin) {
    throw NumberFormatException.forInputString(s);
}

java.lang.Character.digit(char ch, int radix) method :

Returns the value of the character ch in the specified base, if the base is not in the range MIN_RADIX ≤ base ≤ MAX_RADIX or if the value of the channel is not a valid number in the specified base -1, then it is returned.

The value of radix is 10, this is because the conversion Int type is when the single character 0~9.

So if the value is not a number between 0~9 an error will be reported.

The exception thrown is forInputString.

Solution:
String interception
In this example, it is clear that only the integer part is needed, so you can specify the character “.” based on the to intercept.

Then you can convert it and it’s done.

Borrowing from a third party
Here we recommend using the NumberUtil from the hutool toolkit

You can convert similar numbers directly.

Method: NumberUtil.parseInt

 String val ="2.00";
 int i = NumberUtil.parseInt(val);

Type conversion

Because it can be determined that the value must be of numerical type.

So it can be directly converted to BigDecimal type.

BigDecimal has an intValue method, which can be called after direct conversion

 String val ="2.00";
 int i = new BigDecimal(val).intValue();

[Solved] itextpdf Read PDF File Error: Rebuild failed: trailer not found.

Recently, I used itextpdf to print invoices, but there was an error when reading the file stream. The following is the key code

ClassPathResource classPathResource = new ClassPathResource("/template/RU_HK_INVOICE_TEMPLATE.pdf");
InputStream inputStream = classPathResource.getInputStream();
reader = new PdfReader(inputStream);// read the template of pdf

The following errors are reported in the new PdfReader(inputStream) each time:

com.itextpdf.text.exceptions.InvalidPdfException: Rebuild failed: trailer not found.; Original message: xref subsection not found at file pointer

Maven will use pom XML configuration files uniformly encode the project, but some files do not need to be re encoded, such as PDF template files; After recoding, the PDF template structure may be damaged, resulting in the unavailability of the files generated after compilation, as shown in the following figure

Therefore, it is necessary to filter out the files that do not need to be encoded: filter all files with the suffix .pdf or .p8 and do not encode them uniformly. Need to be configured in the pom.xml file nonFilteredFileExtension tag

<!-- Filter the suffixes of files that do not need to be transcoded pdf -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                    <nonFilteredFileExtensions>
 						<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>

[Solved] Tomcat Startup Error: A child container failed during start、LifecycleException: Failed to start component

An error is reported when Tomcat is started. The error contents are as follows

WARNING: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341)
	at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1238)
	at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:592)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:972)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

The code change adds the following servlet dependency, and it starts successfully if you remove it, but it reports an error if you remove the reference to the project.
The reason is that adding the servlet dependency caused a conflict with another dependency when packaging.

Solution

You only need to add the scope tag in the dependency to exclude the servlet-api we introduced when packaging the project, as shown below

 

Classification of scope

Maven’s default dependency configuration items, the default value of scope is compile, the project is often silly to distinguish between the direct default. Today to sort out maven’s scope.

  • compile: the default is compile, nothing is configured, which means compile. compile means that the dependent project needs to participate in the compilation of the current project, of course, the subsequent test, runtime also participate in it, is a relatively strong dependency. This is a strong dependency. It is usually included when packaging.
  • test: The scope is test, which means that the dependent project is only involved in the test-related work, including the compilation and execution of the test code. Typical examples are junit.
  • runntime: The dependent project does not need to be involved in the compilation of the project, but it is required to be involved in the later testing and runtime cycles. Compared with compile, it just skips the compilation. To be honest, in the terminal project (non-open source, internal system), the difference with compile is not very big. The API jar corresponding to the implementation of JSR×××× is compiled, and the specific implementation is runtime, which is enough for compile to know the interface. oracle jdbc driver package is a good example, and the general scope is runntime. I can use A to achieve it, or B to achieve it.
  • provided: provided means that it can be packaged without being packaged in, and other facilities (Web Container) will provide it. In fact, the dependency can theoretically participate in the compile, test, run, etc. cycle. It is equivalent to compile, but with the exclude action done during the packaging phase.
  • system: In terms of involvement, it is the same as provided, but the dependencies are not grabbed from the maven repository, but from the local filesystem.

[Solved] Resource compilation failed. Check logs for details.

Record the problems encountered that cannot be clearly answered by the search.

Error log:

Execution failed for task ‘:app:mergeDebugResources’.
> A failure occurred while executing com. android. build. gradle. internal. res.ResourceCompilerRunnable
> Resource compilation failed. Check logs for details.

* Try:
Run with –info or –debug option to get more log output. Run with –scan to get full insights.

Error: I added a string-array resource file, and “I’m here” used the abbreviation, which is what caused the above error.

Solution: no abbreviation, directly use “I am here”

 

[Solved] ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed t

Project scenario:

Today, when I was writing code in Java to check the data in ES, the following error occurred. I checked it for a while and found the problem


Console prompt

ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [location] of type [geo_point]]
]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=unsupported symbol [.] in geohash [30.871729121.81959]]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=unsupported symbol [.] in geohash [30.871729121.81959]]];
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:176)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2011)
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1988)
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1745)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1702)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1672)
	at org.elasticsearch.client.RestHighLevelClient.index(RestHighLevelClient.java:1029)
	at com.woniu.EsDemoApplicationTests.insertDoc(EsDemoApplicationTests.java:115)
	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 
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
	Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://120.48.46.177:9200], URI [/hotel/_doc/45870?timeout=1m], status line [HTTP/1.1 400 Bad Request]
Warnings: [Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.16/security-minimal-setup.html to enable security.]
{"error":{"root_cause":[{"type":"parse_exception","reason":"unsupported symbol [.] in geohash [30.871729121.81959]"}],"type":"mapper_parsing_exception","reason":"failed to parse field [location] of type [geo_point]","caused_by":{"type":"parse_exception","reason":"unsupported symbol [.] in geohash [30.871729121.81959]","caused_by":{"type":"illegal_argument_exception","reason":"unsupported symbol [.] in geohash [30.871729121.81959]"}}},"status":400}
		at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:326)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:296)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:270)
		at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2082)
		at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1732)
		... 71 more
Caused by: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=unsupported symbol [.] in geohash [30.871729121.81959]]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=unsupported symbol [.] in geohash [30.871729121.81959]]];
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:485)
	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:396)
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:426)
	at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:592)
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:168)
	... 74 more
Caused by: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=unsupported symbol [.] in geohash [30.871729121.81959]]]
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:485)
	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:396)
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:426)

Cause analysis:

The data structure of the geographic coordinate attribute location in ES is (latitude, longitude), and I inserted a comma in the middle when I spliced strings, resulting in an error in inserting data. Here are the really useful parts of the above code.

Real error reason:

{"error":{"root_cause":[{"type":"parse_exception","reason":"unsupported symbol [.] in 
geohash [30.871729121.81959]"}],"type":"mapper_parsing_exception","reason":"failed to parse 
field [location] of type [geo_point]","caused_by":{"type":"parse_exception","reason":"unsupported symbol [.] in geohash 
[30.871729121.81959]","caused_by":
{"type":"illegal_argument_exception","reason":"unsupported symbol [.] in geohash 
[30.871729121.81959]"}}},"status":400}

Incorrect writing:

this.location = hotel.getLatitude()+hotel.getLongitude();

Correct writing:

this.location = hotel.getLatitude()+","+hotel.getLongitude();

Solution:

Check the string before splicing, and the order (latitude and longitude) cannot be reversed, otherwise it may lead to geographical location errors.

[Solved] ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper‘;

ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper‘;

Spring boot reports the following errors:

org.springframework.context.applicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java. lang.NullPointerException

After testing for a long time, it is found that the reason for swagger2:

Version 3.0.0 was originally used:

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>3.0.0</version>
</dependency>

It is said that:

Reason: This is because Springfox uses path matching based on AntPathMatcher, while Spring Boot 2.6.X uses PathPatternMatcher.
Solution: Configure in application.properties: spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

After testing, no error was reported, but the search access http://localhost:8080/swagger-ui.html has 404

Final solution:

Switch the version of swagger2 and swaggerui to version 2.9.2

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
</dependency>

If it does not work like me, just add the following code in application.properties:

spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

Problem solved!

[Solved] Docker-maven-plugin Build Mirror Error: failed: Connection refused: connect

Docker-maven-plugin Build Mirror Error: failed: Connection refused: connect

[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.7:build (default) on project security-api: Could not build image: java.util.concurrent.ExecutionException: com.spotify.docker.client.sha
ded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connect
ion refused: connect -> [Help 1]

 

Solution:

  1. Go to docker settings (Second mouse click on docker icon, click settings)
  2. Click on checkbox ‘Expose daemon on tcp://localhost:2375 without TLS’
  3. Apply & Restart
  4. Run again: mvn clean install

[Solved] IntelliJ IDEA Compile Error: Errorjava Compilation failed internal java compiler error

IntelliJ idea tutorial (contents)

Error content:

information:using javac 1.8.0_ 73 to compile Java sources
information:java: javactask: source release 1.8 requires target release 1.8
information:java: errors occurred while compiling module 'ezsonar'
information:module "ezsonar" was fully rebuilt due to project configuration/dependencies changes
Information:2016/11/21 14:08 - Compilation completed with 1 error and 0 warnings in 5s 242ms
Error:java: Compilation failed: internal java compiler error

 

Error reporting diagram:

Solution:

If it is not the same as the one in the figure, click the one on the right to add the module of your project and select the corresponding version of JDK required by your project. Just compile it again.

IDEA Error: ERROR 16720 —[ restartMain] o.a.coyote. http11.Http119Protocol: Failed to sta

Idea reports error: ERROR 16720 – [restartedmain] o.a.coyote http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler [“http-nio-80”]

1. Error 16720

idea version is IntelliJ idea 2018.3.6 x64

The error reporting codes of running items are as follows:


the detailed error reporting code of the third figure

Sun May 29 10:42:36 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:36 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun May 29 10:42:37 CST 2022 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

2. Error reporting causes and Solutions

1. cause

Port number 80 is occupied

2. solutions

1. change the port number and use the idle port number

the occupied port number here is 80, and the idle port number is 81

(1) Find the configuration file to write the port number

server:
  port: 80

(2) Change the port number to an idle and unoccupied port number

server:
  port: 81

 

[Solved] RedisTemplate increment Error: io.lettuce.core.RedisCommandExecutionException: ERR value is not an intege

Redistemplate uses increment to report an error: io.lettuce.core.RedisCommandExecutionException: ERR value is not an intege

Problem analysis

We can learn from spring’s documents that spring has two rare serialization strategies for redis. One is the JDKSerializationRedisSerialzer serialization of RedisTemplate application. The serialized value contains object information, version number, class information, etc. after this serialization, a string cannot be self incremented.

The other is the StringRedisSerializer adopted by the StringRedisTemplate. This strategy converts the string value into a byte array, so the values saved in redis can be operated.

Solution:

Replace RedisTemplate with String RedisTemplate