38

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

I will recieve the following error:

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

But I have spring-security-taglibs-3.1.3 et al in my /lib folder. Does anyone know what else am I missing?

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Sy Z
  • 441
  • 1
  • 5
  • 10

3 Answers3

75

Adding this dependency fixed it for me (using 3.1.X.RELEASE) :

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

The taglib now works properly:

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

Mike R
  • 4,448
  • 3
  • 33
  • 40
15

Make sure the following dependencies are included

<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>
Kevin Bowersox
  • 93,289
  • 19
  • 159
  • 189
0

I am using jetty 9 (jetty-maven-plugin) The above could not help. So added below code to WEB-INF/web.xml and it worked like charm:

<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>

Also add to jetty-context.xml of the problem still persists:

<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>
Deepu Sahni
  • 479
  • 5
  • 9