Name for argument type [java.lang.String] not available

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/kouwoo/article/details/42869779

今天把项目打包,运行的时候报了如下的异常:

java.lang.IllegalArgumentException: Name for argument type [java.lang.String] not available, and parameter name information not found in class file either.
	org.springframework.util.Assert.notNull(Assert.java:112)
	org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.updateNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:144)
	org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.getNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:123)
	org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:84)
	org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
	org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	net.spring.web.XssFilter.doFilter(Unknown Source)

原因分析:

因为我在请求的方法里,需要传入一个参数

	@RequestMapping("hello")
	public String helloWorld(Map<String, Object> map, HttpServletRequest request,@RequestParam(required = false) String hhh) {

		System.out.println("hello");
		System.out.println("["+hhh+"]");
		map.put("message", "test message111");
		return "helloView";
	}

从网上找到解决的方法:http://blueram.iteye.com/blog/1921693

eclipse默认是debug级别的函数里面的参数名保留,但是ant编译就不行了。

解决方法1:写全@RequestParam的参数

	@RequestMapping("hello")
	public String helloWorld(Map<String, Object> map, HttpServletRequest request,@RequestParam(value="hhh", required = false) String hhh) {

		System.out.println("hello");
		System.out.println("["+hhh+"]");
		map.put("message", "test message111");
		return "helloView";
	}

解决方法2:修改build.xml,使用javac  debug=true

		<javac srcdir="${src}" destdir="${build}/WEB-INF/classes" debug="true" encoding="utf-8" classpathref="classpath" includeantruntime="on">
		</javac>

最后需要把先stop tomcate,然后把Tomcat 7.0\webapps下的项目文件夹删除,然后再start tomcat,这样问题就解决了。

在eclipse开发的时候,自动编译的情况下也会出现这样的问题,是因为自动编译的设置问题,如下:


展开阅读全文

The operator * is undefined for the argument type(s) java.lang.String, java.lang

05-23

以下是我的代码,jsp文件中的java代码,是要向数据库进行插入操作rnrnString driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // 加载JDBC驱动rn String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=memberdb"; // 连接服务器和数据库rn Connection conn ;rn try rn Class.forName(driverNamern conn = DriverManager.getConnection(dbURL,"sa","123456");rn Statement stmt;rn ResultSet res;rn stmt=conn.createStatement();rn res = stmt.executeQuery("select * from card"); rn //处理结果集rn request.setCharacterEncoding("gb2312");rn String me_id = request.getParameter("userid");rn String me_name = request.getParameter("me_name");rn String me_gender = request.getParameter("me_gender");rn String me_birth =request.getParameter("me_birth");rn String me_phone = request.getParameter("me_phone");rn String me_address = request.getParameter("me_address");rn String me_mail = request.getParameter("me_mail");rn String me_job = request.getParameter("me_job");rn rn String sql="INSERT INTO member VALUES ('"+me_id+"','"+me_name+"','"+me_gender+"','"+me_gender+"','"+me_birth+"','"+me_phone+"','"+me_address+"','"+me_mail+"','"+me_job+"')";rn stmt.executeUpdate(sql);rn rn String ca_passwd = request.getParameter("password");rn String br_name = request.getParameter("br_name");rn int ca_pledge = Integer.parseInt(request.getParameter("ca_pledge"));rn String ca_status = new String("正常");rn int ca_balance = Integer.parseInt(request.getParameter("ca_balance"));rn String ca_effective_date = request.getParameter("date_year")+"-"+ request.getParameter("date_month")+"-"+ request.getParameter("date_day");rn String ca_expiry_date = request.getParameter("date_year2")+"-"+ request.getParameter("date_month2")+"-"+ request.getParameter("date_day2");rn String ca_detail = request.getParameter("ca_detail");rn rn String sql2="INSERT INTO card VALUES ('"+me_id+"','"+ca_passwd+"','"+ca_status+"','"br_name"','"+ca_balance+"','"+ca_effective_date+"','"+ca_expiry_date+"','"+ca_detail+"')";rn stmt.executeUpdate(sql2);rn out.println(" ");rn rn res.close();rn stmt.close();rn conn.close();rn catch (Exception ex) rn System.out.println("Error : " + ex.toString());rn 论坛

