我能够在Eclipse中将我的应用程序作为Spring Boot Application运行,但是在tomcat上部署时,我在上下文加载时遇到错误:无法从@EntityScan配置LocalContainerEntityManagerFactoryBean,确保注册了适当的bean
堆栈跟踪:
2014-11-04 09:47:42.758 INFO 7808 --- [ost-startStop-1] utoConfigurationReportLoggingInitializer:
启动ApplicationContext时出错。要显示启用自动配置报告的调试日志记录(以--debug开头)
2014-11-04 09:47:42.779 ERROR 7808 --- [ost-startStop-1] o.s.boot.SpringApplication:应用程序启动失败
java.lang.IllegalStateException:无法从@EntityScan配置LocalContainerEntityManagerFactoryBean,请确保注册了适当的bean。 在org.springframework.util.Assert.state(Assert.java:385) 在org.springframework.boot.orm.jpa.EntityScanRegistrar $ EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:124) 在org.springframework.boot.orm.jpa.EntityScanRegistrar $ EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:94) 在org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) 在org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:778) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:131) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) 在org.springframework.boot.SpringApplication.run(SpringApplication.java:320) 在org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142) at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89) 在org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51) 在org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) 在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5456) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1880) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
2014-11-04 09:47:42.786 INFO 7808 --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext:关闭org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationCo ntext @ 54a6621c:启动日期[Tue Nov 04 09:47:38 IST 2014]; parent:org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e65b791 2014-11-04 09:47:42.794 INFO 7808 --- [ost-startStop-1] o.s.j.e.a.AnnotationMBeanExporter:在关机时取消注册JMX暴露的bean 2014-11-04 09:47:42.806 INFO 7808 --- [ost-startStop-1] o.s.s.concurrent.ThreadPoolTaskExecutor:关闭ExecutorService 2014-11-04 09:47:42.808 INFO 7808 --- [ost-startStop-1] o.s.c.ehcache.EhCacheManagerFactoryBean:关闭EhCache CacheManager 2014年11月4日上午9:47:42 org.apache.catalina.core.ContainerBase addChildInternal 严重:ContainerBase.addChild:开始: org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/ xyz]] 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1880) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745) 引发者:java.lang.IllegalStateException:无法从@EntityScan配置LocalContainerEntityManagerFactoryBean,请确保注册了适当的bean。 在org.springframework.util.Assert.state(Assert.java:385) 在org.springframework.boot.orm.jpa.EntityScanRegistrar $ EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:124) 在org.springframework.boot.orm.jpa.EntityScanRegistrar $ EntityScanBeanPostProcessor.onApplicationEvent(EntityScanRegistrar.java:94) 在org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) 在org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:778) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:131) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) 在org.springframework.boot.SpringApplication.run(SpringApplication.java:320) 在org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142) at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89) 在org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51) 在org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) 在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5456) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ......还有10个
2014年11月4日上午9:47:42 org.apache.catalina.startup.HostConfig deployWAR 严重:部署Web应用程序存档时出错:C:\ apache-tomcat-7.0.54 \ webapps \ xyz.war java.lang.IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Catalina] .StandardHost [localhost] .StandardCo NTEXT [/ XYZ]] 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1880) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
2014年11月4日上午9:47:42 org.apache.catalina.startup.HostConfig deployWAR 信息:部署Web应用程序存档C:\ apache-tomcat-7.0.54 \ webapps \ xyz.war已完成37,169 ms