2013-04-19 20 views
27

finden Als ich <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> setzenSpring Security taglib nicht

ich die folgende Fehlermeldung empfangen:

The absolute uri: http://www.springframework.org/security/tags cannot be resolved in either web.xml or the jar files deployed with this application 

Aber ich habe federsicherheits Taglibs-3.1.3 et al in meinem /lib Ordner. Weiß jemand was ich noch vermisse?

+0

Haben Sie den SpringSecurity starten Listener auf web.xml? –

Antwort

10

Stellen Sie sicher, dass die folgenden Abhängigkeiten enthalten

<dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-config</artifactId> 
     <version>3.1.2.RELEASE</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>spring-aop</artifactId> 
       <groupId>org.springframework</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-core</artifactId> 
     <version>3.1.2.RELEASE</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>spring-aop</artifactId> 
       <groupId>org.springframework</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-web</artifactId> 
     <version>3.1.2.RELEASE</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>spring-aop</artifactId> 
       <groupId>org.springframework</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-taglibs</artifactId> 
     <version>3.1.3.RELEASE</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>spring-aop</artifactId> 
       <groupId>org.springframework</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
54

Addiert man diese Abhängigkeit für mich regelte es (mit 3.1.X.RELEASE):

<dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-taglibs</artifactId> 
    <version>${your-version}</version> 
</dependency> 

Die taglib funktioniert nun korrekt:

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

0

Ich benutze Jetty 9 (Jetty-Maven-Plugin) Das obige konnte nicht helfen. So fügten Code unten zu WEB-INF/web.xml und es hat funktioniert wie Charme:

<servlet> 
     <servlet-name>jsp</servlet-name> 
     <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> 
     <init-param> 
      <param-name>fork</param-name> 
      <param-value>false</param-value> 
     </init-param> 
     <init-param> 
      <param-name>xpoweredBy</param-name> 
      <param-value>false</param-value> 
     </init-param> 
     <load-on-startup>3</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>jsp</servlet-name> 
     <url-pattern>*.jsp</url-pattern> 
     <url-pattern>*.jspf</url-pattern> 
     <url-pattern>*.jspx</url-pattern> 
     <url-pattern>*.xsp</url-pattern> 
     <url-pattern>*.JSP</url-pattern> 
     <url-pattern>*.JSPF</url-pattern> 
     <url-pattern>*.JSPX</url-pattern> 
     <url-pattern>*.XSP</url-pattern> 
    </servlet-mapping> 

auch zur Anlegestelle-context.xml des Problems fügen weiterhin besteht:

<Configure class="org.eclipse.jetty.maven.plugin.JettyWebAppContext"> 
    <Call name="setAttribute"> 
     <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg> 
     <Arg>^$|.*/spring-[^/]*\.jar$|</Arg> 
    </Call> 
</Configure>