Bom dia pessoal,
Estou com um problema estranho. Tenho um projeto Maven de três módulos rodando perfeitamente local e em ambiente de produção. Uso o git para versionar o projeto e precisei criar dois ambientes de desenvolvimento em paralelo do mesmo projeto na minha máquina.
O antigo roda normalmente. Mas ao clonar o repositório, importar o projeto em um novo Workspace, construir com sucesso o Maven Build, ele não consegue publicar o projeto no Tomcat.
Estou usando o JDK 8, Tomcat 7. Se precisar, envio pra vocês o pom.xml dos projetos.
Segue o Log do Tomcat ao iniciar o projeto.
10:16:40,537 ERROR org.springframework.web.context.ContextLoader: 319 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [br/com/audicon/taxadvisor/config/MainConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean br.com.audicon.taxadvisor.config.MainConfig.entityManagerFactory()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jpaVendorAdapter’ defined in class path resource [br/com/audicon/taxadvisor/config/MainConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.JpaVendorAdapter br.com.audicon.taxadvisor.config.MainConfig.jpaVendorAdapter()] threw exception; nested exception is java.lang.StackOverflowError at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1031) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean br.com.audicon.taxadvisor.config.MainConfig.entityManagerFactory()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jpaVendorAdapter’ defined in class path resource [br/com/audicon/taxadvisor/config/MainConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.JpaVendorAdapter br.com.audicon.taxadvisor.config.MainConfig.jpaVendorAdapter()] threw exception; nested exception is java.lang.StackOverflowError at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) … 23 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jpaVendorAdapter’ defined in class path resource [br/com/audicon/taxadvisor/config/MainConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.JpaVendorAdapter br.com.audicon.taxadvisor.config.MainConfig.jpaVendorAdapter()] threw exception; nested exception is java.lang.StackOverflowError at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1031) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:298) at br.com.audicon.taxadvisor.config.MainConfig$$EnhancerByCGLIB$$2cd02a7f.jpaVendorAdapter() at br.com.audicon.taxadvisor.config.MainConfig.entityManagerFactory(MainConfig.java:74) at br.com.audicon.taxadvisor.config.MainConfig$$EnhancerByCGLIB$$2cd02a7f.CGLIB$entityManagerFactory$2() at br.com.audicon.taxadvisor.config.MainConfig$$EnhancerByCGLIB$$2cd02a7f$$FastClassByCGLIB$$abbe5f43.invoke() at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:286) at br.com.audicon.taxadvisor.config.MainConfig$$EnhancerByCGLIB$$2cd02a7f.entityManagerFactory() 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:497) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160) … 24 more Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.JpaVendorAdapter br.com.audicon.taxadvisor.config.MainConfig.jpaVendorAdapter()] threw exception; nested exception is java.lang.StackOverflowError at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) … 45 more Caused by: java.lang.StackOverflowError at java.security.AccessController.doPrivileged(Native Method) at com.sun.naming.internal.VersionHelper12.getJndiProperties(VersionHelper12.java:105) at com.sun.naming.internal.ResourceManager.getInitialEnvironment(ResourceManager.java:216) at javax.naming.InitialContext.init(InitialContext.java:240) at javax.naming.InitialContext.(InitialContext.java:216) at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136) at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103) at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:38) at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:77) at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:33) at org.springframework.jndi.JndiPropertySource.getProperty(JndiPropertySource.java:82) at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73) at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59) at org.springframework.core.env.AbstractPropertyResolver$1.resolvePlaceholder(AbstractPropertyResolver.java:176) at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:146) at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125) at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:174) at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:143) at org.springframework.core.env.AbstractPropertyResolver.resolveNestedPlaceholders(AbstractPropertyResolver.java:163) at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:76) at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
Após isso o log fica num loop entre PropertySourcesPropertyResolver e AbstractPropertyResolver.
O estranho é que o projeto é construído com sucesso pelo Maven Build mas ao iniciar o servidor ele retorna esse erro. Estou a alguns dias pesquisando sobre isso mas sem sucesso de resolução.
Alguém já passou por isso? Será que estou perdendo algo configurar o projeto pra rodar?
Grato por qualquer ajuda!

