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

  • SEARCH
  • Home
  • 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 6736609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:09:00+00:00 2026-05-26T11:09:00+00:00

I have asked another question related to this in this thread Where to put

  • 0

I have asked another question related to this in this thread Where to put css resources in a maven project

thinking that I was not putting the css resources under the right location in a Maven project structure. Right now I have a folder under webapp called css and I have the css resources there. My problem is that when I do mvn clean tomcat:run those css resources do not seem to be picked up and put appropriately in the target folder so my application cannot pick them up.

Does anybody know why?

UPDATE

My goal is to avoid building the war upon deployment for rapid development.I have changed my Maven command to: mvn clean war:exploded tomcat:run

The application runs fine but the css is not being picked up. If I go to the browser and type: http://localhost:8080/appname/css/styles.css

I get a Spring Framework error saying No mapping found for HTTP request with URI [/appname/css/styles.css in DispatcherServlet

In other Spring Java apps that I have built using traditional project style (not maven) I was able to access the css from the borwser with the url above. I have made sure that the css folder is hanging straight out of the webapp folder.

Any ideas?

UPDATE: Adding 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
                 classpath*:META-INF/spring/applicationContext*.xml                  
    </param-value>
</context-param>

<!-- 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-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

I do not have the Dispatcher servlet mapped to /* and it still tries to access CSS files through the DispatcherServlet.

  • 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-26T11:09:01+00:00Added an answer on May 26, 2026 at 11:09 am

    tomcat:run use the src folder, not the target. Your css files are in a good place in src/main/webapp/css. They should be available from a browser.

    mvn -X tomcat:run prints the configuration. Some interesting parts:

    [INFO] Preparing tomcat:run
    [DEBUG] (s) resources = [Resource {targetPath: null, filtering: false, 
        FileSet {directory: /workspace/webtest1/src/main/resources, 
        PatternSet [includes: {}, excludes: {}]}}]
    ...
    [DEBUG] (f) warSourceDirectory = /workspace/webtest1/src/main/webapp
    

    You can find some more details in this answer: mvn tomcat7:run – How does it work?

    For the second question/update: I think you mapped a Spring servlet to /* and it does not handle static content. Post your web.xml and Spring configuration. Maybe you just need a mvc:resources into your Spring configuration. This also could be useful: How to handle static content in Spring MVC?

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

Sidebar

Related Questions

This question is related to another question I asked Basically, I have 2 horizontally
This is closely related to another question I asked: Is there functionality that is
This is somewhat related to another question that I've asked that I've pretty much
This is an offshoot question that's related to another I asked here . I'm
This is a question related to another one I asked that was specific to
This is another question related to a question I asked a few minutes ago.
This is a related to a previous question I have asked here, see the
I've asked another related question to this here: casting dynamic to static problem I've
This is somewhat related to another question I asked: Translate GPS coordinates to location
This question is related to another question I asked. In my other question I

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.