java.lang.NoSuchMethodException

[code="java"]java.lang.NoSuchMethodException: com.kinrich.action.MediaAction.deleteMedia()
java.lang.Class.getMethod(Class.java:1581)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[/code]
[color=red]报错[/color]

[color=red]Action[/color]
[code="java"]
public String deleteMedia() throws Exception{
String[] mediaid = request.getParameterValues("mediaid");
for (int i = 0; i < mediaid.length; i++) {
manageMediaDao.deleteMedia(Integer.parseInt(mediaid[i]));
}
return getList();

}

[/code]

[color=red]页面[/color]
[code="java"]

function deleteMedia(){ if(confirm("你确定要删除?")){ form1.action="media!deleteMedia.action"; form1.method="post"; form1.submit(); } }
  <c:forEach var="medialist" items="${medialist}">
                        <tr>
                            <td class="alignM">
                                <input type="checkbox" name="mediaid" value="${medialist.id}" />
                            </td>


/c:forEach
[/code]

[color=red]struts[/color]
[code="java"]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">

<!-- spring提供的实现类, 作用:根据请求,到spring容器中寻找得到对应的Action -->
value="org.apache.struts2.spring.StrutsSpringObjectFactory" />

<package name="kinrich" extends="struts-default">
    <interceptors>
        <!-- Basic stack -->
        <interceptor-stack name="myStack">
            <interceptor-ref name="logger" />
            <interceptor-ref name="component" />
            <interceptor-ref name="servlet-config" />
            <interceptor-ref name="static-params" />
            <interceptor-ref name="params" />
            <interceptor-ref name="conversionError" />
            <interceptor-ref name="validation" />
            <interceptor-ref name="workflow" />
            <interceptor-ref name="defaultStack" />
        </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="myStack" />


    <action name="media" class="mediaAction">
        <result name="show">/ManageMemor.jsp</result>
        <result name="input">/updateToMemor.jsp</result>
    </action>
</package>


[/code]

0

4个回答

教你一个struts2的数组提交方式。
拿你的为例子:
多个checkbox.




页面上有四个checkbox,我这里都是直接写,你的可以用什么迭代之类的。
那在action类中我只写一个字段来接收所有的checkbox的name;
class MyAction extends ActionSupport {
private Integer mediaid;
//省略get/set
}
那么接收提交的时候,mediaid属性是一个包含了四个checkbox的值的一个字符串。
mediaid的值应该是“1, 2, 3, 4”,中间有一个空格。这个是struts2帮你实现了。
其实不需要像你那么接收数组。
在把字符串变成数组:
String[] mediaids = mediaids.split(", ");
这样做万无一失。我发现很多人都不会去很好的利用struts2的功能。

0

[code="xml"]


[/code]
加上extends="struts-default"看看

0

厄,不对,看错地方了,上面的无视啊

0

检查 deleteMedia是否是com.kinrich.action.MediaAction 下的方法。

