[Jersey] Configuration of Struts 2 + Jersey in one app

From: Kevin Duffey <>
Date: Mon, 26 Sep 2011 23:28:41 -0700 (PDT)

Hi all,

I can't seem to find any sort of information on how to configure both Jersey and Struts 2 in one app. I have the following web.xml:




    I am using Struts 2 annotation configuration for action classes, results, etc. However, I still have a struts.xml in the src/  that gets put into the WEB-INF/classes to configure a few things. One of them is an option not easily found on google about telling Struts to ignore one or more URL patterns. So given that I want ALL requests EXCEPT any url with ajax/* in it, to Struts 2, I have the above and added the ajax/* pattern to the struts.xml like so:

    <constant name="struts.devMode" value="true" />
    <constant name="struts.convention.classes.reload" value="true" />
    <constant name="struts.enable.SlashesInActionNames" value="true" />
    <constant name="struts.action.excludePattern" value="/ajax/*?" />

    <package name="default" extends="struts-default" namespace="/">
        <action name="index">

As you see, the excludePattern is used to tell Struts what to ignore. Still, I can't get any of my Jersey requests to get through to the resources. They are loading..I see them being round in the log output. The only error I get is that Struts has no action mapped to /ajax/somePath.

So if anyone has configured Struts 2 and Jersey, I'd be much appreciated in helping me resolve how to make them work together so that one (or a few url paths) make it through to Jersey, the rest go to Struts 2.

Thank you.