struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <musa...@gmail.com>
Subject Re: Struts mapping failing when using struts2-convention-plugin
Date Fri, 06 Mar 2009 20:27:41 GMT
Ah the little things that drive us crazy :). Your class is
"com.tousa.ws.rest.SubdivisionController" and the locator is "rest"
which means the the action won't have a namespace, so the url will be
/subdivision instead of /rest/subdivision, because the namespace is
what follows the locator, for example:

com.example.rest.orders.ViewController

will map to:

/orders/view

see the troubleshooting section in the convention plugin.

musachy

On Fri, Mar 6, 2009 at 3:20 PM, wkbutler <kent.butler@gmail.com> wrote:
>
> Hi -
> I am attempting to use the struts-rest-plugin, v2.1.6.  I am using
> struts2-rest-showcase-2.1.6 as a guide. The showcase app works fine for me,
> and I have modeled my struts.xml, web.xml, and pom.xml after its example.
>
> Still, my app always returns a 404 error for any RESTful URL request.  Here
> are my 2 example URLs that I would expect to work at this point:
>
> http://localhost:8080/rest/subdivision.xml
> http://localhost:8080/rest/subdivision/F11.xml
>
> I have cranked up debug, and even though the Restful Mapper & Interceptor
> appear to be properly registered at startup:
>
> [code]
> DEBUG [main] XmlConfigurationProvider.debug(57) | Loaded [BUILDER]
> {PackageConfig Name:convention-default namespace: parents:[{PackageConfig
> Name:struts-default namespace: parents:[]}]}
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Setting action
> default parent package to [rest-default]
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Loading action
> configurations
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Actions being
> loaded using package locators [rest]
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Excluding actions
> from packages [org.apache.struts.*, org.apache.struts2.*,
> org.springframework.web.struts.*, org.springframework.web.struts2.*,
> org.hibernate.*]
>
> DEBUG [main] PackageBasedActionConfigBuilder.debug(57) | Processing class
> [com.tousa.ws.rest.SubdivisionController] in package [com.tousa.ws.rest]
>
> DEBUG [main] SEOActionNameBuilder.trace(69) | Changed action name from
> [SubdivisionController] to [subdivision]
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Got actionName for
> class [class com.tousa.ws.rest.SubdivisionController] of [subdivision]
>
> DEBUG [main] PackageBasedActionConfigBuilder.trace(69) | Created package
> config named [com.tousa.ws.rest#rest-default#] with a namespace []
>
> DEBUG [main] PackageBasedActionConfigBuilder.debug(57) | Creating action
> config for class [class com.tousa.ws.rest.SubdivisionController], name
> [subdivision] and package name [com.tousa.ws.rest#rest-default#] in
> namespace []
>
> DEBUG [main] DefaultResultMapBuilder.trace(69) | Using final calculated
> namespace []
>
> DEBUG [main] DefaultResultMapBuilder.trace(69) | Searching for results in
> the Servlet container at [/WEB-INF/content/] with result prefix of
> [/WEB-INF/content/subdivision]
>
> DEBUG [main] DefaultResultMapBuilder.trace(69) | Searching for results in
> the class path at [WEB-INF/content/] with a result prefix of
> [/WEB-INF/content/subdivision] and action name [subdivision]
> [/code]
>
> on any of the above requests, this is the only logged output (to go along
> with the 404 response):
> [code]
> DEBUG [btpool0-2] ConfigurationManager.debug(57) | Checking
> ConfigurationProviders for reload.
>
> DEBUG [btpool0-2] InstantiatingNullHandler.debug(57) | Entering
> nullPropertyValue
> [target=[com.opensymphony.xwork2.DefaultTextProvider@3e48f2],
> property=struts]
>
> WARN [btpool0-2] OgnlValueStack.warn(45) | Could not find property
> [struts.actionMapping]
> [/code]
>
> which seems totally irrelevant.
>
> I am spinning my wheels now and have tried numerous things, but I cannot
> understand why the supposed action configured at startup does not pick up my
> URLs.
>
> Here are my general configs - I have pared down the configuration to a bare
> minimum, to match the Showcase app, to no avail (yet):
>
> struts.xml
> [code]
>    <constant name="struts.convention.action.suffix" value="Controller"/>
>    <constant name="struts.convention.action.mapAllMatches" value="true"/>
>    <constant name="struts.convention.default.parent.package"
> value="rest-default"/>
>    <constant name="struts.convention.package.locators" value="rest"/>
> [/code]
>
> web.xml
> [code]
>        <context-param>
>        <param-name>contextConfigLocation</param-name>
>        <param-value>classpath*:applicationContext*.xml</param-value>
>    </context-param>
>
>        <!-- Filters -->
>    <filter>
>        <filter-name>struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>struts2</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
>    <!-- Listeners -->
>    <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>    </listener>
>
> [/code]
>
> pom.xml
> [code]
>      <dependencies>
>
>        <!--  Struts 2 -->
>        <dependency>
>            <groupId>org.apache.struts</groupId>
>            <artifactId>struts2-core</artifactId>
>            <version>2.1.6</version>
>        </dependency>
>        <dependency>
>                <groupId>org.apache.struts</groupId>
>                <artifactId>struts2-convention-plugin</artifactId>
>                <version>2.1.6</version>
>        </dependency>
>        <dependency>
>            <groupId>org.apache.struts</groupId>
>            <artifactId>struts2-spring-plugin</artifactId>
>            <version>2.1.6</version>
>        </dependency>
>        <dependency>
>        <groupId>org.apache.struts</groupId>
>        <artifactId>struts2-rest-plugin</artifactId>
>        <version>2.1.6</version>
>      </dependency>
>
>        <dependency>
>            <groupId>org.hibernate</groupId>
>            <artifactId>hibernate</artifactId>
>            <version>3.2.1.ga</version>
>        </dependency>
>        <dependency>
>            <groupId>org.hibernate</groupId>
>            <artifactId>hibernate-annotations</artifactId>
>            <version>3.2.1.ga</version>
>        </dependency>
>        <dependency>
>            <groupId>org.hibernate</groupId>
>            <artifactId>hibernate-entitymanager</artifactId>
>            <version>3.2.1.ga</version>
>        </dependency>
>        <dependency>
>            <groupId>javax.persistence</groupId>
>            <artifactId>persistence-api</artifactId>
>            <version>1.0</version>
>        </dependency>
>        <dependency>
>        <groupId>log4j</groupId>
>        <artifactId>log4j</artifactId>
>        <version>1.2.13</version>
>      </dependency>
>
>  </dependencies>
>
> [/code]
>
>
> Any suggestions?  I guess I will be going through source code now - the
> showcase example makes it seem so simple, and I cannot see what little
> switch I have missing or need to remove.  Thanks for ideas.
> --
> View this message in context: http://www.nabble.com/Struts-mapping-failing-when-using-struts2-convention-plugin-tp22379807p22379807.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message