Tomcat启动报错Error creating bean with name ‘initPgDbBase’ defined in URL
2022-07-29 11:03:31,438 ERROR [localhost-startStop-1] (FrameworkServlet.java:492) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘initPgDbBase’ defined in URL [file:/data/metadata/webapps/metadata/WEB-INF/classes/spring-config.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: sql file execution failed.#fileName:file:/data/metadata/webapps/metadata/WEB-INF/lib/mist-init-script4pg-1.0.0-SNAPSHOT.jar!/etl-init.sql
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory 1. g e t O b j e c t ( A b s t r a c t B e a n F a c t o r y . j a v a : 304 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 228 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 300 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 195 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 294 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 195 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . g e t B e a n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 973 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . f i n i s h B e a n F a c t o r y I n i t i a l i z a t i o n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 750 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 482 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . F r a m e w o r k S e r v l e t . c o n f i g u r e A n d R e f r e s h W e b A p p l i c a t i o n C o n t e x t ( F r a m e w o r k S e r v l e t . j a v a : 658 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . F r a m e w o r k S e r v l e t . c r e a t e W e b A p p l i c a t i o n C o n t e x t ( F r a m e w o r k S e r v l e t . j a v a : 624 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . F r a m e w o r k S e r v l e t . c r e a t e W e b A p p l i c a t i o n C o n t e x t ( F r a m e w o r k S e r v l e t . j a v a : 672 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . F r a m e w o r k S e r v l e t . i n i t W e b A p p l i c a t i o n C o n t e x t ( F r a m e w o r k S e r v l e t . j a v a : 543 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . F r a m e w o r k S e r v l e t . i n i t S e r v l e t B e a n ( F r a m e w o r k S e r v l e t . j a v a : 484 ) a t o r g . s p r i n g f r a m e w o r k . w e b . s e r v l e t . H t t p S e r v l e t B e a n . i n i t ( H t t p S e r v l e t B e a n . j a v a : 136 ) a t j a v a x . s e r v l e t . G e n e r i c S e r v l e t . i n i t ( G e n e r i c S e r v l e t . j a v a : 158 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d W r a p p e r . i n i t S e r v l e t ( S t a n d a r d W r a p p e r . j a v a : 1152 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d W r a p p e r . l o a d S e r v l e t ( S t a n d a r d W r a p p e r . j a v a : 1097 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d W r a p p e r . l o a d ( S t a n d a r d W r a p p e r . j a v a : 990 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d C o n t e x t . l o a d O n S t a r t u p ( S t a n d a r d C o n t e x t . j a v a : 4952 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d C o n t e x t . s t a r t I n t e r n a l ( S t a n d a r d C o n t e x t . j a v a : 5266 ) a t o r g . a p a c h e . c a t a l i n a . u t i l . L i f e c y c l e B a s e . s t a r t ( L i f e c y c l e B a s e . j a v a : 183 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . C o n t a i n e r B a s e . a d d C h i l d I n t e r n a l ( C o n t a i n e r B a s e . j a v a : 755 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . C o n t a i n e r B a s e . a d d C h i l d ( C o n t a i n e r B a s e . j a v a : 729 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d H o s t . a d d C h i l d ( S t a n d a r d H o s t . j a v a : 695 ) a t o r g . a p a c h e . c a t a l i n a . s t a r t u p . H o s t C o n f i g . d e p l o y D i r e c t o r y ( H o s t C o n f i g . j a v a : 1177 ) a t o r g . a p a c h e . c a t a l i n a . s t a r t u p . H o s t C o n f i g 1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1152) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1097) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:990) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4952) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5266) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177) at org.apache.catalina.startup.HostConfig 1.getObject(AbstractBeanFactory.java:304)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:294)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)atorg.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)atorg.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)atorg.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)atorg.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)atorg.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)atorg.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)atorg.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)atjavax.servlet.GenericServlet.init(GenericServlet.java:158)atorg.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1152)atorg.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1097)atorg.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:990)atorg.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4952)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5266)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177)atorg.apache.catalina.startup.HostConfigDeployDirectory.run(HostConfig.java:1925)
at java.util.concurrent.Executors R u n n a b l e A d a p t e r . c a l l ( E x e c u t o r s . j a v a : 511 ) a t j a v a . u t i l . c o n c u r r e n t . F u t u r e T a s k . r u n ( F u t u r e T a s k . j a v a : 266 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1149 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor RunnableAdapter.call(Executors.java:511)atjava.util.concurrent.FutureTask.run(FutureTask.java:266)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: sql file execution failed.#fileName:file:/data/metadata/webapps/metadata/WEB-INF/lib/mist-init-script4pg-1.0.0-SNAPSHOT.jar!/etl-init.sql
at com.code.common.mist.init.script.meta.pg.InitPgDbBase.loadInitData(InitPgDbBase.java:73)
at com.code.common.mist.init.script.meta.pg.InitPgDbBase.init(InitPgDbBase.java:41)
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.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1681)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
… 34 more
Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 25 of resource class path resource [etl-init.sql]: CREATE SEQUENCE seq_sch_log_job START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 50; nested exception is org.postgresql.util.PSQLException: ERROR: relation “seq_sch_log_job” already exists
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:474)
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:392)
at com.code.common.mist.init.script.meta.pg.InitPgDbBase.loadInitData(InitPgDbBase.java:71)
… 42 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation “seq_sch_log_job” already exists
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:459)
… 44 more
29-Jul-2022 11:03:31.468 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/data/metadata/webapps/metadata] has finished in [179,646] ms
29-Jul-2022 11:03:31.477 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [“http-nio-19997”]
29-Jul-2022 11:03:31.489 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 179723 ms
等解决了,再来更新,先记录下来。