Open liuurick opened 3 years ago
可以打个断点看下,结论就是,你这样启动项目,大概率是去target下的class下面找conf配置目录了,手动把配置放进去吧,或者调整下build
可以检查一下目录是否包含中文名
打开startup.bat文件,把classpath分号隔开的两个顺序调换一下即可
set ENV_PATH=H:\canal.adapter-1.1.5 指向你的adaper根目录
startup.bat @rem set logback_configurationFile=%conf_dir%\logback.xml 去掉@rem
1,把classpath分号隔开的两个顺序调换。 2,确保不是中文文件夹 以及 文件夹命名不能存在空格(Program Files 放在这个文加下也有问题)
environment
Issue Description
通过idea编译canal-adapter之后,点击client-adapter\launcher\target\canal-adapter\bin\startup.bat,运行异常。 ############# 启动日志 adapter.log ############### `2020-12-12 22:43:08.946 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationConfigMonitor': Invocation of init method failed; nested exception is java.lang.RuntimeException: Config dir not found. 2020-12-12 22:43:08.949 [main] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat] 2020-12-12 22:43:09.167 [localhost-startStop-1] WARN org.apache.catalina.loader.WebappClassLoaderBase - The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.base@11.0.9/java.lang.Object.wait(Native Method) java.base@11.0.9/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) app//com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43) 2020-12-12 22:43:09.184 [main] INFO o.s.b.a.logging.ConditionEvaluationReportLoggingListener -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-12-12 22:43:09.194 [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationConfigMonitor': Invocation of init method failed; nested exception is java.lang.RuntimeException: Config dir not found. at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:138) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1694) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) at com.alibaba.otter.canal.adapter.launcher.CanalAdapterApplication.main(CanalAdapterApplication.java:19) Caused by: java.lang.RuntimeException: Config dir not found. at com.alibaba.otter.canal.client.adapter.support.Util.getConfDirPath(Util.java:105) at com.alibaba.otter.canal.client.adapter.support.Util.getConfDirPath(Util.java:85) at com.alibaba.otter.canal.adapter.launcher.monitor.ApplicationConfigMonitor.init(ApplicationConfigMonitor.java:41) 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.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:308) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135) ... 16 common frames omitted `
Steps to reproduce
Expected behaviour
Actual behaviour
If there is an exception, please attach the exception trace: