This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an " Watch "Struts2 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an " New topic
Author

Struts2 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an

madhun reddy
Greenhorn

Joined: Sep 29, 2011
Posts: 4
Hi
I am new to struts2 and I am getting following exception, my entire project got stuckup due to this.

I am using Struts2 and Spring 3.0.
When I call this http://localhost:8080/security.ac/actions/populateRole.action, I am getting this exception.


java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [roleservice]
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:87)

My Struts.xml
=============
<package name="default" namespace="/actions" extends="struts-default">
<action name="populateRole" method="populate" class="roleservice">
<result name="populate">/DisplayRole.jsp</result>
</action>
<action name="createRole" method="doCreate" class="roleservice">
<result name="success" type="redirect">listRole</result>
<result name="input">/DisplayRole.jsp</result>
</action>
<action name="updateRole" method="doUpdate" class="roleservice">
<result name="success" type="redirect">listRole</result>
<result name="input">/DisplayRole.jsp</result>
</action>
<action name="listRole" method="doList" class="roleservice">
<result name="success">/ListRole.jsp</result>
</action>
<action name="editRole" method="doEdit" class="roleservice">
<result name="success">/DisplayRole.jsp</result>
</action>
<action name="deleteRole" method="doDelete" class="roleservice">
<result name="success" type="redirect">listRole</result>
</action>
</package>

My applicationContext.xml has

<bean name="roleservice" class="com.companyapk.security.ac.action.RoleServiceAction">
<property name="roleserviceBO" ref="roleserviceBO"></property>
<property name="itemserviceBO" ref="itemserviceBO"></property>
</bean>

<bean name="roleserviceBO" class="com.companyapk.security.ac.bs.RoleServiceBOImpl">
<property name="roleserviceDAO" ref="roleserviceDAO"></property>
</bean>

<bean id="roleserviceDAO" class="com.companyapk.security.ac.dao.RoleServiceDAOImpl">
<property name="itemserviceDAO" ref="itemserviceDAO"></property>
<property name="dataSource" ref="dataSource"/>
</bean>

My servlet class:
public class ItemServiceAction extends com.opensymphony.xwork2.ActionSupport
implements ModelDriven<ItemDO> {

private static final long serialVersionUID = 3777666021811678484L;

ItemServiceBO itemserviceBO;

ActionServiceBO actionserviceBO;

ItemDO itemDO = new ItemDO();

List<ItemDO> itemDOList = new ArrayList<ItemDO>();

List<String> selectedActions = new ArrayList<String>();

List<String> actionList = new ArrayList<String>();

String editMode = "add";


static {
ConvertUtils.register(new SqlDateConverter(null), java.sql.Date.class);
}

public void setitemserviceBO(ItemServiceBO itemserviceBO) {
this.itemserviceBO = itemserviceBO;
}

public void setactionserviceBO(ActionServiceBO actionserviceBO) {
this.actionserviceBO = actionserviceBO;
}

public void setItemDO(ItemDO itemDO) {
this.itemDO = itemDO;
}

public List<ItemDO> getItemDOList() {
return itemDOList;
}

public void setItemDOList(List<ItemDO> itemDOList) {
this.itemDOList = itemDOList;
}

public ItemDO getModel() {
return itemDO;
}

public String getEditMode() {
return editMode;
}

public void setEditMode(String editMode) {
this.editMode = editMode;
}

public String execute() {
return SUCCESS;
}

public String doCreate() {

itemDO.setActions(getSelectedActionDOs());
this.itemserviceBO.addItem(itemDO);
return SUCCESS;

}

public String populate() {

List<ActionDO> actions = actionserviceBO.loadAction();

this.actionList = new ArrayList<String>();
for (int i = 0; i < actions.size(); i++) {
actionList.add(actions.get(i).getName());
}
return "populate";
}

public String doUpdate() {

itemDO.setActions(getSelectedActionDOs());
this.itemserviceBO.saveItem(itemDO);
return SUCCESS;
}

public String doDelete() {

HttpServletRequest request = (HttpServletRequest) ActionContext
.getContext().get(ServletActionContext.HTTP_REQUEST);

ItemDO a = new ItemDO();
a.setName(request.getParameter("name"));

this.itemserviceBO.deleteItem(a);
return SUCCESS;
}

public String doEdit() {

this.editMode = "edit";
return doRead();
}

public String doRead() {

HttpServletRequest request = (HttpServletRequest) ActionContext
.getContext().get(ServletActionContext.HTTP_REQUEST);

ItemDO a = new ItemDO();
a.setName(request.getParameter("name"));

this.itemDO = this.itemserviceBO.viewItem(a);
populate();
return SUCCESS;
}

public String doList() {

this.itemDOList = itemserviceBO.loadItem();
if (this.itemDOList == null) itemDOList = new ArrayList<ItemDO>();
return SUCCESS;
}

public List<String> getSelectedActions() {
return selectedActions;
}

public void setSelectedActions(List<String> selectedActions) {
this.selectedActions = selectedActions;
}

public List<String> getActionList() {
return this.actionList;
}

public void setActionList(List<String> actionList) {
this.actionList = actionList;
}

protected List<ActionDO> getSelectedActionDOs() {

List<ActionDO> list = new ArrayList<ActionDO>();
for (int i = 0; i < selectedActions.size(); i++) {
ActionDO action = new ActionDO();
action.setName(selectedActions.get(i));
list.add(action);
}
return list;
}
}

Please let me know what is the problem in this code.
Thanks inadvance for help.

thanks
Madhu
madhun reddy
Greenhorn

Joined: Sep 29, 2011
Posts: 4
Got the issue solved, it has to do something with action validation.xml files. I temporerly removed them and the app is working fine. need to check what really is wrong with validation file.
Binay Shakya
Greenhorn

Joined: Nov 01, 2012
Posts: 1
@madhum reddy Faced same problem, but in the above case what actually is wrong in the actionname-validation.xml file?
 
GeeCON Prague 2014
 
subject: Struts2 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an