我想包括Spring Security的到我的web項目,我下面這個教程http://docs.spring.io/spring-security/site/docs/current/guides/html5//helloworld.html類型javax.servlet.ServletContext和javax.servlet.ServletException解決不了
我已經在做了一切教程與給定的Maven項目,並正常工作。但是當我試圖將它包含到我的項目中時出現編譯錯誤。具體而言,當我從AbstractSecurityWebApplicationInitializer
延伸出現給定的錯誤
多個標記在這條線
- 類型javax.servlet.ServletContext不能得到解決。它從所需的.class文件間接引用
- 無法解析類型javax.servlet.ServletException。它是間接需要的.class文件
引用pom.xml中
<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>spring.primefaces</groupId>
<artifactId>primefaces.testwebapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SpringPrimefacesWebApp</name>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JSF 2.2 core and implementation -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.11</version>
</dependency>
<!-- Prime Faces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.0.1.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.1.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
感謝您的幫助!
使用MVN全新安裝-U
沒有你的POM的相關部分很難診斷。 –
對不起,我剛剛上傳完整的pom。 –
從命令提示符處執行命令(從POM保存的目錄執行)。 mvn乾淨安裝-U。如果這不起作用檢查存儲庫路徑的apache-maven-3.3.1 \ conf \ settings.xml文件 –