previously initiated loading for a different type with name "javax/servlet/ServletContext"
2018-03-01 09:02
531 查看
1、问题主要servlet-api 有重复导致的;
2、解决 找到maven的依赖,找到servlet-api依赖,添加provided
compile:默认值。表示是所有任务所需的资源,会随项目一起发布。
test:用于编译和运行测试代码时所需的资源,不会随项目发布。
runtime:运行时所需的资源,如JDBC驱动。
provided:类似compile,JDK部分或应用服务器的classpath所需的资源,期望JDK、容器 或使用者会提供这个依赖,如servlet.jar。
system:类似provided,必须指定systemPath,需要显示提供依赖的jar,
maven不会在Repository中查找。
3、另外通过eclisep 查看pom文件,选jar层次依赖找到servlet的依赖情况,发现项目竟然还有依赖
改为
2、解决 找到maven的依赖,找到servlet-api依赖,添加provided
<dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency>
compile:默认值。表示是所有任务所需的资源,会随项目一起发布。
test:用于编译和运行测试代码时所需的资源,不会随项目发布。
runtime:运行时所需的资源,如JDBC驱动。
provided:类似compile,JDK部分或应用服务器的classpath所需的资源,期望JDK、容器 或使用者会提供这个依赖,如servlet.jar。
system:类似provided,必须指定systemPath,需要显示提供依赖的jar,
maven不会在Repository中查找。
3、另外通过eclisep 查看pom文件,选jar层次依赖找到servlet的依赖情况,发现项目竟然还有依赖
<dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> <version>1.2-rev-1</version> <scope>provided</scope> </dependency>
改为
<dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> <version>1.2-rev-1</version> <exclusions> <exclusion> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> </exclusion> </exclusions> <scope>provided</scope> </dependency>
相关文章推荐
- previously initiated loading for a different type with name "javax/servlet/ServletContext"
- 【bug】previously initiated loading for a different type with name "javax/servlet/ServletContext"(142)
- maven项目使用SOLR时报 previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest" 错的解决方法
- LinkageError之loader (instance of xxx) previously initiated loading for a different type with name "lib/MyData"
- LinkageError之loader (instance of xxx) previously initiated loading for a different type with name
- c-version:null]] could not deserialize the servlet-context scoped attribute with name: "MENU_LIST"
- Open quote is expected for attribute "{1}" associated with an element type "name".
- for bean with name 'permisAddAction' defined in ServletContext resource
- Open quote is expected for attribute "name" associated with an element type "item".
- Spring : No mapping found for HTTP request with URI in DispatcherServlet with name "..."
- 配置c3p0-config.xml报错:Open quote is expected for attribute "name" associated with an element type "pro
- 问题解决:javax.servlet.jsp.el.ELException: The "." operator was supplied with an index value of type "java.lang.String" to be applie
- c-version:null]] could not deserialize the servlet-context scoped attribute with name: "MENU_LIST"
- javax.servlet.jsp.PageContext cannot be resolved to a type问题如何解决???
- javax.servlet.ServletException: Could not resolve view with name 'login' in servlet with name 'XXX'
- javax.servlet.jsp.pagecontext cannot be resolved to a type异常记录
- NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String
- 11-The type javax.servlet.ServletContext cannot be resolved.
- 严重: Servlet.service() for servlet [default] in context with path [/a] threw exception [edu.yale.its.
- Caused by: There is no result type defined for type 'json' mapped with name 'rebback'. Did you mean