2011-07-29 20 views
0

我在嘗試使用JSTL時遇到了一個奇怪的錯誤:如何通過Maven包含JSTL 1.2實現?

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version> 
</dependency> 

我認爲這是因爲它不是具體的實現。看起來像Glassfish中有一個具體的實現,但我不知道如何包含它。

我得到的錯誤是:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/jstl/core/LoopTagSupport 

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/jstl/core/ConditionalTagSupport 
+0

你看過http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html嗎? – artbristol

回答

0

,如果使用已經應用服務器提供了一個JSTL實現它應該足以補充<scope>provided</scope>自己的定義,否則您可以嘗試添加

<dependency> <groupId>org.glassfish.web</groupId> <artifactId>jstl-impl</artifactId> <version>1.2</version> </dependency>

+0

那麼,maven對此很滿意。感謝你的回答。 Tomcat說雖然沒有:( – Spider

+0

你試過了哪種方法?第二種方法是否在應用程序中包含了jstl-impl jar?如果Tomcat對第一個方法不滿意,我猜測它沒有提供jstl實現。你能發佈任何看起來相關的錯誤消息嗎? –