No mapping found for dependency [type=java.lang.String, name='actionPackages']

08-21

struts2-codebehind包引起了rnjava.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='actionPackages'] in public void org.apache.struts2.config.ClasspathPackageProvider.setActionPackages(java.lang.String).rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)rn at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:540)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:538)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:198)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)rn at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)rn at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)rn at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)rn at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)rn at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)rn at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)rn at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)rn at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)rn at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)rn at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)rn at org.mortbay.jetty.plugin.AbstractJettyRunMojo.restartWebApp(AbstractJettyRunMojo.java:441)rn at org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged(AbstractJettyRunMojo.java:402)rn at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)rn at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)rn at org.mortbay.util.Scanner.scan(Scanner.java:280)rn at org.mortbay.util.Scanner$1.run(Scanner.java:232)rn at java.util.TimerThread.mainLoop(Timer.java:512)rn at java.util.TimerThread.run(Timer.java:462)rnCaused by: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='actionPackages'] in public void org.apache.struts2.config.ClasspathPackageProvider.setActionPackages(java.lang.String).rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:495)rn at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:532)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:530)rn at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)rn ... 27 morernCaused by: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='actionPackages'] in public void org.apache.struts2.config.ClasspathPackageProvider.setActionPackages(java.lang.String).rn at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:144)rn at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMethods(ContainerImpl.java:113)rn at com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.java:90)rn at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:71)rn at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:69)rn at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:150)rn at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)rn at java.util.concurrent.FutureTask.run(FutureTask.java:138)rn at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:76)rn at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:116)rn……………………………………………………rn .但是将这个包删除了以后为什么还是报这个错呢??????后来我将web项目重新拷贝一份和原来一样的,运行就不报这个错了,这是为什么呢?请各位高手指教一下我这个菜鸟………………多谢多谢 论坛

argument type mismatch

10-11

exceptionrnrnjavax.servlet.ServletException: BeanUtils.populatern org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)rn org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn com.oa.filter.EncodingFilter.doFilter(EncodingFilter.java:23)rnrnroot causernrnjava.lang.IllegalArgumentException: argument type mismatchrn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)rn org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)rn org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)rn org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)rn org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)rn org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)rn org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn com.oa.filter.EncodingFilter.doFilter(EncodingFilter.java:23)rnrnrnrn 加了:encType=multipart/form-datarnrn 页面数据绑定到form时数据类型也匹配rnrnrn 不是上面的两个问题,高手帮忙,请问是什么问题?rnrnrn 论坛

struts+hibernate出现argument type mismatch

06-22

错误信息如下:rnrnERROR - Servlet.service() for servlet action threw exceptionrnjava.lang.IllegalArgumentException: argument type mismatchrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:585)rn at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)rn at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)rn at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)rn at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)rn at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)rn at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)rn at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at com.tf.util.CharSet.doFilter(CharSet.java:61)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Thread.java:595)rnERROR - Servlet.service() for servlet action threw exceptionrnjava.lang.IllegalArgumentException: argument type mismatchrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:585)rn at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)rn at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)rn at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)rn at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)rn at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)rn at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)rn at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at com.tf.util.CharSet.doFilter(CharSet.java:61)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Thread.java:595)rnrn(debug执行到formBean 里的reset后就出错,validate没有执行)rnrn请问这个错误有可能出现在哪儿? 论坛

hibernate 报错:argument type mismatch

12-05

请教下我的配置错在哪儿?该如何改正:rnrnException in thread "main" org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of org.wangchao.association.Class.studentsrn at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)rn at org.hibernate.tuple.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:330)rn at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:188)rn at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)rn at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:253)rn at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:502)rn at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:494)rn at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)rn at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)rn at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)rn at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)rn at org.hibernate.engine.Cascade.cascade(Cascade.java:248)rn at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:385)rn at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:242)rn at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)rn at org.wangchao.association.Test.main(Test.java:78)rnCaused by: java.lang.IllegalArgumentException: argument type mismatchrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)rn ... 30 morernrnrnrnrnrnrnrnrnrnrnrnrn 论坛

