Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:48:55+00:00 2026-06-11T13:48:55+00:00

I need to add spring security to my webapp. My application uses spring an

  • 0

I need to add spring security to my webapp. My application uses spring an also vaadin for the admin part. I’m using form-login as auth mode. So the problem I’m struggling with is that when I try to post the following form:

<form name='f' action="j_spring_security_check"
    method='POST'>

    <table>
        <tr>
            <td>User:</td>
            <td><input type='text' name='j_username' value=''>
            </td>
        </tr>
        <tr>
            <td>Password:</td>
            <td><input type='password' name='j_password' />
            </td>
        </tr>
        <tr>
            <td colspan='2'><input name="submit" type="submit"
                value="submit" />
            </td>
        </tr>
        <tr>
            <td colspan='2'><input name="reset" type="reset" />
            </td>
        </tr>
    </table>

</form>

I get a 404 redirect. So here I paste my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/root-context.xml</param-value>
    </context-param>

    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>

    <!-- Enables Spring Security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>
            org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Enables Spring internationalization -->
    <filter>
        <filter-name>encoding-filter</filter-name>
        <filter-class>
            org.springframework.web.filter.CharacterEncodingFilter
        </filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>encoding-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Processes application requests -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
        <init-param>
            <description>Vaadin application class to start</description>
            <param-name>application</param-name>
            <param-value>com.windy.server.admin.MyVaadinApplication</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/admin/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
         <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>



    <error-page>
        <error-code>404</error-code>
        <location>/WEB-INF/views/page404.jsp</location>
    </error-page> 

</web-app>

and here my spring security configuration:

<security:http authentication-manager-ref="authenticatioManager" auto-config="true" pattern="/web/**">
    <security:intercept-url pattern="/web/**" access="ROLE_AUTH" />
    <security:form-login login-page="/loginTest.do" default-target-url="/loginWelcome.do"
        authentication-failure-url="/loginfailed.do" />
    <security:logout logout-success-url="/logout.do" invalidate-session="true"/> 
    <security:session-management>
        <security:concurrency-control max-sessions="1" error-if-maximum-exceeded="true" expired-url="/web/login" />
    </security:session-management>
</security:http>

<bean id="userDetailsService" class="com.ddelizia.server.service.core.impl.UserDetailsServiceImpl"/>

<security:authentication-manager id="authenticatioManager">
  <security:authentication-provider user-service-ref="userDetailsService">
    <!-- <security:password-encoder hash="md5"/> -->
  </security:authentication-provider> 
</security:authentication-manager>

I also tried to add to the form login the parameter login-processing-url=”/login_spring” and changed in the form action to login_spring

my application is running on tomcat at the address localhost:8080/myapp and the login action is called on localhost:8080/myapp/login_spring but Still i get the same error.

I also tried to modify my web.xml changing the spring security filter mapping as following:

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>*.log</url-pattern>
    </filter-mapping>

and changing the login-processing-url=”/login_spring.log” but still I get the 404 page.

Then I tried to switch to a http-basic authentcation but in this case it works… I don’t understand what I’m doing wrong…

Thanks in advance for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:48:56+00:00Added an answer on June 11, 2026 at 1:48 pm

    Change your form element to:

    <form name='f' action='<c:url value="/j_spring_security_check" />' method='POST'>
    

    Also add JSTL Core taglib at the beginning of file if you don’t have it:

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    

    EDIT:

    I think I spotted source of problem. Remove pattern="/web/**" from <http> element leaving only <security:http authentication-manager-ref="authenticatioManager" auto-config="true">.

    What’s more, j_spring_security_check must be in springSecurityFilterChain, so change mapping to:

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    

    and try now without login-processing-url in <form-login> but with <c:url>. We have similar config in our Vaadin app and it works just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my web application I am using Spring login form (with Spring-security). By default
I have a pretty standard project with Spring Security. I have a login form
Currently I have a custom form login page in Spring Security 3 that sends
I am writing an application that uses GWT, some Spring MVC and Spring Security.
I need add Auto complete on apex Tabular Form. there is a column as
Hї! I have wrote test for my application. I need add item to database
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I need to connect to a provider's web service with a Windows Form application.
I am new to Spring and Spring Security. I just need a pointer in
I am using spring mvc and spring security. In my security-app-context.xml I have: <authentication-manager>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.