运行
时有不同的行为mvn clean tomcat7:run-war and mvn clean tomcat7:run
我正在尝试在servlet 3容器中运行jstls
(因此是tomcat 7插件),出于某种原因,当我使用tomcat7:run
命令运行插件时,我得到了这个异常:
org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/...../.m2/repository/jstl/jstl/1.2/jstl-1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:182)
org.apache.jasper.compiler.JspDocumentParser.getTaglibInfo(JspDocumentParser.java:1287)
org.apache.jasper.compiler.JspDocumentParser.startPrefixMapping(JspDocumentParser.java:797)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startNamespaceMapping(AbstractSAXParser.java:2164)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:469)
鉴于tomcat7:run-war
,我不这样做。我怀疑它与类浏览器有关,在运行选项中查看类路径的maven存储库与战争爆炸位置
target\[webappname]\WEB-INF\lib
使用run-war的主要原因是对tagx或JSTL标记的更改进行了热部署。
以下是相关的pom.xml包含:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/webapp</path>
</configuration>
</plugin>
答案 0 :(得分:1)
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
解决方案是否归功于BalusC