• 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 Spring3 - java.lang.RuntimeException: Invalid action class configuration that references an

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@madhum reddy Faced same problem, but in the above case what actually is wrong in the actionname-validation.xml file?
 
reply
    Bookmark Topic Watch Topic
  • New Topic