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 6747387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:26:10+00:00 2026-05-26T12:26:10+00:00

I am trying to run some simple interceptor on controller behind /index url. Usisng

  • 0

I am trying to run some simple interceptor on controller behind /index url. Usisng this piece of docs http://static.springsource.org/spring/docs/3.0.2.RELEASE/spring-framework-reference/html/mvc.html#mvc-handlermapping-interceptor. Here is my bean:

<bean id="handlerMapping"
    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <value>
            /index
        </value>
    </property>
    <property name="interceptors">
        <list>
            <ref bean="myinter" />
        </list>
    </property>
</bean>

<bean id="myinter" class="my.classes.myinterceptor">
</bean>

but unfortunattelly I got:

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'handlerMapping' defined in ServletContext
resource [/WEB-INF/spring-servlet.xml]: Initialization of bean failed;
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named '' is defined

Thanks in advice.

edit, here is my interceptor:

package my.classes;

import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class myinterceptor extends HandlerInterceptorAdapter{
    public boolean preHandle(HttpServletResponse response){
        try {
                    System.out.println("bla bla");
            response.sendRedirect("http://google.com");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return true;
    }
}
  • 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-05-26T12:26:11+00:00Added an answer on May 26, 2026 at 12:26 pm

    The purpose of the SimpleUrlHandlerMapping is to map a url to some handler bean. You are failing to define that handler bean. Try mapping the url to some controller in your context by bean id like below.

    <bean id="handlerMapping"
        class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>
                /index=someController
            </value>
        </property>...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get some simple piece of code I found on a website
So I was trying to run some simple code with Code Contracts (that I
I'm a very new to java, just trying to run some simple programs. I
I have run into this issue where I needed a piece of simple medical
I'm trying to run some queries to get rid of XSS in our database
I'm trying to run some commands in paralel, in background, using bash. Here's what
I am trying to run some unit tests in a C# Windows Forms application
I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
I'm trying to run some statistics over the Stack Overflow data dump, and for
The Problem I am trying to run some ajax on one my pages for

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.