Struts2 DateTimepicker标签 和 java.lang.RuntimeException: Invalid action class configuration that refer

转载 2013年12月09日 08:39:18

异常:

java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [YunWeiAction]
	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)
	com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
	com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
	com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
	org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

root cause

java.lang.ClassNotFoundException: YunWeiAction
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
	org.apache.struts2.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:111)
	org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:98)
	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)
	com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:226)
	com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:367)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
	com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
	org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)


大致有三种可能原因:
(1)这个Action类的确是不存在,或者是在struts.xml中配置错了。  http://see-sea007.blog.163.com/blog/static/59008062201212951911913/ 
(2)没有合适的result name。如果result name错了的话,也有可能报这个错。 http://apps.hi.baidu.com/share/detail/57378863 
(3)JSP页面的错误。 http://blog.163.com/ztxz_179/blog/static/105205995201221711561637/ 

我是第三种!坑爹啊!下面的方式使用的checkbox标签错了!我不知道为什么!
<s:checkbox name="groupUser.oilele" fieldValue="1"
    value="groupUser.oilele" label="断油断电权限" />
<s:checkbox name="groupUser.modify" fieldValue="1"
    value="groupUser.modify" label="修改信息权限" />
<s:checkbox name="groupUser.export" fieldValue="1"
    value="groupUser.export" label="导出数据权限" />
(4)第四种可能就是Action错了。我出现了一次,是类型问题,我估计上面的错误还是类型问题!比如,前台界面中一个 <input type="text" value="2012-01-01" name="searchDate" />的
输入框,如果是让它对应后台Action中的Date类型的searchDate,那么可能就会出现这个错误!
我的解决办法是将Action中的Date改成String类型的,至于String和Date类型之间的转换我就使用DateFormat。不过,貌似还可以自定义类型转换器达到这个目的,可以查看书《深入浅出Struts2》,
里面有介绍。
例子:

前台JSP:
<input name="searchStartDate" type="text" class="dateinput" value="<s:property value="searchStartDate" />" /> - <input name="searchEndDate" type="text" class="dateinput" value="<s:property value="searchEndDate" />" />

 

后台Action:

