struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [S2] Trouble getting started
Date Sun, 27 Sep 2015 16:05:29 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Lucasz,

On 9/27/15 12:02 PM, Christopher Schultz wrote:
> On 9/27/15 10:08 AM, Lukasz Lenart wrote:
>> 2015-09-26 23:30 GMT+02:00 Christopher Schultz 
>> <chris@christopherschultz.net>:
>>> I'm working on a fresh project and using Struts 2 for the
>>> first time. I've been using Struts 1 for more than 10 years and
>>> I generally know my way around web applications.
>>> 
>>> I just can't seem to get a fairly simple setup working. I'm 
>>> intending to use XML-based configuration and not
>>> annotation-based configuration.
> 
>> The best option is to use one of Maven's archetypes
> 
>> http://struts.apache.org/docs/struts-2-maven-archetypes.html#Struts2M
a
>
>> 
venArchetypes-Quickstart
> 
> Yeah...
> 
> I was trying to avoid using Maven, which to me has too much opaque
> hand-waving that I neither understand nor control.
> 
> I have what I believe is a fairly simple test app at this point. I 
> should be able to get it to work without resorting to drastic
> measures : )
> 
>>> Here's what I've got:
>>> 
>>> * Struts 2.3.24.1 * Tomcat 8.0.24 * A simple web app
>>> 
>>> My web.xml looks like this: <filter> <description> Struts 2 
>>> action filter. </description>
>>> <filter-name>struts2</filter-name>
>>> 
>>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareA
n
>
>>> 
dEx
>>> 
>>> 
> ecuteFilter</filter-class>
>>> <init-param> <param-name>actionPackages</param-name> 
>>> <param-value>my.package.business</param-value> <!-- do I need

