• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2: No configuration found for the specified action

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sigh, this shouldn't be difficult, but...

New to Struts2 and just trying a simple test program with little success. I've got a JSP welcome page, but tomcat (5.5) is giving a WARNING when I access the page:

WARNING: No configuration found for the specified action: 'showBooks' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

and when I submit the form I get:

There is no Action mapped for namespace / and action name showBooks.

I've read articles and archived topics until I'm cross-eyed, tried about a hundred variations, and none of them work. Here's the latest:

web.xml:


struts.xml (also tried struts-config.xml):


and finally request.jsp:



I've also tried adding a namespace to the s:sbumit, but with no luck either.

It's GOT to be something really stupid, but it's eluding me. Any assistance would b gratefully accepted.

Thanks in advance,
Bruce

oh, P.S. Not as critical, but also annoying: I want to be able to format my own forms (yeah, I know the above sucks, but it's just testing). I put the suggested:
<constant name="struts.ui.theme" value="simple" />
in my struts.xml, but it doesn't seem to have any effect. Struts is still trying to format my form. Any ideas? (if it's bad form to put multiple subjects into a topic I'll submit it separately).
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try extending the default Struts package; there are all sorts of other reasons your application will fail if you don't.
 
Bruce Steinback
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick response. Sigh, alas I'd also already tried that. But to be safe I tried again - only change in struts.xml:
<package name="default" extends="struts-default">

same result But please keep trying.

Curiously, I get tomcat log lines:

INFO: Unable to locate configuration files of the name struts-plugin.xml, skipping
Feb 25, 2010 8:58:33 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Feb 25, 2010 8:58:33 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Unable to locate configuration files of the name struts.xml, skipping
Feb 25, 2010 8:58:33 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]


not sure what they mean, if anything. Interestingly, I have no struts-plugin.xml file, but do have a struts.xml

One small amount of good news: I found that I could turn off form formatting with theme="simple" in the FORM field. Hey, at this point I'll take any success i can get.

Sigh,
Bruce
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Turn on devMode. What libraries are you deploying?
 
Bruce Steinback
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My, you're up early! (or is it just that I'm on Pacific time?)

Alas, I didn't appear to get any extra info out of setting devMode=true in struts.properties (I even checked that the properties file was being read by intentionally messing up a setting)

Here's my list of JARs in my /lib dir:
commons-dbcp-1.2.2.jar
commons-fileupload-1.2.1.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
mysql-connector-java-3.1.7-bin.jar
ognl-2.7.3.jar
struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar

Many thanks for trying to help! I'm utterly stumped.

Bruce
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need commons-io as well.

Also set logging level to DEBUG during issues like this. And you can use the config-browser plugin to inspect what S2 thinks your configuration is.
 
Bruce Steinback
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sigh, curiouser and curiouser. No change with commons-io-1.4.jar in the /lib

The struts site suggested that config-browser was bundled in the struts.jar, but when I tried putting in the sugested URL:
http://localhost:8080/hw3/config-browser/index.action
(I also tried several variations, which had even worse errors)

I got the error
There is no Action mapped for action name index.

I'd thought that setting logger to DEBUG only affected my own logging statements, but I'll give it a try and let you know

Sigh,
Bruce
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing suggests the config-browser is included in the core Struts jar, and it isn't--you'd need to deploy the config browser plugin (i.e., put it in the app's WEB-INF/lib dir).
 
Bruce Steinback
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whoops! Should have replied first I guess. Still learnin' the ropes here.

FYI, it was mostly my stupidity. I had tried putting struts.xml in the classes directory, but having gotten an exception (and no obvious error in the WEB-INF directory) I made the incorrect assumption that the classes directory was wrong (I had an error in my XML file that caused the exception).

Anyway, all's well now. Thanks much, David, for the help, and the cool tool - config-browser helped me get my namespaces right.

Cheers,
Bruce
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No sweat; glad you figured it out :)
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also have same kind of warning

my deatils are as below

struts.xml


<struts>
<package name="default" extends="struts-default">
<action name="User" class="vaannila.UserAction">
<result name="success">/success.jsp</result>
</action>
<action name="addUser" method="add" class="vaannila.UserAction">
<result name="success">/success.jsp</result>
</action>
<action name="updateUser" method="update" class="vaannila.UserAction">
<result name="success">/success.jsp</result>
</action>
<action name="deleteUser" method="delete" class="vaannila.UserAction">
<result name="success">/success.jsp</result>
</action>
</package>
</struts>




web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Struts2Example4</display-name>
<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>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>



index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="User" >
<s:submit />
<s:submit action="addUser" value="Add" />
<s:submit action="updateUser" value="Update" />
<s:submit action="deleteUser" value="Delete" />
</s:form>
</body>
</html>


success.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
${message}
</body>
</html>


UserAction.java

package vaannila;

import com.opensymphony.xwork2.ActionSupport;

public class UserAction extends ActionSupport{

private String message;

public String execute()
{
message = "Inside execute method";
return SUCCESS;
}

public String add()
{
message = "Inside add method";
return SUCCESS;
}

public String update()
{
message = "Inside update method";
return SUCCESS;
}

public String delete()
{
message = "Inside delete method";
return SUCCESS;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

}
 
Greenhorn
Posts: 6
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

To know more details about struts2 sample example with source code download from the below site try to run application

http://javavillage.in/helloWorldStruts2.php

reply
    Bookmark Topic Watch Topic
  • New Topic