我正在尝试创建一个spring MVC应用程序。我有一个父pom,一个模型的通用项目,一个包含所有控制器和业务逻辑项目的通道项目。 除了频道项目,两者都是jar,并作为依赖项包含在频道项目中。现在每当我试图启动我的服务器时,它都在寻找淡淡的依赖性但是我在我的
中根本不使用淡褐色项目规格 春季4.3.12.RELEASE STS:3.9.1 Java JDK 1.8.61
服务器:Apache Tomcat 9 Pivotal服务器3.0-3.2
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>spring-global-common-channels</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- needed for ContextLoaderListener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:group/sk/common/resources/spring-application-context.xml</param-value>
</context-param>
<!-- Bootstraps the root web application context before servlet initialization -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- The front controller of this Spring Web application, responsible for
handling all application requests -->
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:group/sk/common/resources/spring-application-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
弹簧应用context.xml中
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd">
<context:annotation-config />
<context:component-scan base-package="*"></context:component-scan>
<mvc:annotation-driven />
<tx:annotation-driven />
<mvc:cors>
<mvc:mapping path="*localhost:8080*" />
</mvc:cors>
</beans>
错误追踪:
2018-02-11 11:57:04,215 INFO [main] DefaultListableBeanFactory:828 - 覆盖bean&m; mvcHandlerMappingIntrospector&#39;的bean定义 使用不同的定义:替换[Root bean:class [org.springframework.web.servlet.handler.HandlerMappingIntrospector]; 范围=;抽象= FALSE; lazyInit = TRUE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初级= FALSE; factoryBeanName = NULL; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null] with [Root bean:class [null];范围=; 抽象= FALSE; lazyInit = TRUE; autowireMode = 3; dependencyCheck = 0; autowireCandidate = TRUE;初级= FALSE; factoryBeanName = delegatingWebMvcConfiguration; factoryMethodName = mvcHandlerMappingIntrospector; initMethodName = NULL; destroyMethodName =(推断);定义于 org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration] 2018-02-11 11:57:04,297 ERROR [main] ContextLoader:355 - 上下文 初始化失败java.lang.NoClassDefFoundError: com / hazelcast / core / HazelcastInstance at java.lang.Class.getDeclaredMethods0(Native Method)at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)at at java.lang.Class.getDeclaredMethods(Class.java:1975)at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) 在 org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) 在 org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510) 在 org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) 在 org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395) 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) 在 org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) 在 org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443) 在 org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325) 在 org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) 在 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643) 在 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1425) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1415) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 在 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) 在 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 在 org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1425) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1415) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 在 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) 在 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 在 org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在org.apache.catalina.startup.Catalina.start(Catalina.java:671)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)at at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)导致 by:java.lang.ClassNotFoundException: com.hazelcast.core.HazelcastInstance at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275) 在 org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ... 49更多2018-02-11 11:57:04,318信息[主要] XmlWebApplicationContext:984 - 关闭Root WebApplicationContext: 启动日期[Sun Feb 11 11:56:45 IST 2018];上下文层次结构的根 2018-02-11 11:57:04,328 WARN [main] XmlWebApplicationContext:1002 - LifecycleProcessor在上下文关闭时抛出异常 java.lang.IllegalStateException:LifecycleProcessor未初始化 - 打电话'刷新&#39;在通过上下文调用生命周期方法之前:Root WebApplicationContext:启动日期[Sun Feb 11 11:56:45 IST 2018]; 上下文层次结构的根 org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:427) 在 org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:999) 在 org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958) 在 org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:583) 在 org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116) 在 org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4690) 在 org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5327) 在 org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1425) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1415) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 在 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) 在 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 在 org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1425) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1415) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) 在 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) 在 org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) 在 org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在 org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) 在org.apache.catalina.startup.Catalina.start(Catalina.java:671)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)at at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493) 2018-02-11 11:57:04,329 DEBUG [main] DefaultListableBeanFactory:512 - 摧毁单身人士 org.springframework.beans.factory.support.DefaultListableBeanFactory@7fef2b7a: 定义bean [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor ,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,channelCtrlServiceImpl,proxyAsyncConfiguration,schedulingConfiguration,MBeanExportConfiguration,loadTimeWeavingConfiguration,proxyCachingConfiguration,hibernateConfig,springHttpSessionConfiguration,jdbcHttpSessionConfiguration,gemFireHttpSessionConfiguration,mongoHttpSessionConfiguration,redisHttpSessionConfiguration,hazelcastHttpSessionConfiguration,proxyTransactionManagementConfiguration,delegatingWebMvcConfiguration ,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.m ethod.annotation.RequestMappingHandlerMapping,mvcCorsConfigurations,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter,mvcUriComponentsContributor, org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,组织。 springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter, mvcHandlerMappingIntrospector,org.springframework.transaction.config.internalTransactionalEventListenerFactory,org.springframework.aop.config.internalAutoProxyCreat或者,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.context.annotation.internalAsyncAnnotationProcessor,org.springframework。 context.annotation.internalScheduledAnnotationProcessor,的MBeanExporter,的LoadTimeWeaver,org.springframework.cache.config.internalCacheAdvisor,cacheOperationSource,cacheInterceptor,sessionEventHttpSessionListenerAdapter,springSessionRepositoryFilter,springSessionJdbcOperations,sessionRepository,propertySourcesPlaceholderConfigurer,sessionRegionTemplate,ClusteredSpringSessions,sessionRegionAttributes,principalNameIndex,sessionAttributesIndex,mongoSessionRepository,redisMessageListenerContainer,sessionRedisTemplate, enableRedisKeyspaceNotificationsInitializer,transactionAttributeSource,transactionInterceptor,requestMappingHandlerMapping,mvcPathMatcher,mvcUrlPathHelper,viewControllerHand lerMapping,beanNameHandlerMapping,resourceHandlerMapping,mvcResourceUrlProvider,defaultServletHandlerMapping,requestMappingHandlerAdapter,mvcConversionService,mvcValidator,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,mvcViewResolver]; 工厂层级的根
父Pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sk.springboot.demo</groupId>
<artifactId>spring-global-common-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-global-common-parent</name>
<description>spring-global-common-parent</description>
<properties>
<spring.framework.version>4.3.12.RELEASE</spring.framework.version>
<java.version>1.8</java.version>
<jackson.version>2.9.3</jackson.version>
<hibernate.version>5.2.12.Final</hibernate.version>
<slf4j.version>1.7.25</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
</dependencies>
</project>
答案 0 :(得分:2)
Spring Session将使用Hazelcast。 见https://docs.spring.io/spring-session/docs/current/reference/html5/guides/java-hazelcast.html