Type error in argument 1 to `SetDIBitsToDevice';

02-22

错误提示:rnType error in argument 1 to `SetDIBitsToDevice'; found 'HWND' expected 'HDC'.rnrn前面声明为:rnBITMAPINFO info;rnunsigned char *pData;rnrn出错部分函数代码:rn memset(&info,0,sizeof(info));rn info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);rn info.bmiHeader.biWidth = W;rn info.bmiHeader.biHeight = -H;rn info.bmiHeader.biPlanes = 1;rn info.bmiHeader.biBitCount = 32;rn info.bmiHeader.biCompression = BI_RGB;rnrn rn *pData = NULL ;rn if(mIndex >=0 && mIndex <5 || NULL == mImgData)rn pData = mImgData + (mIndex-1)*W*H*4 ;rn SetDIBitsToDevice((HWND)imghandle,0,0,704,576,0,0,0,576,pData,&info,DIB_RGB_COLORS);//这里出错了。rnrnrn所有的这个文件的代码为:rnrn#include rn#include rn#include rn#include "windows.h"rn#include "niimaq.h"rn#include "nivision.h"rn#include "formatio.h"rn#include rn#include rn#include "serial.h"rn#include rn#include rn#include "asynctmr.h"rn#include rn#include rnrn rnBOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);rnBOOL __stdcall PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved));rnBOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd);rnVOID __stdcall PlayM4_YV12toRGB32(unsigned char* yv12, int width, int height, unsigned char* rgb);rnBOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize);rnrnrnrn#define WINDOW_TO_USE 0 rn#define MAX_THREADS 60rnrnHMODULE objDll;rnrnBOOL re=FALSE;rnunsigned char *mImgData = NULL ;rnunsigned char mTempData[720*576*4] ;rnunsigned char mTempDataSwap[720*576*4] ;rnHWND mHand ;rnrnImage *h264image;rn//Image *CopyTo_Image(unsigned char * ImagePtr, int LineWidth, int Width, int Height); rnrnrnrnint mIndex = 0 ;rnint W = 0 ;rnint H = 0 ;rnint Band = 0 ;rnlong nWidth;rnlong nHeight;rnlong nType;rn FILE * fp; rnrn rn//void IMAQ_CALLBACK ExtractImage (WindowEventType event, int windowNumber, Tool tool, Rect rect);rnvoid CALLBACK DisplayCallBackFunc(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved); rntypedef long int (*objFun_OpenStream)(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize); //定义函数指针rntypedef long int (*objFun_SetDisplayCallBack)(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved)); //定义函数指针rntypedef long int (*objFun_Play)(LONG nPort, HWND hWnd); //定义函数指针rntypedef long int (*objFun_YV12toRGB32)(unsigned char* yv12, int width, int height, unsigned char* rgb); //定义函数指针rntypedef long int (*objFun_InputData)(LONG nPort,PBYTE pBuf,DWORD nSize); //定义函数指针rntypedef long int (*objFun_CloseStream)(LONG nPort);rntypedef long int (*objFun_RefreshPlay)(LONG nPort);rnrnobjFun_OpenStream objOpenStreamAddress;rnobjFun_SetDisplayCallBack objSetDisplayCallBackAddress;rnobjFun_Play objPlayAddress;rnobjFun_YV12toRGB32 objYV12toRGB32Address;rnobjFun_InputData objInputDataAddress;rnobjFun_CloseStream objCloseStreamAddress;rnobjFun_RefreshPlay objRefreshPlayAddress;rn rnint linshi; rn rnstatic int mypanel;rn//HWND hwnd;rnint imghandle;rnstatic int ImaqHandle; // will contain the handle to the imaq windowrnstatic int windHandle; // will contain the handle to the CVI windowrnrnrnBITMAPINFO info;rnunsigned char *pData;rnrnrnint CVICALLBACK TimeToDo (int panel, int control, int event,rn void *callbackData, int eventData1, int eventData2)rnrn switch (event)rn rn case EVENT_TIMER_TICK:rn rn memset(&info,0,sizeof(info));rn info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);rn info.bmiHeader.biWidth = W;rn info.bmiHeader.biHeight = -H;rn info.bmiHeader.biPlanes = 1;rn info.bmiHeader.biBitCount = 32;rn info.bmiHeader.biCompression = BI_RGB;rnrn *pData = NULL ;rnrn if(mIndex >=0 && mIndex <5 || NULL == mImgData)rn pData = mImgData + (mIndex-1)*W*H*4 ;rn SetDIBitsToDevice((HWND)imghandle,0,0,rn 704,576,0,0,0,576,rn pData,&info,DIB_RGB_COLORS);rn break;rn rn return 0;rnrnrnint main (int argc, char *argv[])rnrn rn rn rn if (InitCVIRTE (0, argv, 0) == 0)rn return -1; /* out of memory */rn if ((mypanel = LoadPanel (0, "serial.uir", MYPANEL)) < 0)rn return -1;rn DisplayPanel (mypanel);rn //////////////////////////////////////////////////////////////rn //Onplay();rn ///*set the image window to be one part of the CVI windowrn imaqSetupWindow(WINDOW_TO_USE,0);rn imaqSetWindowPalette(WINDOW_TO_USE,2,NULL,0);rn windHandle = (int) FindWindow (NULL, "TARGET LOCATION"); rn //h264image= imaqCreateImage (IMAQ_IMAGE_RGB, 0); rn ImaqHandle = (int) imaqGetSystemWindowHandle(0); rn SetParent( (HWND) ImaqHandle, (HWND)windHandle);rn imaqSetWindowTitle( WINDOW_TO_USE, "Show Image" );rn imaqMoveWindow( WINDOW_TO_USE, imaqMakePoint(10,10));rn imaqSetCurrentTool (IMAQ_POINT_TOOL);rnrn RunUserInterface ();rn FreeLibrary(objDll); //卸载动态链接库.DLL,放在程序退出的函数里面rn DiscardPanel (mypanel);rn return 0;rnrnrnint CVICALLBACK quit (int panel, int control, int event,rn void *callbackData, int eventData1, int eventData2)rnrn switch (event)rn rn case EVENT_COMMIT:rn QuitUserInterface (0);rn break;rn rn return 0;rnrnrnint CVICALLBACK onplay (int panel, int control, int event,rn void *callbackData, int eventData1, int eventData2)rnrn int i;rn int fileLen;rn FILE *fp;rn unsigned char data[512] ;rn int times;rn int j;rn switch (event)rn rn case EVENT_COMMIT:rn ///////////////////////////////////////////////////////// rn SetCtrlAttribute(mypanel,MYPANEL_TIMER,ATTR_ENABLED,1);rnrn fp = fopen("VP0_cdv.264","rb");rn fseek(fp,0,SEEK_END);rn fileLen = ftell(fp);rn rewind(fp);rn //GetCtrlAttribute(mypanel,MYPANEL_TIMER,ATTR_ENABLED,&linshi);rn //printf("%d",linshi);rn rnrn times = fileLen/512 ;rnrn for(i=0; i=0 && mIndex <5)rn rn ///*rn if(NULL == mImgData)rn rn mImgData=(unsigned char*)malloc(sizeof(unsigned char)*nWidth*nHeight*4*6);rn rn rn if(NULL == mTempData)rn rn mImgData=(unsigned char*)malloc(sizeof(unsigned char)*nWidth*nHeight*4);rn //mTempData = new unsigned char[nWidth*nHeight*4];rn rn //*/rn rn re=(*objYV12toRGB32Address)((unsigned char*)pBuf,nWidth,nHeight,mTempData);rn W = nWidth ;rn H = nHeight ;rn Band = nType ;rnrn memcpy(mImgData + W*H*4*mIndex ,mTempData,W*H*4) ;rn memcpy(mTempDataSwap ,mTempData,W*H*4);rnrn mIndex++ ;rnrn if(mIndex >= 4)rn mIndex = 0 ;rnrn rn rn rnrn 论坛

奇怪的错误argument type mismatch??

10-11

[code=XML]rn严重: Servlet.service() for servlet action threw exceptionrnjava.lang.IllegalArgumentException: argument type mismatchrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)rn at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)rn at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)rn at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)rn at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)rn at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)rn at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)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:637)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.bjsxt.oa.web.PagerFilter.doFilter(PagerFilter.java:25)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.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)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.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)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:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnrn[/code]rnrnjsp:rn[code=HTML]rn 失效时间 rn rn 论坛

没有更多推荐了,返回首页