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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:56:21+00:00 2026-06-15T21:56:21+00:00

This is my first post so go easy on me. I’m trying to set

  • 0

This is my first post so go easy on me. I’m trying to set up a java web application using spring web mvc 3.1.3 on JBoss AS 7 and or TomCat 7. But something weird is happening in the URL mapping. I am following a bunch of tutorials but I am basically trying to do part one of this one. There is a very simple jsp in my WEB-INF/views folder which I would like to get rendered and returned when calling http://localhost:8080/hello/welcome. But this doesn’t happen. There is something wrong with the url mapping. When I use something like /test/* and I call http://localhost:8080/hello/test/welcome it works as expected. When I use /* http://localhost:8080/hello/welcome returns a non rendered jsp. And when I use what I would in my noob opinion should be the default I get a 404 resource not found.
I tested this all on a JBoss 7.1.1 and a Tomcat 7.0.33 server running within eclipse or deployed using a war file. I am at my wits end. Every google result page is full of purple links I still haven’t found what I’m looking for.

Anybody who could help? I understand some info might be missing but please ask.

edit: I forgot I use maven to build my application. This is done using the m2e wtp plugin for eclipse. And I am running eclipse juno.

This is my Initializer (very basic).

Public class Initializer implements WebApplicationInitializer 
{   
public void onStartup(ServletContext servletContext) throws ServletException {
 AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
 root.register(WebappConfig.class);

 ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(root));
 servlet.addMapping("/");
 servlet.setLoadOnStartup(1);
}}

This is my WebappConfig:

@Configuration
@ComponentScan("nl.hello")
@EnableWebMvc
public class WebappConfig extends WebMvcConfigurerAdapter
{
@Bean
public InternalResourceViewResolver setupViewResolver() 
{
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");

return resolver;
}

@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer{
configurer.enable();
}}

And the Controller:

@Controller
public class HelloController {

@RequestMapping("/welcome")
public String helloWorld(Model model) {
//let’s pass some variables to the view script
model.addAttribute("wisdom", "Goodbye XML");

return "welcome"; 
}}

And my pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hello</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.3</version>
      <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
      </configuration>
    </plugin>
  </plugins>
</build>
<properties>
    <project.build.sourceEncoding>utf8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.1.8.Final</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>3.1.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.1.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.inject</groupId>
    <artifactId>javax.inject</artifactId>
    <version>1</version>
</dependency>
<dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>2.2.2</version>
</dependency>
 </dependencies>
 </project>
  • 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-15T21:56:22+00:00Added an answer on June 15, 2026 at 9:56 pm

    I solved it! I should have mentioned that I knew about the “bug” of tomcat prior of version 7.0.15. Below this version it is not possible to override the default url mapping. But as I said I was aware of it and I used version 7.0.33. So this couldn’t be it right!? Wrong!
    On a side note I should have noticed in the 404 page of jboss that 7.1.1 (brontes) uses version 7.0.13 or something and is never going to work.
    But what was the problem. Well I was using the m2e wtp plugin for eclipse to build my applications. Unfortunately there is a something in maven that broke everything. First I thought it was the fact it was embedded and using an external maven source did solve my problem. Maybe a version difference? Well turns out they both use 3.0.4. Weird!? When I switched back to embedded it worked.

    Summary: When using webapplicationinitializer use Tomcat version of 7.0.15 and preferably use an external maven source.

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

Sidebar

Related Questions

This is my first post here so go easy. I am trying to build
This is my first post so please go easy on me fellas. I am
Long time watcher and this is my first post so please go easy on
This is my first post on here so go easy on me lol! Ok
this is my first post.. so I'm learning Android & Java (coming from Actionscript),
First of all, I apologize to post this easy question. Probably there is a
This is my first post on this rather spiffing website so go easy on
This is my first post, so please go easy on me if I say
This is my first post in this forum, so please, be patient with me.
This is my first post and I my first experience with jquery. I have

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.