>>> this if I'm going to use XML-based config? -->
> 
>> Not needed, it is useful only when using the Convention plugin
> 
>>> </init-param> </filter>
>>> 
>>> <filter-mapping> <filter-name>struts2</filter-name> 
>>> <url-pattern>/*</url-pattern> </filter-mapping>
>>> 
>>> My struts.xml looks like this:
>>> 
>>> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts
>>> PUBLIC "-//Apache Software Foundation//DTD Struts
>>> Configuration 2.0//EN"
>>> "http://struts.apache.org/dtds/struts-2.0.dtd">
> 
>> Wrong DTD, please use the latest one
> 
>> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD
>> Struts Configuration 2.3//EN" 
>> "http://struts.apache.org/dtds/struts-2.3.dtd">
> 
> Yep, I updated to this one this morning, after trying to find out
> the default value for the <result> "name" attribute. Still no
> change.
> 
>>> <struts> <constant name="struts.devMode" value="true" />
>>> 
>>> <package name="default" namespace="/" extends="struts-default">
>>>  <action name="list" class="my.package.business.ListAction"> 
>>> <result>/WEB-INF/list.jsp</result> </action> </package>

>>> </struts>
>>> 
>>> I have a class, my.package.business.ListAction which has a
>>> 
>>> public String execute()
>>> 
>>> method. I return "success" from this method (unless an
>>> exception is thrown). During startup, I can see that
>>> Struts/XWork is being initialize d:
>>> 
>>> 26-Sep-2015 17:19:32.613 FINE [localhost-startStop-1] 
>>> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.de
b
>
>>> 
ug
>>> 
>>> 
> Loaded
>>> list in 'default' package:{ActionConfig //list 
>>> (my.package.business.ListAction) - action - 
>>> file:/path/to/deploy/webapps/ROOT/WEB-INF/classes/struts.xml: 
>>> 9:68}
>>> 
>>> When I try to access http://localhost:8080/list.action, I get
>>> a 404 response with nothing in the logs (except the access
>>> log: request to /list.action resulted in a 404).
>>> 
>>> I'm sure I'm missing something super simple, here. Can anyone 
>>> offer a suggestion?
> 
>> Are you sure that you have deployed your app as ROOT.war to 
>> $TOMCAT_HOME/webapps ?
> 
> It's not deployed as a WAR, but as webapps/ROOT (exploded WAR
> directory).

For completeness, this is what is contained in my ROOT directory
("deploy" is my CATALINA_BASE for Tomcat):

deploy/webapps/ROOT
deploy/webapps/ROOT/WEB-INF
deploy/webapps/ROOT/WEB-INF/classes
deploy/webapps/ROOT/WEB-INF/classes/com
deploy/webapps/ROOT/WEB-INF/classes/my/project
deploy/webapps/ROOT/WEB-INF/classes/my/project/business
deploy/webapps/ROOT/WEB-INF/classes/my/project/business/BaseAction.class
deploy/webapps/ROOT/WEB-INF/classes/my/project/business/ListAction.class
deploy/webapps/ROOT/WEB-INF/classes/struts.xml
deploy/webapps/ROOT/WEB-INF/lib
deploy/webapps/ROOT/WEB-INF/lib/commons-fileupload-1.3.1.jar
deploy/webapps/ROOT/WEB-INF/lib/commons-io-2.2.jar
deploy/webapps/ROOT/WEB-INF/lib/commons-lang3-3.2.jar
deploy/webapps/ROOT/WEB-INF/lib/commons-logging-1.1.3.jar
deploy/webapps/ROOT/WEB-INF/lib/commons-logging-api-1.1.jar
deploy/webapps/ROOT/WEB-INF/lib/freemarker-2.3.22.jar
deploy/webapps/ROOT/WEB-INF/lib/javassist-3.11.0.GA.jar
deploy/webapps/ROOT/WEB-INF/lib/ognl-3.0.6.jar
deploy/webapps/ROOT/WEB-INF/lib/struts2-core-2.3.24.1.jar
deploy/webapps/ROOT/WEB-INF/lib/xwork-core-2.3.24.1.jar
deploy/webapps/ROOT/WEB-INF/list.jsp
deploy/webapps/ROOT/WEB-INF/web.xml

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWCBPJAAoJEBzwKT+lPKRYeJsP/AlAP3VoL16o2MTV3qau+zNQ
YLRPkW2qmP2EwIrDBhuhPJeKy/3pt3292Hit0E9KOfoAw5F5/XSEmaPqw6YsvCUp
SN6LgRm9avhdGZyullnuRba/5RN3epjIdT/T+t33KTIyJ2a1aw5hunnx3mNj3qmZ
h0c3UU4CeJDSCfnzvuF86Tzw3OP2+1H+JyKt2cuZZcIs9YGYvM7szqU22mIZ6JO9
i59D44PNVRLtFV/ijzHB4FRM/OIoDRFYLsnrfDi2aqfoQKMYpw5xzB8sM8wo4Hjt
uC0S9ULdlB4VI15FRun/7xUWjPsFG29EWhPR+GBtRIQ+EBnd7JwmhbNERnlCpah/
FADsrQTc5jFHtKPBcrIZS6MHzzXMW98KG4Yj1+PeXCF6IPJsl4jWCr82xhdA0+RV
k3RgLV8deMypGAKrS9K4NG45dkNOKXUHAg6M3nz/M98XTwKLeoxhRxSJUKDWU0/A
6A37iMOTkjrBNbbIItjiE1RscOo0eiNyV8n5ojZMNZy+QivwtpCfX/K3VcMsCQ6E
zTqebLz3J3ga7WRb1iLYhpQbkSGkO5j51k2lYCsn38pWsAPAMSstX/Zit9eAkSPc
LSeRQ4eJUin5ukp3BR5v62n87lJsG0+aVadVuswhE0jlMydX4/6Ps7CQ8zw9K4kt
S9Ih0aoufDGh2BQpuE7s
=p199
-----END PGP SIGNATURE-----

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


Mime
View raw message