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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:43:09+00:00 2026-05-25T18:43:09+00:00

I have an XML file (urlrewrite.xml) that needs a property placeholder resolved. I enable

  • 0

I have an XML file (urlrewrite.xml) that needs a property placeholder resolved. I enable Maven filtering to achieve this. This works fine for the assembled WAR file.

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>

The problem is when trying to run the application in development mode using the maven-jetty-plugin (Maven Jetty Plugin), as maven jetty:run .

The file in question, urlrewrite.xml, is located in the src/main/resources directory, and therefore should (and does) ends up in /WEB-INF/classes (or target/classes for maven jetty:run).

The URLRewriteFilter config specifies the location of the config file as follows:

<filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    <init-param>
        <param-name>confPath</param-name>
        <param-value>/WEB-INF/classes/urlrewrite.xml</param-value>
    </init-param>
</filter>

This will work at deployment time. However, Using the jetty maven plugin, URLRewrite will die with a NullPointerException because it uses context.getResourceAsString(“/WEB-INF/classes/urlrewrite.xml”) in order to load the config file. Jetty returns null for this because when running the application from workspace it resolves /WEB-INF/classes/… to src/main/webapp/WEB-INF/… . The file does not exist there because the WAR has not yet been assembled. It should instead pull the resource from target/classes/urlrewrite.xml.

If that is obscure to you, then you probably won’t be able to answer this question because I suspect you will need to be a Jetty guru to figure out a workaround (hint: that’s a challenge!).

Does anyone know a way around this? I have also tried the following workarounds to know avail:

  1. Put urlrewrite.xml under a new directory, src/main/webResources and add it to the maven war plugin <webReources> and enable filtering. That will copy it’s contents in the appropriate location when the WAR is packaged, but will not make it available for jetty:run
  2. Some other hacks I can’t even remember … (will update if I do)

In summary, maven-jetty-plugin needs the file to be under src/main/resources/webapp/insert path and filename in order to be available for the maven jetty:run command …

Thanks for you help …

Sincerely,
Lloyd Force

  • 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-25T18:43:10+00:00Added an answer on May 25, 2026 at 6:43 pm

    Answered my own question.

    1. Upgrade maven-jetty-plugin to at least 6.1.12

    2. See this wiki page on ‘Configuring Multiple WebApp Source Directory’ (available since jetty-6.1.12.rc2 and jetty-7.0.0pre3)

    3. Add some magic to pom.xml:

    First, add a new directory (src/main/webResources) for your filtered web resources and add a <resource> element:

            <resource>
                <directory>src/main/webResources</directory>
                <filtering>true</filtering>
                <targetPath>../jettyFilteredResources</targetPath>
            </resource>
    

    That will copy the files to target/jettyFilteredResources (we will reference this later). This directory will NOT get copied to your packaged WAR file, it is for jetty only!

    Add the following element to your maven-war-plugin <configuration> element:

                    <webResources>
                        <resource>
                            <directory>src/main/webResources</directory>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
    

    That will ensure everything is packaged up for your real WAR file.

    Finally, tell jetty to use the resources your copied especially for it, by added the following snippet to your <baseResource> element:

    <baseResource implementation="org.mortbay.resource.ResourceCollection">                        
        <resourcesAsCSV>src/main/webapp,target/jettyFilteredResources</resourcesAsCSV>
    </baseResource>
    

    Now everything will worketh! (Well, technically I haven’t tested the production WAR yet, but … blah … it should work too).

    If anyone has a better answer, I will accept it provided the answer is provided in a reasonable amount of time (say 1 day).

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

Sidebar

Related Questions

I have XML file (output of some application) like this: <data> <call function=get_user_data> <output>
I have XML file of object.I want to get instance of that object.But i
I have an external xml file that I am loading in my views.py file
i want parse xml file, which does't have xml extension, like this: http://bizonek.wrzuta.pl/xml/plik/1ANdXCgTOit/unknow/undefined/643/ my
I'm having trouble figuring out how to solve this issue. I have a file
I have XML file with values expressed in SI unit (m, N). I use
I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>
We have XML file like below... <?xml version='1.0'?> <T0020 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd xmlns=http://www.safersys.org/namespaces/T0020V1> <IRP_ACCOUNT>
I have xml file nameed Hello as under with starting node as under: /
i have xml file which contains CDATA i need to update the CDATA as

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.