查看MediaAction 是否编译。或者重新发布下项目。

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
运用反射时报错java.lang.NoSuchMethodException,以解决,记录一下
问题:想调用service类中的私有方法时, Method target=clz.getMethod("say", String.class);用Class的getMethod报错java.lang.NoSuchMethodException。rnrnrn解决方案:查了下Class的文档,该类下原来有两个方法:getMethod,getDeclaredMethod。看了下说明大概的意思就是getM
java.lang.NoSuchMethodException异常
根据方法名自动调用方法: 异常名称:java.lang.NoSuchMethodException 原因:自己定义的方法缺少request和response这两个参数!
poi导入excel时报java.lang.NoSuchMethodException。几经查询后,解决办法如下
在网上搜罗各种解决办法,然而都是说什么jar包冲突,我的并不是这个情况,然后我各种调试,换jar包,排查,最后把jar包的版本都选最高的,竟然解决了这个问题。原因是我的poi-ooxml 这个jar包版本太低了。我原来的jar版本是3.16。改为3.8版本后,运行没报错了!成功解决这个问题,记录一下给需要的人。...
json字符串换java对象时遇到NoSuchMethodException的问题
最近在最一个项目,项目中涉及到 json字符串 转换成 java对象,其中遇到一个问题,在这里记录一下。nn首先,我是按照下面博文的方式进行转的,地址如下:nnhttps://www.cnblogs.com/teach/p/5791029.htmlnn文中需要 json-lib 这个第三方jar包,我用了 Maven依赖,如下:nnn&amp;lt;dependency&amp;gt;n &amp;lt;gro...
使用反射时出现异常NoSuchMethodException解决
下面直接给出示例代码和解决方法
免费的库存管理软件
免费的库存管理软件,很好用的org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.io.File]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.io.File.()] with root cause java.lang.NoSuchMethodException: java.io.File.(
反射调用setMobileDataEnabled方法设置移动数据网络失败
从报错信息是提示找不到方法,于是我用反射的方法查看这个方法传入参数的形式,一看吓一跳,这个方法不只一个参数,需要两个参数nsetMobileDataEnabled(String packageName, boolean enable)//packageName为当前包名n可能是Android的版本不同导致的setMobileDataEnabled方法改变了nnn所以解决方法如下:n两行
Hadoop编程-自定义Hadoop数据类型报错:NoSuchMethodException
Hadoop拥有自己一个I/O机制,要用Mapper、Reducer对数据进行处理,就离不开Hadoop提供的I/O基础数据类型,Hadoop提供了BooleanWritable、ByteWritable、IntWritable、FloatWritable、DoubleWritable、LongWritable等。用Hadoop提供的这些基础数据类型,可以解决一些简单的数据处理,如:最常见的“词频
Java中反射调用私有方法出现NoSuchMethodException
在Java中调用私有方法时除了在调用之前需要设置setAccessible(true)之前,还需要注意getMethod和getDeclaredMethodrn调用实例:rnpackage com.jason.test;nn//测试类 nclass MyTest {n private void testCall() {n System.out.println("test");n
[即时问题解决]Java关于NoSuchMethod之类错误
很久没有更新Blog了,实属最近一段时间实在太忙了,最近才安稳下来,恰好遇到一个问题,顺手更新一篇nn最近做开发的时候遇到一个问题:java.lang.NoSuchMethodErrornn这其实确实是比较好处理的问题,我首先想到的就是会不会代码写得有误呢?那应该是不可能的,如果是代码写的有误,应该是在编译期间就报错了,为啥还会来到运行时呢。nn然后再一想,会不会是反射调用出现了问题呢?我顺着An...
mybatis 参数传入,以及#,$占位符区别
n 单个的string传递需要@Param否则会报没有get方法,设置不入sql参数(There is no getter for property named 'bz' in 'class java.lang.String')rn     map,实体等都会有内置的getterrn     public List&amp;lt;TbBasBedSrt&amp;gt; getTbBasBedSrtList(Map...
java 获取接口和类上的泛型类型
n n n interfacenType[] types = listener.getClass().getGenericInterfaces();nParameterizedType parameterized = (ParameterizedType) types[0];nClass&amp;lt;T&amp;gt; clazz = (Class&amp;lt;T&amp;gt;) parame...
Mybatis 分页详解
n n n 前言在学习mybatis等持久层框架的时候,会经常对数据进行增删改查操作,使用最多的是对数据库进行查询操作,如果查询大量数据的时候,我们往往使用分页进行查询,也就是每次处理小部分数据,这样对数据库压力就在可控范围内。分页的几种方式1. 内存分页内存分页的原理比较sb,就是一次性查询数据库中所有满足条件的记录,将这些数据临时保存在集合中,再通过List的su...
胡八一之Java(七):面向对象的陷阱
一、instanceof的陷阱:nn如果前面操作数的编译类型与后面的类型没有任何关系,那么编译将不通过。例如:nnnString a ="aaa";nSystem.out.println("a是否属于MATH的类型:"+(a.instanceof Math));nnString类型与Math无任何关系,所以编译不通过,那么instanceof编译通过的条件是什么?nn通过条件:前面的操作数类...
java.lang.NoSuchMethodException: .getPortClassMap()
NULL 博文链接:https://hw1287789687.iteye.com/blog/2034439
Android入门开发之Dialog实例
一、Dilog使用实例nactivity_main.xml文件:n<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"n xmlns:tools="http://schemas.android.com/tools"n android:layout_width="match_parent"
android studio运行程序时正常,调试时出现NoSuchMethodException的解决办法
前一段时间,我的Android项目,一调试就会跳到这个画面来,无法继续进行下去rn百度谷歌了很久都没找到问题解决方法rn今天发现这是android studio的一个bug,把所有断点都给去掉,然后就可以正常调试了
编写感知Session绑定状态的监听器是出现java.lang.NoSuchMethodException异常
在学习感知Session绑定的事件监听器时,编写的事件监听器实现了HttpSessionBindingListener接口,监听对象在Session域中的绑定和解绑事件,下面是我的代码:n实现HttpSessionBindingListener接口的JavaBean类:npackage Listener;nnimport javax.servlet.annotation.WebListener
增量升级重启服务器报 java.lang.NoSuchMethodException 解决
在现在的开发过程中,难免会碰到项目上线,而项目上线分为:增量升级和全量升级。增量升级就是只升级变化的内容,而全量升级就是整个项目打包上传升级。nn在这次升级的过程中,小编还是根据之前的操作将要升级的内容编译打包,然后上传到服务器,重启,等待下班,而往往现实跟自己的想法存在点偏差,服务器启动日志里面突然报出了个NoSuchMethodException,我一看,我...当时整个心情就不好了,第一反应...
kotlin使用反射(javaClass.getMethod)进行对象赋值时遇到的java.lang.NoSuchMethod问题
写法一:nval m = goodStock!!.javaClass.getMethd(&amp;quot;set$fieldName&amp;quot;, Float::class.java)nm.invoke(goodStock, if (valueStr.isNullOrEmpty()) null else valueStr.toFloat())nn在使用反射给对象赋值时,遇到如下报错:nn仔细查看报错能够发现setPound...
java 请求的方法不存在(NoSuchMethodException)
java 请求的方法不存在(NoSuchMethodException) java 请求的方法不存在(NoSuchMethodException)
Java.lang.String提供的常用的方法
Java.lang.String提供的常用的方法
java.lang.NoSuchMethodException: setId([Ljava.lang.String;)
写的一段程序可以正常运行,运行过程中报出以下异常:[code=text]rn2012-12-26 13:19:09 WARN OgnlValueStack:49 - Error setting valuernognl.MethodFailedException: Method "setId" failed for object 系统菜单:ID=0,菜单名=null,URL=null [java.lang.NoSuchMethodException: setId([Ljava.lang.String;)]rn at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)rn at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)rn at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)rn at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)rn at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)rn at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)rn at ognl.ASTProperty.setValueBody(ASTProperty.java:101)rn at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)rn at ognl.SimpleNode.setValue(SimpleNode.java:246)rn at ognl.ASTChain.setValueBody(ASTChain.java:172)rn at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)rn at ognl.SimpleNode.setValue(SimpleNode.java:246)rn at ognl.Ognl.setValue(Ognl.java:476)rn at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:273)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:187)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.esse.common.service.listener.CheckSessionFilter.doFilter(CheckSessionFilter.java:63)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.esse.common.service.listener.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:84)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)rn at java.lang.Thread.run(Thread.java:619)rnrn[/code]
NoSuchMethod异常信息解释
在应用运行时候,我们可能会遇到java.lang.NoSuchMethod异常,问题基本上就是jar包的依赖存在问题。通常异常日志信息会同下面的信息类似:Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.$init$()V这里我们该如何理解 scala.Product.initinit()V呢?其实上面的格式是
ofbiz 异常: Exception : java.lang.NoSuchMethodException
这几天在看ofbiz,出了个异常,搞不定,求大神。rnrn[img=https://img-bbs.csdn.net/upload/201408/29/1409309982_454084.png][/img]rnrnrnl类PracticeDepartmentEvents 代码如下:rnrnrnrn[img=https://img-bbs.csdn.net/upload/201408/29/1409310096_275072.png][/img]
求助,struts2 java.lang.NoSuchMethodException: com.opensymphony.xwork2.ActionSuppor
今天熟悉新公司项目,里面的sturts2 配置跟我平常看见的不一样,后来写了一个action报一下错误,望各位帮忙解答下,阿里嘎多。rnrnStacktracesrnrnjava.lang.NoSuchMethodException: com.opensymphony.xwork2.ActionSupport.assetlist()rn java.lang.Class.getMethod(Unknown Source)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn com.ssbank.filter.GzipFilter.doFilter(GzipFilter.java:60)rn org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)rn org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)rn org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)rn org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)rn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)rn org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)rn org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)rn org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)rn org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)rn java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Unknown Source)rn rnYou are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:rnrn struts.devMode=falsernin your WEB-INF/classes/struts.properties file.rnrn这是我的页面请求:rnrnstruts.xml:这个struts.xml我不是很明白配置。action通过注解实现的,但我对注解的认识很粗浅。rnrn rn rn rn rn rn rn rn rnrn rnrn rn rn /html/login.htmlrn $loginRedirectUrlrn rn rn /shoprn redirectrn $redirectUrlrn rn /WEB-INF/template/shop/invalid_token.ftlrn /WEB-INF/template/shop/error.ftlrn rn rn rn rn /WEB-INF/page/success.jsp rn rn rn /WEB-INF/template/shop/tradeReq.jsprn rn rn rnrnaction 代码:rn/**rn * rn * @author Administratorrn *rn */rn@ParentPackage("shop")rn@InterceptorRefs(rn @InterceptorRef(value = "memberVerifyInterceptor"),rn @InterceptorRef(value = "shopStack")rn)rn@Result(name = "assetlist", location = "/WEB-INF/template/shop/member_asset_list.ftl")rnpublic class MemberAssetAction extends BaseShopAction rnrn private static final long serialVersionUID = -3568504222758246021L;rn private Member member;rn private String message ;rn @Resourcern MemberService memberService;rn rn public String list()rn rn return "assetlist";rn rn rnrnrn
报错java.lang.NoSuchMethodException怎么解决?
错误如下:rnrn严重: Servlet.service() for servlet action threw exceptionrnjava.lang.NoSuchMethodException: Action[/stuInfo] does not contain specified metrnhod (check logs)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:rn264)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcesrnsor.java:431)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationrnFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChrnain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.jarnva:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.jarnva:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128rn)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102rn)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.javarn:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Httprn11Protocol.java:584)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rnrnrnrn我的action是:rnrnpublic class UserInfoAction extends DispatchAction rn rn private UserBiz biz = new UserBizImpl();rn rn public ActionForward doLogin(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn rn UserInfoForm userInfoForm = (UserInfoForm) form;// TODO Auto-generated method stubrn Admin admin = new Admin();rn admin.setId(userInfoForm.getId());rn admin.setUsername(userInfoForm.getUsername());rn admin.setPassword(userInfoForm.getPassword());rn if (biz.login(admin)) rn HttpSession session = request.getSession();rn session.setAttribute("admin", admin);rn return mapping.findForward("login_success");rn rn return mapping.findForward("login_fail");rn rn rnrnrnrnform如下:rnrnpublic class UserInfoForm extends ActionForm rn rn private Integer id;rn private String username;rn private String password;rn rn rnrn public Integer getId() rn return id;rn rnrn public void setId(Integer id) rn this.id = id;rn rnrn public String getUsername() rn return username;rn rnrn public void setUsername(String username) rn this.username = username;rn rnrn public String getPassword() rn return password;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrn rnrnrnrndao如下:rnrnpublic class UserDaoImpl implements UserDao rn public boolean isExist(Admin admin) rn Connection conn = null;rn PreparedStatement ps = null;rn ResultSet rs = null;rn try rn conn = DBGet.getConn();rn String sql = "select * from admin where username=?";rn ps = conn.prepareStatement(sql);rn ps.setString(1, admin.getUsername());rn rs = ps.executeQuery();rn if (rs.next()) rn if(admin.getPassword().equals(rs.getString("password"))) rn return true;rn rn rn catch (Exception e) rn e.printStackTrace();rn finally rn DBGet.closeResultSet(rs);rn DBGet.closePreparedStatement(ps);rn DBGet.closeConnection(conn);rn rnrn return false;rn rnrnrn这种情况怎么改呢?哪里错了?请教大家
struts 跳转java.lang.NoSuchMethodException
页面报这样的错误rnrnjava.lang.NoSuchMethodException: com.paraview.action.MainAction.regUser() rn java.lang.Class.getMethod(Class.java:1605)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)rn org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)rn org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)rn java.lang.Thread.run(Thread.java:619)rnrnrnrn可是我在jsp中写的action连的不是MainAction 而是另一个 spring配置文件和struts配置文件的路径rn都没错 rnrn rn rn 账号:rn rn rn 密码:rn rn rn rn rn rn rn rn rn
java.lang.NoSuchMethodException因该怎么改
高手们帮忙看看 这个错误 是什么? 应该怎么改?从哪些地方找错误!我做了好几个功能都保类似的错,程序是struts2+hibernate+spring的,谢谢了rnrn2010-4-11 15:09:01 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet default threw exceptionrnjava.lang.NoSuchMethodException: com.menu.struts.CharacteristicdishAction.delete()rn at java.lang.Class.getMethod(Unknown Source)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:55)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:41)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:184)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)rn at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)rn at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept
Java反射 java.lang.NoSuchMethodException
rnrn```rn public static void testTT() throws Exception rn Class clazz = Class.forName("reflect.Person");rn // 获得构造器rn Constructor constructor = clazz.getDeclaredConstructor(new Class[] );rn // 根据类的默认构造器来获得一个对象rn Object instance = constructor.newInstance(new Object[] );rn System.out.println(instance);rn rn Constructor constructor2 = clazzrn .getDeclaredConstructor(new Class[] Integer.class, String.class, Integer.class );rn Object instance2 = constructor2.newInstance(new Object[]1,"Tom",21);rn System.out.println(instance2);rn rn```rnrnrnrn```rn public Person(int id, String name, int age) rn super();rn this.id = id;rn this.name = name;rn this.age = age;rn rn```rnrnrn```rn Exception in thread "main" java.lang.NoSuchMethodException: reflect.Person.(java.lang.Integer, java.lang.String, java.lang.Integer)rn at java.lang.Class.getConstructor0(Unknown Source)rn at java.lang.Class.getDeclaredConstructor(Unknown Source)rn```rnrnrn
java.lang.NoSuchMethodException的一种可能错误
今天遇到了java.lang.NoSuchMethodException Error 500--Internal Server Error错误,原因是DispatchAction找不到action中对应的method,我的错误是将方法定义成private,索引DispatchAction是找不到对应方法的。希望能够帮助遇到该错误的同学。
mapreduce执行报错:java.lang.NoSuchMethodException:
13/11/07 08:45:08 INFO mapred.JobClient: Task Id : attempt_201311070843_0001_r_000000_0, Status : FAILEDrnjava.lang.RuntimeException: java.lang.NoSuchMethodException: com.group2.UserBean.()rn at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115)rn at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:62)rn at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:40)rn at org.apache.hadoop.mapreduce.ReduceContext.nextKeyValue(ReduceContext.java:117)rn at org.apache.hadoop.mapreduce.ReduceContext.nextKey(ReduceContext.java:92)rn at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:175)rn at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:572)rn at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:414)rn at org.apache.hadoop.mapred.Child$4.run(Child.java:266)rn at java.security.AccessController.doPrivileged(Native Method)rn at javax.security.auth.Subject.doAs(Subject.java:396)rn at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformrnattempt_201311070843_0001_r_000000_0: log4j:WARN No appenders could be found for logger (org.apache.hadoop.hdfs.DFSClient).rnattempt_201311070843_0001_r_000000_0: log4j:WARN Please initialize the log4j system properly.rnrnrn代码如下:rnpackage com.group2;rnpublic class DisGroupCount extends Configured implements Tool rnrn public int run(String[] args) throws Exception rn rn Job job = new Job(this.getConf());rn job.setJarByClass(this.getClass());rn job.setJobName("DisGroupCount");rn job.setMapperClass(DisGroupMapper.class);rn job.setReducerClass(DisGroupReduce.class);rn job.setMapOutputKeyClass(Text.class);rn job.setMapOutputValueClass(UserBean.class);rn job.setOutputKeyClass(NullWritable.class);rn job.setOutputValueClass(TextOutputFormat.class);rn FileInputFormat.addInputPath(job,new Path(args[0]));rn FileOutputFormat.setOutputPath(job,new Path(args[1]));rn return job.waitForCompletion(true) ? 0 : 1;rn rn public static void main(String[] args) throws Exception rn rn ToolRunner.run(new DisGroupCount(), args);rn rnrnrnpackage com.group2;rnpublic class DisGroupMapper extends Mapperrnrn protected void map(LongWritable key, Text value,Context context)throws IOException, InterruptedExceptionrn rn String[] values = value.toString().split(",");rn context.write(new Text(values[0]),new UserBean(new Text(values[1]),new LongWritable(Long.parseLong(values[2]))));rn rnrnpackage com.group2;rnpublic class DisGroupReduce extends Reducerrnrn protected void reduce(Text key,Iterable value,Context context) throws IOException, InterruptedExceptionrn rn HashSet tmpSet = new HashSet();rn long sum = 0l;rn while(value.iterator().hasNext())rn rn UserBean tmp = value.iterator().next();rn tmpSet.add(tmp.getEmpNo());rn sum += tmp.getSumAmr().get();rn rn String outValue = "时间:"+key.toString()+",人数合计:"+tmpSet.size()+",业绩合计:"+sum;rn context.write(null,new Text(outValue));rn rnrnrnpackage com.group2;rnpublic class UserBean implements Writable rnrn private Text empNo;rn private LongWritable sumAmr;rn public UserBean(Text empNo,LongWritable sumAmr)rn rn this.empNo = empNo;rn this.sumAmr = sumAmr;rn rn public void readFields(DataInput input) throws IOException rn rn empNo.readFields(input);rn sumAmr.readFields(input);rn rn public void write(DataOutput output) throws IOException rn rn empNo.write(output);rn sumAmr.write(output);rn rn public Text getEmpNo() rn return empNo;rn rn public void setEmpNo(Text empNo) rn this.empNo = empNo;rn rn public LongWritable getSumAmr() rn return sumAmr;rn rn public void setSumAmr(LongWritable sumAmr) rn this.sumAmr = sumAmr;rn rn
java.lang.NoSuchMethodException 出现怎么解决
项目是Spring 3.2 版本rnrn[code=java]java.lang.NoSuchMethodException: $Proxy5.getDateTime()rn at java.lang.Class.getMethod(Class.java:1605)rn at test.execute(CtrlCenter2.java:81)rn at log.doPost(WebPort.java:134)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:401)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:267)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:245)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260)rn at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)rn at java.lang.Thread.run(Thread.java:619)[/code]rnrnAccessManager类的方法:rnpublic void getDateTime()rn{rn}rnrnrn配置:rnrn
struts2异常java.lang.NoSuchMethodException: com.struts.action.UserAction.create()
原来用的struts2.0版本,运行项目没有问题。后来换了struts2.2.1版本后,只要访问Action,都会出现rnjava.lang.NoSuchMethodException: com.struts.action.UserAction.create()类似的错误,就是说Action中找不到create这个方法。rnstruts.xmlrn[code="xml"]rnrnrnrn rn rn rn rn rn rn rn rn login,registerrn updatern rn rn /main.jsprn /index.jsprn rn rn rnrn[/code]rn我设定的是方法拦截,所以当进入user_update.action的时候,没有问题,因为它可以进入拦截器。但是我没有拦截login和register方法,进入这两个方法时就会出错。说找不到create方法。我Action里面没有这个方法,肯定找不到。而且继承的ActionSupport的里面也没有这个方法,只有excute方法。不知道为什么struts会非要找这个create方法!后来上网查了半天,人家说去掉这部分就可以。rndefaults.xmlrn[code="xml"]rnrnrnrn rn rn /error.jsprn rn rn rn rn rn rn rnrn[/code]rn试了下,果然奏效。但是用原来struts2.0的版本没有这样的问题啊!不知道为什么,哪位高人来解释下,感激不尽!最好能带 struts的源代码分析下!还有struts2.0和2.1之后的地方,有哪些区别?rnrnrnrnrnrnOh My God!现在又不行了。不知道是不是我刚才手动加的create方法没去掉,现在又报这个错误,蛋疼啊!高手速来解答!感激不尽啊!rn
Cause: java.lang.NoSuchMethodException: spring_cache.springtest.dao.Employee.()?
![图片说明](https://img-ask.csdn.net/upload/201810/06/1538800958_237033.jpg)rnrn以下是pojorn```rn package spring_cache.springtest.pojo;rnrnpublic class Employee rn rn private Integer id;rn private String lastName;rn private String email;rn //性别 1男 0女rn private Integer gender;rn private Integer dId;rnrn public Employee() rn rnrnrn public Employee(Integer id, String lastName, String email, Integer gender, Integer dId) rn super();rn this.id = id;rn this.lastName = lastName;rn this.email = email;rn this.gender = gender;rn this.dId = dId;rn rn rn public Integer getId() rn return id;rn rn public void setId(Integer id) rn this.id = id;rn rn public String getLastName() rn return lastName;rn rn public void setLastName(String lastName) rn this.lastName = lastName;rn rn public String getEmail() rn return email;rn rn public void setEmail(String email) rn this.email = email;rn rn public Integer getGender() rn return gender;rn rn public void setGender(Integer gender) rn this.gender = gender;rn rn public Integer getdId() rn return dId;rn rn public void setdId(Integer dId) rn this.dId = dId;rn rn @Overridern public String toString() rn return "Employee [id=" + id + ", lastName=" + lastName + ", email=" + email + ", gender=" + gender + ", dId="rn + dId + "]";rn rn rn rnrnrnrn```rnmapper文件rnrn```rn package spring_cache.springtest.dao;rnrnimport org.apache.ibatis.annotations.*;rnrn/**rn * @author Dellrn */rn@Mapperrnpublic interface Employee rn @Select("SELECT * FROM employee WHERE id=#id")rn public Employee getEmployeeById(Integer id);rn @Update("update Employee set lastName=#lastName,email=#email,gender=#gender,d_id=#dId where id=#id")rn public Employee updateEmp(Employee emp);rn @Delete("delete from Employee where id=#id")rn public void deleteEmp(Employee emp);rn @Insert("insert into Employee(lastName,email,gender,d_id) values(#lastName,#email,#gender,#dId)")rn public void InsertEmp(Employee emp);rnrnrn```rnrn配置文件rnrn```rn spring.datasource.url=jdbc:mysql://localhost:3306/spring_cachernspring.datasource.username=rootrnspring.datasource.password=123rnrn```rn 测试类rn```rnpackage spring_cache.springtest;rnrnimport org.junit.Test;rnimport org.junit.runner.RunWith;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.boot.test.context.SpringBootTest;rnimport org.springframework.test.context.junit4.SpringRunner;rnimport spring_cache.springtest.dao.Employee;rnrn@RunWith(SpringRunner.class)rn@SpringBootTestrnpublic class SpringtestApplicationTests rn @Autowiredrn Employee employee;rn @Testrn public void contextLoads() rn Employee employeeById = employee.getEmployeeById(1);rn System.out.println(employeeById);rn rnrnrnrnrn```rn错误信息rnrn```rnCaused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating interface spring_cache.springtest.dao.Employee with invalid types () or values (). Cause: java.lang.NoSuchMethodException: spring_cache.springtest.dao.Employee.()rn rn```
java.lang.NoSuchMethodException: $Proxy13.get()帮忙看看。。
struts的配置文件rn[code=XML]rnrnrnrn rn rn rn rn yes.htmlrn no.jsprn rn rn yes.jsprn no.jsprn rn rn yes.jsprn no.jsprn rn rn rn[/code]rnspring 的配置文件rn[code=XML]rnrnrn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rnrn[/code]rnaction的代码rn[code=Java]rn rn public String Insert() rn //将页面填写的省,市,区,详细地址合并成送货地址rn this.purvey.setProvinces(this.getCity()+","+this.getRegion());rn String str=purveryBiz.insert(purvey);rn if(str =="插入成功")rn return SUCCESS;rn elsern return ERROR;rn rn rn public String update()rn String ret =purveryBiz.updateById(purvey);rn if(ret =="修改成功")rn return SUCCESS;rn rn return ERROR;rn rn rn public String get()rn List list = purveryBiz.getAll();rn if(list != null)rn ActionContext ac = ActionContext.getContext();rn ac.getSession().put("supplierList", list);rn return SUCCESS;rn elsern return ERROR;rn rn rn public String getByTrading()rn Purvey pu = this.purveryBiz.getByTrading(this.getTrading());rn if(pu != null)rn ActionContext ac = ActionContext.getContext();rn ac.getSession().put("purvey", pu);rn return SUCCESS;rn elsern rn return INPUT;rn rn rn rn rnrn[/code]rn页面的代码:rn[code=HTML]rn rn rn rn rn 供货商信息rn rn rn rn rn rn *供货商代码:rn rn rn rn rn rn *中文名称:rn rn rn rn rn rn rn rn *英文名称:rn rn rn rn rn rn *网址:rn rn rn rn rn rn rn rn *联系人:rn rn rn rn rn rn *联系电话:rn rn rn rn rn rn rn rn *省市:rn rn rn 国家 rn 省rn 市 rn rn rn *详细地址:rn rn rn rn rn rn rn rn *邮政编码:rn rn rn rn rn rn *企业简称:rn rn rn rn rn rn rn rn *开户银行:rn rn rn rn rn rn *账号:rn rn rn rn rn rn rn rn *收款单位:rn rn rn rn rn rn *付款条件:rn rn rn rn rn rn rn rn 备注:rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnrn报错。:rnjava.lang.NoSuchMethodException: $Proxy13.get()rn java.lang.Class.getMethod(Class.java:1605)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)rn
WebView 初始化失败
最近遇到一个奇怪的问题。我在创建一个Webview的时候,给我报空了。rn很奇怪,初始化报空,相信很多人都没有遇到过。rn而且公司只有那么一个机子出现问题了,其他的都是可以的。我就怀疑是机子问题,可是我去新建一个工程,去初始化WebView的时候,又成功了。这TM就尴尬了,到底是机子问题,还是代码问题呢?rn10-24 10:58:06.764 3957-3957/? E/AndroidRunti
通用mapper与pagehelper插件配置注意!!!
在mybatis的配置文件中,注意把pagehelper插件写在通用mapper前面rnrnrn否则会报rnorg.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method (com.
增量部署包出现java.lang.NoSuchMethodError异常解决过程
javaweb项目部署增量包时,出现了java.lang.NoSuchMethodError异常信息的诊断思路及解决办法
springboot启动异常
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory beannn或者nnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplic...
文章热词 机器学习教程 Objective-C培训 交互设计视频教程 颜色模型 设计制作学习
相关热词 mysql关联查询两次本表 native底部 react extjs glyph 图标 怎么学习互联网大数据 村干部学习大数据心得