我是Spring和Maven的新手,我无法使我的项目正常工作...我使用webapp原型启动了一个新的Maven项目,并且即使在具有春季安全性的情况下也可以正常工作。但是现在我在maven中包含了休眠依赖,无论我保留它们还是从pom.xml中删除它们,我都会得到:
HTTP状态500 –内部服务器错误
Type Exception Report
Message javax.servlet.ServletException: java.lang.IllegalStateException: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
我在控制台上遇到以下错误:
Sep 21, 2018 5:22:08 PM org.apache.catalina.core.StandardContext backgroundProcess
WARNING: Exception processing loader [WebappLoader[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/prueba6]]] background process
java.lang.IllegalStateException: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:256)
at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281)
at org.apache.catalina.webresources.Cache.getResource(Cache.java:62)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216)
at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
at org.apache.catalina.loader.WebappClassLoaderBase.modified(WebappClassLoaderBase.java:708)
at org.apache.catalina.loader.WebappLoader.modified(WebappLoader.java:343)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:287)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5465)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1400)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1400)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1368)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:164)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:149)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.openJarFile(AbstractArchiveResourceSet.java:307)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
... 14 more
我的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>com.luv2code</groupId>
<artifactId>spring-security-demo</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>spring-security-demo</name>
<properties>
<springframework.version>5.0.2.RELEASE</springframework.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<!-- Spring MVC support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Servlet, JSP and JSTL support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
我已经尝试在pom.xml的给定版本中包含slf4j依赖关系,但没有成功。我读到有时使用不同的slf4j版本会导致某些依赖项冲突,但是我不知道如何检查! :(我想我犯了一个与休眠无关的错误,但是我无法找到哪里...
答案 0 :(得分:0)
这些步骤对我有用: -停止Tomcat。 -右键单击Tomcat / Clean。 -右键单击Tomcat / Clean Tomcat工作目录。 -将.war添加到Tomcat并启动它。