复制代码
    /**
     * 日志管理
     * @return
     */
    public String logManager() {
        Calendar calendar = Calendar.getInstance();
        calendar.roll(Calendar.DATE, 1);//到下一天的凌晨
        Date endDate = calendar.getTime();
        calendar.roll(Calendar.DATE, -3);// 前三天的凌晨
        Date startDate = calendar.getTime();
        findLogList(startDate,endDate);
        searchEndDate = dateFormat.format(endDate);
        searchStartDate = dateFormat.format(startDate);
        return SUCCESS;
    }

    /**
     * 日志搜索
     * @return
     */
    public String logSearch() {
        // 转型 String->Date
        System.out.println(searchDate);
        System.out.println(searchDate.getDate());
        try {
            findLogList(dateFormat.parse(searchStartDate),dateFormat.parse(searchEndDate));
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        page = "YunWei_logManager";
        return TARGET;
    }

    // 内部方法,得到指定时间之内的日志列表
    private void findLogList(Date startDate,Date endDate) {
        System.out.println(searchStartDate);
        System.out.println(searchEndDate);
        // 得到总记录数
        total = logService.getCountByTimeBetween(startDate,endDate);
        // 得到总页数
        if (total % PAGESIZE == 0) {
            pages = total / PAGESIZE;
        } else {
            pages = total / PAGESIZE + 1;
        }
        // 得到当前的页索引
        if (pageIndex < 1)
            pageIndex = 1;
        if (pageIndex > pages)// 暂时不判断
            pageIndex = pages;
        logList = logService.findByTimeBetween(startDate, endDate, (pageIndex - 1) * PAGESIZE, PAGESIZE);
    }
复制代码

 

这种情况下的更好的解决办法是使用struts 2的datetimepicker标签:http://www.mkyong.com/struts2/struts-2-datetimepicker-example/

例子:记得将 struts-dojo-plugin.jar 包放到WEB-INF/lib下!

复制代码
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<sx:head />
</head>
<body>
<sx:datetimepicker name="date2" label="Format (dd-MMM-yyyy)" 
displayFormat="dd-MMM-yyyy" value="%{'2010-01-01'}"/>
复制代码

 

Action中定义为Date类型,传过来的值得到的也是Date类型!

前台JSP:

<td><sx:datetimepicker name="searchStartDate"
            displayFormat="yyyy-MM-dd" value="%{searchStartDate}" /> —— <sx:datetimepicker name="searchEndDate"
            displayFormat="yyyy-MM-dd" value="%{searchEndDate}" /> 
            </td>

 

后台Action:

复制代码
    /**
     * 日志管理
     * 
     * @return
     */
    public String logManager() {
        Calendar calendar = Calendar.getInstance();
        calendar.roll(Calendar.DATE, 1);// 到下一天的凌晨
        searchEndDate = calendar.getTime();
        calendar.roll(Calendar.DATE, -3);// 前三天的凌晨
        searchStartDate = calendar.getTime();
        findLogList(searchStartDate, searchEndDate);
        return SUCCESS;
    }

    /**
     * 日志搜索
     * 
     * @return
     */
    public String logSearch() {
        // 转型 String->Date
        findLogList(searchStartDate, searchEndDate);
        page = "YunWei_logManager";
        return TARGET;
    }

    // 内部方法,得到指定时间之内的日志列表
    private void findLogList(Date startDate, Date endDate) {
        System.out.println(searchStartDate);
        System.out.println(searchEndDate);
        // 得到总记录数
        total = logService.getCountByTimeBetween(startDate, endDate);
        // 得到总页数
        if (total % PAGESIZE == 0) {
            pages = total / PAGESIZE;
        } else {
            pages = total / PAGESIZE + 1;
        }
        // 得到当前的页索引
        if (pageIndex < 1)
            pageIndex = 1;
        if (pageIndex > pages)// 暂时不判断
            pageIndex = pages;
        logList = logService.findByTimeBetween(startDate, endDate, (pageIndex - 1) * PAGESIZE, PAGESIZE);
    }
复制代码

 

这样子,代码简洁多了!

 

解决Invalid action class configuration that references an unknown class named [xxxxxxxxx]

今天遇到这个奇怪的异常: Stacktraces java.lang.RuntimeException: Invalid action class configuration that refer...
  • lc0817
  • lc0817
  • 2015年07月11日 21:52
  • 3524

java.lang.RuntimeException: Invalid action class configuration that references an unknown class name

java.lang.RuntimeException: Invalid action class configuration that references an unknown class name...
  • johnjobs
  • johnjobs
  • 2013年10月08日 10:34
  • 1972

Invalid action class configuration that references an unknown class named[XXXAction]

这是晚上我在写项目一个注册功能遇到的异常,说我自己写一个action引用了一个无效的action name的命名,我就纳了闷了,之前用这个action做查询没问题啊,闹了一晚上,想撞墙扑街的心情都有了...
  • boloyz
  • boloyz
  • 2012年12月09日 01:39
  • 1020

个人碰到的Invalid action class configuration that references an unknown class named [peopleAction]

最近在开发中碰到了几个提交表单后找不到anction类的问题,这问题还比较奇葩,平常正常访问的类,在访问一些方法时突然报unknow class,而且该类下其他本来能正常访问的类方法也不能访问(报同样...
  • qq_25446247
  • qq_25446247
  • 2016年08月08日 15:03
  • 183

Struts2的Invalid action class configuration that references an unknown class或者Could not find action

Caused by: Caused by:java.lang.RuntimeException: Invalid action class configuration that references ...
  • beyond4314403
  • beyond4314403
  • 2014年03月25日 17:34
  • 2458

java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [userRegisterAction]

错误是:java.lang.RuntimeException: Invalid action class configuration that references an unknown class ...
  • meifage
  • meifage
  • 2011年06月17日 07:55
  • 3212

struts2 datetimepicker标签的使用

http://blog.knowsky.com/194321.htm struts2中引入了时间标签,可以方便的自由选择时间 struts-tags"%> ...
  • caolaosanahnu
  • caolaosanahnu
  • 2014年06月08日 17:11
  • 657

struts2 Invalid action class configuration的处理

不知道是否有人和我一样使用struts2+spring+convention plugin+rest plugin。Invalid action class configuration的原因很多,而我...
  • zhangyiant
  • zhangyiant
  • 2017年04月05日 00:35
  • 268

java.lang.RuntimeException: Invalid action class configuration that references an unknown class nam

今天遇见一个问题,根据以往的排错经验都是从报错日志来查找问题的根源,今天突然发现,有些报错不是你自己 想所以然的觉得应该是什么问题,拿今天的例子举例: java.lang.RuntimeExc...
  • wang1472jian1110
  • wang1472jian1110
  • 2015年01月20日 08:33
  • 379

struts2中s:datetimepicker标签不能使用的问题解决

1.在2.1.6版本中不能直接这样使用了,将datetimepicker移除了。 原因是此标签调用了dojo的datetimepicker的库。 所以现在使用的时候首先要导入一个库。stru...
  • zc_ad
  • zc_ad
  • 2016年12月03日 18:44
  • 338
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Struts2 DateTimepicker标签 和 java.lang.RuntimeException: Invalid action class configuration that refer
举报原因:
原因补充:

(最多只允许输入30个字)