二维数组赋值报空指针 [问题点数:20分,结帖人t55312153]

Bbs2
本版专家分:296
结帖率 96.72%
Bbs2
本版专家分:296
Bbs1
本版专家分:0
Bbs1
本版专家分:0
Bbs2
本版专家分:387
Bbs2
本版专家分:296
Bbs2
本版专家分:296
数组空指针解决
nullPointException : 使用list.isEmpty()的时候,出现<em>空指针</em>异常, 因为isEmpty() 判断的是list中的个数为空,不可以判断list集合是否为null,isEmpty需要在确定list不为null的情况下使用,, 可以这样if(list!=null){list.isEmpty()}, 更简单的方式是使用colllectionUtiles工具类 Co...
动态申请 二维数组 以及初始化、 赋值
动态分配数组 初始化
为什么二维数组不能赋值为二维指针
http://zhidao.baidu.com/link?url=cItXIye6gilS80l_w0lhg0cFnpqFZkjOO0lrx201k4NiB3_c_-nv4U6blaM5_oAnHtR_Z4o32Xdcu6rtKyYDi0FHoCO0YcI8rbCOLW8h1nK 我理解你的问题是不是这样:int a[3][4]; int**p = a;为什么会报错是吧? 回答:你理解的
二维数组的初始化(二维数组赋值
<em>二维数组</em>的初始化必须在声明的时候进行。否则会报错。 比如,你应该在声明它的时候就立即<em>赋值</em>: unsigned char bitmap[16][17]={{0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0},      {0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0},      {255,255,255,0,0,0,0,0,0,0
一个二维数组空指针异常问题。
![图片说明](https://img-ask.csdn.net/upload/201606/18/1466239385_520858.jpg)
二维数组空指针,打印杨辉三角
需求:输出杨辉三角 错误代码:import java.util.Scanner; class arraydemo3{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("请输入你要打印的杨辉三角形的行数"); int h = sc.nextI
bug ——setContentView 报空指针
今天跳转 Activity 的时候莫名其动不了,编译没报错。查了好一会才发现是标签大小写混了。(估计是打太快enter了,智能提示没跟上,233) &amp;lt;view     android:layout_width=&quot;match_parent&quot;     android:background=&quot;@color/backgroundGray&quot;     android:layout_height=&quot;1d...
支付宝demo报空指针
配置好信息后,运行demo,在 sign = URLEncoder.encode(sign, "UTF-8"); 这一行报<em>空指针</em>。这是由于支付宝针对的版本不同所造成的, 解决办法:找到SignUtils类, //添加 “BC” KeyFactory keyf = KeyFactory.getInstance(ALGORITHM,"BC"); 再次运行,一切正常。
空指针
为什么在pid = Integer.parseInt(strPid);里报<em>空指针</em>错那?rnrnrnrnrn rnrnrnrnrnrnrnrn rn Insert title herernrnrn 添加根类别rnrn rn rn rn rn rn 类别名称rn rn rn rn 类别描述rn rn rn rn rn rn rn rn rn rn rnrnrnrn
java中判断二维数组是否为空
<em>二维数组</em>为空,要检查三个部分: 一是数组首地址是否为空 二是是否为{},也就是array.length==0的情况 三是{{}},这时array.length=1,但是array[0].length==0。满足任意一个条件就可以返回false了。 if(array==null||(array!=null&&array.length==0)||(array!=null&&array.leng
java中如何判断二维数组是否为空
    在Java程序设计里面,相信大部分人都知道如何判断一个一维数组是否为空,示例如下:public int primeNumberCount(int[] array){ if(array==null||array.length==0) return 0;    那么在<em>二维数组</em>中,又如何判断<em>二维数组</em>为空呢?在判断之前,我们要先了解如何获取<em>二维数组</em>的行数和列数,示例如下:...
java数组空指针问题
在java中<em>空指针</em>异常算是一个比较棘手的问题,下面通过一个例子来讲解一下怎么处理<em>空指针</em>,以及出现<em>空指针</em>的问题比如,我们先建好一个Book类,里面包括name属性和bNumber(统计书的总数),并写出get和set方法。再写一个Test类,main方法中用数组保存100本书,并设置书的名称,最后打印书的总数和书的名字。Book类:public class Book { private Strin...
二维数组——矩阵赋值
1.问题描述 以矩阵格式输出一个<em>二维数组</em>,数组的主对角线上的元素<em>赋值</em>为1,其他元素<em>赋值</em>为0。 2编程分析 矩阵是用<em>二维数组</em>来存放的,题目要求矩阵主对角线的元素<em>赋值</em>为1,而主对角线在<em>二维数组</em>里的下标i,j的值相同,即当i=j时,a[i][j]=1,否则a[i][j]=0。 用C语言实现代码如下: #include &amp;amp;lt;stdio.h&amp;amp;gt; #include &amp;amp;lt...
java自定义的对象创建数组赋值,出现空指针异常问题
首先自定义Node对象 package User; public class Node { private int period;//周期(1-10) private int trustValue;//信任值(1-100) public Node() { } public Node(int period,int trustValue) { ...
二维数组赋值
今天项目在给<em>二维数组</em><em>赋值</em>过程中一直报错,是<em>空指针</em>异常。原来自己对<em>二维数组</em>初始化不了解。 这里总结一下: 下面是错误代码: String[][] temp = new String[src.length()][]; String[][] pinyinHead = new String[src.length()][]; for (int i = 0; i temp[i] = Piny
hibernate load 报空指针
根据主键IDload的时候报<em>空指针</em>rnshow_sql=truern在load的时候也没打印hqlrnID确认在数据库中存在rn配置方面都没问题rn登录都可以用rn[code=java]rn严重: Servlet.service() for servlet action threw exceptionrnjava.lang.NullPointerExceptionrn at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)rn at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)rn at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)rn at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)rn at org.hibernate.impl.SessionImpl.load(SessionImpl.java:781)rn at org.hibernate.impl.SessionImpl.load(SessionImpl.java:774)rn at org.springframework.orm.hibernate3.HibernateTemplate$3.doInHibernate(HibernateTemplate.java:508)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)rn at org.springframework.orm.hibernate3.HibernateTemplate.load(HibernateTemplate.java:502)rn at org.springframework.orm.hibernate3.HibernateTemplate.load(HibernateTemplate.java:496)rn at com.shinythink.DbOperration.PackagMethod.querys(PackagMethod.java:53)rn at com.shinythink.Dao.Impl.UserListDaoImpl.loadUserListWhereId(UserListDaoImpl.java:31)rn at com.shinythink.Service.Impl.UserListServiceImpl.updatePassWord(UserListServiceImpl.java:51)rn 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy1.updatePassWord(Unknown Source)rn at com.shinythink.Action.UserListAction.UpdatePassWord(UserListAction.java:77)rn 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.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.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: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 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:127)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:298)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn at java.lang.Thread.run(Thread.java:662)rnrn[/code]rnrnrn谁帮忙看看是什么问题.rn谢谢了.
Xml解析报空指针
请教各位前辈,xml解析过程中<em>空指针</em>怎么破,我找了一天了也没找到解决办法rn[img=https://img-bbs.csdn.net/upload/201601/07/1452155445_737406.png][/img]rn日志上说蓝色那排<em>空指针</em>rn这是解析类:rnpackage com.hande.publichealth.util;rnrnimport java.io.File;rnimport java.io.FileInputStream;rnimport java.io.IOException;rnimport java.io.InputStream;rnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnimport java.util.Map;rnrnimport org.xmlpull.v1.XmlPullParser;rnrnimport android.util.Log;rnimport android.util.Xml;rnrnimport com.hande.publichealth.global.Global;rnrn/**rn * 解析文件rn * rn * @author Adminrn *rn */rnpublic class ParsingUtil rn public static final String TAG = "ParsingUtil";rn /** 解析公共健康, format.xml文件 **/rn public static List>> parseHealthConsult() rn rn List>> list = null;rn File file = new File(Global.GGJK_XML_PATH);rn InputStream in = null;rn if (file.exists()) rn try rn in = new FileInputStream(file);rn XmlPullParser mXmlPullParser = Xml.newPullParser();rn mXmlPullParser.setInput(in, "UTF-8");rn int type = mXmlPullParser.getEventType();rn List> data = null;rn Map map = null;rn while (XmlPullParser.END_DOCUMENT != type) rn String name = mXmlPullParser.getName();// 标签名rn switch (type) rn case XmlPullParser.START_DOCUMENT:rn list = new ArrayList>>();rnrn break;rn case XmlPullParser.START_TAG:rn if ("arrayList".equals(name)) rn data = new ArrayList>();rn rn if ("Item".equals(name)) rn map = new HashMap();rn rn if ("Title".equals(name))rn map.put("title",mXmlPullParser.nextText());rn rn if ("Source".equals(name)) rn map.put("source", mXmlPullParser.nextText());rn rn if ("Number".equals(name)) rn map.put("number", mXmlPullParser.nextText());rn rn if ("Time".equals(name)) rn map.put("time", mXmlPullParser.nextText());rn rn if ("Imageurl".equals(name))rn map.put("img", mXmlPullParser.nextText()); rn rn if ("Htmlurl".equals(name))rn map.put(name, mXmlPullParser.nextText());rn rn break;rn case XmlPullParser.END_TAG:rn if ("Item".equals(name)) rn data.add(map);rn map = null;rn rn if ("arrayList".equals(name)) rn list.add(data);rn data = null;rn rn break;rn rn type = mXmlPullParser.next();rn rnrn catch (Exception e) rn e.printStackTrace();rn finallyrnrn if (in != null) rn try rn in.close();rn in = null;rn catch (IOException e) rn e.printStackTrace();rn rn rn rn rn else rn Log.e(TAG, "公共健康==>format.xml文件丢失!");rn rn return list;rn rnrn根据打印的日志文件,解析类就只执行了Log.e(TAG, "公共健康==>format.xml文件丢失!");这行,有人说可能是节点名字写错了,但我挨个复制节点名字后还是<em>空指针</em>,恳请各位前辈指点,感激不尽
spring注入报空指针
rn rn rn rn rn rn rnpublic class LoginAction extends ActionSupport rn private String username; // 用户名rn private String password; // 密码rn private UserService userService;rnpublic void setUserService(UserService userService) rn this.userService = userService;rn rnpublic String execute() throws Exception rn if (userService.login(username, password)) // 判断是否登录rn return "success"; // 返回成功字符串rn else rn return "fail"; // 返回失败字符串rn rn rnjava.lang.NullPointerExceptionrn com.gy.action.LoginAction.execute(LoginAction.java:32)rnrn省略部分测试代码,应该是spring注入问题,控制台直接读application.xml可以注入,但发布到tomcat userService就成<em>空指针</em>出错 ,请高手赐教!rn
使用butterknife报空指针
一、首先你使用的是哪个版本的 若是8.0.1以前的直接在build.gradle中添加 compile 'com.jakewharton:butterknife:7.0.1' 就Ok了 但是你要直接将7.0.1替换成8.0.1以后的版本,编译不会报错,当你运行使用控件时会报<em>空指针</em>, 解决方法:1、在项目最外层的build.gradle中添加 classpath 'com.nee
CXF报空指针
最近用cxf开发,将hibernate\spring集成到一个web工程中,但在执行hql语句时,在一个action中,有的hql执行就没有问题,可有的就报rn2011-4-22 17:22:27 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLoggingrn警告: Application http://impl.cxfService.com/PortServiceImplService#http://cxfService.com/portMessage has thrown exception, unwinding nowrnorg.apache.cxf.interceptor.FaultrnCaused by: java.lang.NullPointerExceptionrn很是郁闷,但是我可以肯定hibernateDAO绝对不为空!rn就是同一个hql语句,比如第一次参数值是‘A’,结果执行就不报错;若将值改成'B',就会报上面的错!rn并且将语句在数据库中执行,完全可以查到结果!rn希望高手不吝赐教!
空指针错误
rnrnrnrnrn rnrnrn rnrn 请选择rnrnrnrn rn rn rn rn rn ==所有地区==rn rn rn rn 部门:rn rn rn rn rnrnrnrnrn很郁闷,我把其中的jsp代码复制到另外一个jsp页面中就能都出来,但为什么这个却报错误啊?
ssh 框架整合 报空指针
rnrnrn大哥们!帮我看看啊 rn我整合后怎么老报这个错误,经测试struts-spring整合是没错,加上hibernate就有错误了rn.lang.NullPointerExceptionrn hibernate.LoginDAO.save(LoginDAO.java:30)rn com.struts.action.LoginAction.execute(LoginAction.java:56)rn org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rnrn其实就是getHibernateTemplate().save(transientInstance); 这里getHibernateTemplate()得到的是null.rn下面是我spring的配置文件:rnrnrnrnrn rn oracle.jdbc.driver.OracleDriverrn rn rn jdbcracle:thin:@192.168.0.51:1521:nnmmrn rn rn yarn rn rn yarn rnrnrn rn rn rn rn rn rn org.hibernate.dialect.Oracle9Dialectrn rn rn rn rn rn hibernate/Login.hbm.xmlrn rn rnrn rn rn rnrn rnrnrn我new了个LoginDAO,是不是不能new?rn是不是一定要这样?rnFileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(fileName);rnLoginDAOu=(LoginDAO)ctx.getBean("LoginDAO");rn
支付宝报空指针
这是我的第一篇博客,那就说说我在做支付宝的时候的一些见解吧,虽然支付宝和微信支付比起来坑要少的多但是也还是有一些需要注意的地方 1.对于一些支付参数来说,像appId和私钥来说这些参数最好不要放在客户端,因为这样不安全,我们这些参数最好放在服务端来生成,这两个参数很重要,因为支付宝会用它生成我们支付的sign,如果这两个参数有错误就会不能正常的调起支付,出现ALI40247系统繁忙的错误。 2.
二维数组 赋值
一个向量A有n个未知数,每个未知数的取值范围是0-9,则A总共有10 ^n种可能性,A所有的设置方案是个10 ^n*10的矩阵,请问如何用编程实现这个矩阵?谢谢!
bmob的自动升级报空指针
bmob自然是很好的东西,但是如果你遇到这个, 11-01 09:22:20.880: E/AndroidRuntime(8102): Caused by: java.lang.NullPointerException 11-01 09:22:20.880: E/AndroidRuntime(8102): at cn.bmob.v3.update.UpdateResponse.Code(Sou
获取文件路径报空指针
String filePath =request.getSession().getServletContext().getRealPath("/"); 提示这行代码报<em>空指针</em>。 总代码是这样的: //得到文件夹路径 String filePath1 = request.getSession().getServletContext().getRealPath("/"); String fi
程序执行到sqlMap.startTransaction();报空指针
我用的是spring+ibatis+strutsrn我在手动开启事务时报的错,程序执行到sqlMap.startTransaction();时报错,请问是什么原因?急急急!!!!rnrnjava代码:rntry rn String reource="sql-map-config.xml";rn rn reader =Resources.getResourceAsReader("sql-map-config.xml");rn rn sqlMap =SqlMapClientBuilder.buildSqlMapClient(reader);rn// sqlMap=XmlSqlMapBuilder.buildSqlMap(reader);rn rn rn sqlMap.startTransaction();rn Object obj1=save(params);rn System.out.println("obj1:"+obj1==null);rn Object obj=save(organ);rn System.out.println("obj:"+obj==null);rn if((obj!=null)&&(obj1!=null))rn flag=true;rn sqlMap.commitTransaction();rn rn elsern sqlMap.endTransaction();rn rnrnrnrnrnrnrnrnrn错误信息:rnrnjava.lang.NullPointerExceptionrn at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.startTransaction(SqlMapExecutorDelegate.java:732)rn at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.startTransaction(SqlMapSessionImpl.java:164)rn at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.startTransaction(SqlMapClientImpl.java:141)rn at com.venus.common.service.OrganManager.saveAll(OrganManager.java:220)rn at com.venus.common.service.OrganManager$$FastClassByCGLIB$$ef3f2a1a.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:693)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:628)rn at com.venus.common.service.OrganManager$$EnhancerByCGLIB$$35119c7.saveAll()rn at com.venus.common.web.OrganAction.add(OrganAction.java:166)rn 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.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.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(ApplicationFilterChain.java:269)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at com.venus.common.filter.SessionTimeOutFilter.doFilter(SessionTimeOutFilter.java:40)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:77)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)rn at java.lang.Thread.run(Thread.java:619)
SSH插入数据,报空指针???
SSH做了一个小例子,save的时候报<em>空指针</em>,主要是hibernate封装jdbc时报<em>空指针</em>,代码如下:rn[color=#FF0000]ACTION:[/color]UserService userService = new UserService();rn UserDao userDao = new UserDao();rn User user = new User();rn user.setName(name);rn user.setPassword(password);rn user.setEmail(email);rn user.setPhone(phone);rn user.setCompany(company);rn user.setAddress(address);rn user.setCreateTime(new Date());rn user.setModificationTime(new Date());rn[color=#FF6600]37行------------- userDao.save(user)[/color]-------------------------------------------rn暂时没调用service,[color=#FF0000]dao[/color]的代码:rn@Repositoryrnpublic class UserDao extends HibernateDao rnrn-------------------------------------------rn[color=#FF0000]HibernateDao[/color]里面的save部分代码:rnpublic void save(T o) rn getHibernateTemplate().saveOrUpdate(o);rn rn--------------------------------------------rn[color=#FF0000]spring.xml:[/color]rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn truern update rn threadrn rn falsern truern truern truern 50rn 50rn true rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn--------------------------------------------------------------------------rn报错的代码就是<em>空指针</em>,没头绪啊:rnjava.lang.NullPointerException rn com.shop.dao.base.HibernateDao.save(HibernateDao.java:672)rn com.shop.action.RegisterAction.execute(RegisterAction.java:37)rnrnrn[color=#FF0000]前辈们帮帮忙看看。。。愁死我了[/color]
加载properties文件报空指针
public class DB rn private Connection conn = null;rn private Properties prop = null;rn InputStream info = null; //InputStream 对象 ; //InputStream 对象 rn rn public Connection getConnection()rn String driverclass,dburl,user,password;rn prop = new Properties(); //构建properties对象rn //java.lang.Object.getClass(),将jdbc.properties文件内容赋予输入流对象 rn info = getClass().getResourceAsStream("conf/jdbc.properties");rnrn try rn prop.load(info); //加载输入流对象内容rn driverclass = prop.getProperty("driverclass");rn dburl = prop.getProperty("dburl");rn user = prop.getProperty("user");rn password = prop.getProperty("password");rn System.out.println(driverclass+dburl+user+password);rn rn Class.forName(driverclass);//加载驱动rn conn=DriverManager.getConnection(dburl,user,password);//创建数据库connection对象rn catch (IOException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn catch (ClassNotFoundException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn return conn;rn rn rn错误[code=java][/code]信息:rn严重: Servlet.service() for servlet AccountServlet threw exceptionrnjava.lang.NullPointerExceptionrn at java.util.Properties$LineReader.readLine(Properties.java:418)rn at java.util.Properties.load0(Properties.java:337)rn at java.util.Properties.load(Properties.java:325)rn at com.etop.topebus.common.DB.getConnection(DB.java:26)rn at com.etop.topebus.dao.AccountDao.accountInfo(AccountDao.java:40)rn at com.etop.topebus.control.AccountServlet.doPost(AccountServlet.java:57)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(ApplicationFilterChain.java:290)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:175)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:263)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn
struts2+spring+hibernate数据库操作报空指针
写了一个action,运行的时候老是报<em>空指针</em>,把数据库操作的语句删掉就正常了,其他的地方的数据库操作室正常的,郁闷了,不知道什么原因。哪位朋友有遇到类似的问题,怎么解决的。rnaction代码:rnpublic class OrderManager rn private IOrderSerivce OSerivce;rn private IProductSerivce PSerivce;rn rn public IOrderSerivce getOSerivce() rn return OSerivce;rn rnrnrnrn public void setOSerivce(IOrderSerivce serivce) rn OSerivce = serivce;rn rnrnrnrn public IProductSerivce getPSerivce() rn return PSerivce;rn rnrnrnrn public void setPSerivce(IProductSerivce serivce) rn PSerivce = serivce;rn rnrnrn @SuppressWarnings("unchecked")rn public String execute()throws Exceptionrn Orders order=new Orders();rn User u=(User)ActionContext.getContext().getSession().get("user");rn order.setUserid(u.getId());rn Date date = new Date();rn Timestamp ts = new Timestamp(date.getTime());rn order.setDealdate(ts);rn Set orderitemSet = new HashSet();rn ShopCart cart=(ShopCart)ActionContext.getContext().getSession().get("cart");rn Collection items=cart.getHashMap().values();rn Iterator it=items.iterator();rn double totalprice=0.00;rn while(it.hasNext())rn Product p=it.next();rn totalprice+=p.getPrice();rn p.setNumber(p.getNumber()-p.getQuantity());rn this.getPSerivce().update(p);//数据库操作rn Orderitem item=new Orderitem();rn item.setNumber(p.getQuantity());rn item.setProductid(p.getId());rn item.setOrder(order);rn orderitemSet.add(item);rn rn order.setTotalprice(totalprice);rn order.setOrderitem(orderitemSet);//数据库操作rn this.getOSerivce().saveOrders(order);rn cart.clear();rn rn return "success";rn rnrnspring 配置文件:rnrnrn rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnorg.hibernate.dialect.MySQLDialectrntruernrnrnrnrncom/shop/bean/Comments.hbm.xmlrncom/shop/bean/Orderitem.hbm.xmlrncom/shop/bean/Product.hbm.xmlrncom/shop/bean/User.hbm.xmlrncom/shop/bean/Orders.hbm.xmlrnrnrnrnrnrnrnrn rn rn rn rn rn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIREDrn rn rn rnrn rn rn rn rn rn rn userservicern productserivcern rn rn rn rn rn rn rn transactionInterceptor rn rn rn rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn//后面把action教个spring管理也没用rnrnrnrn
LayoutInflate.inflate()报空指针错误解决
先入正题:LayoutInflate.inflate()方法报<em>空指针</em>错误大体有两个原因:1.layoutInflate对象为空,或layoutInflate所依赖的Context对象为空 2.inflate()参数中的布局文件有错,导致XmlPullParser对象无法正确的解析布局文件 根据以上的两点原因,就可以根据Log信息来追踪错误的真正原因了。像我这个花费了我一上午才找到的错误:
Onmeasure报空指针
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
DWR报空指针,求解
//#DWR-INSERTrndwr.engine.remote.handleNewScriptSession("ABCB41E362018EF54652775669E3EA58");rn//#DWR-REPLYrndwr.engine.remote.handleCallback("0","0",null);
spring+hibernate query.list 报空指针
Hibernate: select count(*) as col_0_0_ from profession profession0_ where profession0_.dept_no=?rnHibernate: select top 12 profession0_.profession_No as profession1_1_, profession0_.profession_name as profession2_1_, profession0_.dept_no as dept3_1_ from profession profession0_ where profession0_.dept_no=? order by profession0_.profession_No descrn2009-2-16 19:10:01 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet default threw exceptionrnjava.lang.NullPointerExceptionrn at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)rn at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)rn at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)rn at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)rn at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:830)rn at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)rn at org.hibernate.type.EntityType.resolve(EntityType.java:303)rn at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)rn at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)rn at org.hibernate.loader.Loader.doQuery(Loader.java:717)rn at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)rn at org.hibernate.loader.Loader.doList(Loader.java:2145)rn at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)rn at org.hibernate.loader.Loader.list(Loader.java:2024)rn at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)rn at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)rn at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)rn at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)rn at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)rn at com.top.daoHibernateImpl.HibernateGeneric.pagedQuery(HibernateGeneric.java:264)rnrnrnrnrn rnrn Assert.hasText(hql);rn Assert.isTrue(pageNo >= 1, "pageNo should start from 1");rn // Count查询rn String countQueryString = PageFactory.getTotalCountHqlByHql(hql);rn List countlist = this.find(countQueryString, values);rn int totalCount = ((Integer) countlist.get(0)).intValue();rn rn rnrn if (totalCount < 1) return new Page();rn // 实际查询返回分页对象rn Query query = createQuery(hql, values);rn int startIndex = PageFactory.getStartIndex(pageNo, pageSize);rn List results = query.setFirstResult(startIndex).setMaxResults(pageSize)rn .list();//本行报<em>空指针</em>rn return PageFactory.createPage(pageNo, pageSize, totalCount, results);rnrnrnrn n[b]问题补充:[/b]n大家好本问题已经解决!~rn我才本站其他贴上看到了同样的贴,再此也谢谢那位仁兄!~rn
adapter的inflater.inflate报空指针
我按照教程尝试编写自定义Adapter,继承BaseAdapter,在重写getView方法时,使用了rnconvertView = inflater.inflate(R.layout.lv_test_list,null); 然而在运行时就报错了,显示 java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup)' on a null object reference。但是,视频教程就是这么写的~~如下图所示,第70行代码。请问我的问题出在哪里?我该如何修改?rn[img=https://img-bbs.csdn.net/upload/201609/20/1474361648_357886.jpg][/img]rnrn下面是我写的代码:rn [code=java]rnpublic class ListAdapter extends BaseAdapter rnrn private List items;rn LayoutInflater inflater;rn public ListAdapter(Context context,List source)rn items = source;rn inflater.from(context);rn rnrn@Overridern public View getView(int position, View convertView, ViewGroup parent) rn ViewHolder vh;rn if(convertView == null)rn convertView = inflater.inflate(R.layout.lv_test_list,null);rn ImageView img = (ImageView) convertView.findViewById(R.id.img_icon);rn TextView tv_title = (TextView) convertView.findViewById(R.id.tv_title);rn TextView tv_content = (TextView) convertView.findViewById(R.id.tv_content);rn vh = new ViewHolder();rn vh.content = tv_content;rn vh.title = tv_title;rn vh.img = img;rn convertView.setTag(vh);rn rn elsern vh = (ViewHolder) convertView.getTag();rn rn ListAdapterItem item = items.get(position);rn vh.content.setText(item.str_content);rn vh.title.setText(item.str_title);rn vh.img.setImageResource(item.int_img);rn return convertView;rn rnrn class ViewHolder rn public ImageView img;rn public TextView title;rn public TextView content;rn rn[/code]
为什么第一次启动报“空指针”?
做了一个J2EE项目,但是每次启动Tomcat时,第一次访问页面都会报“<em>空指针</em>”,再访问就正常了面(除了登陆页)。rn断点测试发现,在执行init方法之前就报<em>空指针</em>了。rn请问这是怎么回事?
spring配置线程池报空指针
Spring.xmlrn[code=text]rnrn rn rn rn rn rn rn[/code]rnrnspring-thread.xmlrn[code=text]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnweb.xmlrn[code=text]rnrn zhibing_mybatisrn rn rn spring listenerrn org.springframework.web.context.ContextLoaderListenerrn rn rn rn org.springframework.web.util.IntrospectorCleanupListenerrn rn rn contextConfigLocationrn classpath*:spring.xmlrn rn rn spring.profiles.activern productionrn rn rn encodingFilterrn org.springframework.web.filter.CharacterEncodingFilterrn rn encodingrn UTF-8rn rn rn rn encodingFilterrn /*rn rn rn spring mvc servletrn springmvcrn org.springframework.web.servlet.DispatcherServletrn rn springmvc configrn contextConfigLocationrn classpath*:spring-mvc.xmlrn rn 1rn rn rn springmvcrn *.apprn rnrn rn index.htmlrn index.htmrn index.jsprn rn[/code]rnrnjava.javarn[code=java]rnpublic class javarn @Resource(name="taskExecutor")rn private TaskExecutor taskExecutor;// 线程池 rnpublic TaskExecutor getTaskExecutor() rn return taskExecutor;rn rn public void setTaskExecutor(TaskExecutor taskExecutor) rn this.taskExecutor = taskExecutor;rn rnpublic void addThread()rn taskExecutor.execute(new Runnable() rn rn @Overridern public void run() rn System.out.println("啦啦啦啦");rn rn rn );rnrnrn[/code]rnrn结果:rnjava.lang.NullPointerExceptionrnrn
空指针,怪异。
package com.sh.lw;rnrnimport java.io.BufferedReader;rnimport java.io.InputStreamReader;rnrnpublic class Gobang rn private String[][] board;rn private static int BOARD_SIZE=15;rn rn public void initBoard() rn for(int i=0; i
struts2+hibernate3.3+spring3.1注入报空指针
java.lang.NullPointerExceptionrn com.njx.action.UserAction.execute(UserAction.java:17)rn 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)rnrnrnweb.xml:rnrnrn SpringTestrn rn index.jsprn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn contextConfigLocationrn /WEB-INF/classes/applicationContext.xmlrn rn rn rn struts2rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn struts2rn /*rn rn rnrnrnapplicationContext.xml:rnrnrnrnrn rn rn rn rn rnrn rn rn rnrnrnrnrnUserAction.java:rnpackage com.njx.action;rnrnimport com.njx.service.UserService;rnimport com.opensymphony.xwork2.ActionSupport;rnrnpublic class UserAction extends ActionSupportrnrn /**rn * rn */rn private static final long serialVersionUID = 1L;rn rn private UserService userService;rn rn @Overridern public String execute() throws Exception rn boolean b = userService.user_login();rn return SUCCESS;rn rn rn public UserService getUserService() rn System.out.println("userServic:" + userService);rn return userService;rn rnrn public void setUserService(UserService userService) rn this.userService = userService;rn rnrnrn
addView报空指针
想实现的功能是,点击一个按钮,出来一个list,上面有几个按钮。但是addView时候出现<em>空指针</em>。代码如下:rnMainActivity类:rnpackage com.example.tablelayout;rnrnimport android.app.Activity;rnimport android.os.Bundle;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnrnpublic class MainActivity extends Activity rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_main);rnrn findViewById(R.id.button1).setOnClickListener(new OnClickListener() rnrn @Overridern public void onClick(View v) rn PlatformPage page = new PlatformPage(v.getContext());rn page.show();rn rn );rn rnrnPlatformPage 类:rnpackage com.example.tablelayout;rnrnimport android.content.Context;rnimport android.widget.TableLayout;rnrnpublic class PlatformPage extends TableLayout rnrn public PlatformPage(Context context) rn super(context);rn rnrn public void show() rn TableLayout tableLayout = (TableLayout) findViewById(R.id.platformLayout);rn this.addView(tableLayout);rn rnrn请前辈指导
spinner 报空指针
package com.example.a10653.wymap;rnrnimport android.os.Bundle;rnimport android.support.annotation.Nullable;rnimport android.support.v7.app.AppCompatActivity;rnimport android.view.View;rnimport android.widget.AdapterView;rnimport android.widget.ArrayAdapter;rnimport android.widget.Spinner;rnrnimport com.amap.api.maps.AMap;rnimport com.amap.api.maps.MapView;rnimport com.amap.api.maps.model.MyLocationStyle;rnrnpublic class MainActivity extends AppCompatActivity rnrn private MapView mapView;rn private AMap aMap;rn private Spinner spinner;rnrn @Overridern protected void onCreate(@Nullable Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_main);rn mapView = findViewById(R.id.map);rn spinner = findViewById(R.id.map_type_spinner);rn mapView.onCreate(savedInstanceState);rn init();rn initSpinner();rn rnrn private void init() rn if (aMap == null)rn aMap = mapView.getMap();rn rn aMap.showIndoorMap(true);rn setUpMap();rn rnrn private void setUpMap()rn aMap.getUiSettings().setMyLocationButtonEnabled(true);rn aMap.setMyLocationEnabled(true);rn setupLocationStyle();rn rnrn private void setupLocationStyle()rn MyLocationStyle myLocationStyle = new MyLocationStyle();rn myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE);rn aMap.setMyLocationStyle(myLocationStyle);rn aMap.setMyLocationEnabled(true);rn rnrn private void initSpinner()rnrn String[] mapTypes = getResources().getStringArray(R.array.map_type);rn ArrayAdapter arrayAdapter = new ArrayAdapter<>(this,R.layout.map_type_spinner,mapTypes);rn spinner.setAdapter(arrayAdapter);rn spinner.setSelected(false);rn spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() rn @Overridern public void onItemSelected(AdapterView parent, View view, int position, long id) rn if (position == 2)rn aMap.setMapType(AMap.MAP_TYPE_BUS);rn rn if (position == 3)rn aMap.setMapType(AMap.MAP_TYPE_NAVI);rn rn if (position == 4)rn aMap.setMapType(AMap.MAP_TYPE_NIGHT);rn rn if (position == 5)rn aMap.setMapType(AMap.MAP_TYPE_NORMAL);rn rn if (position == 6)rn aMap.setMapType(AMap.MAP_TYPE_SATELLITE);rn rn rnrn @Overridern public void onNothingSelected(AdapterView parent) rnrn rn );rn rnrn
ViewHolder报空指针????
一般情况下有两点需要注意的 1.setTag();和getTag(); 2.view的判断是否准确
c3p0报空指针错误
1.今天c3p0报<em>空指针</em>错误,数据源的XML文件中,URL、用户名密码均没有问题,花费了很长时间,才发现是XML文件存放的路径不正确 c3p0数据源应放置在src根目录下或相应jar文件中
关于butterknife8.01 报空指针
最近在使用ButterKnife注解View的时候发现已经更新到8.0.1 。 根据以往使用的习惯, 直接导入依赖库或者jar包,使用bind绑定。但是在8.0.1 发现不行了。 绑定View 改成了 @BindView(R.id.tv) TextView textView; 运行发现报<em>空指针</em>。 因为8.0.1用的是apt方式,和以前的配置都不同了。所以再配置文件中要添加如下代码:buil
SPRING+HIBERNATE报空指针错.
type Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Exception in JSP: /action.jsp:37rnrn34: message.setIsread(0);rn35: message.setSign(0);rn36: rn37: service.saveMessage(message);rn38: rn39: %>rn40: aarnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn com.test.service.MessageService.saveMessage(MessageService.java:22)rn org.apache.jsp.action_jsp._jspService(action_jsp.java:84)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.rnrn------------------------------------------------rnrnrnrnrn rnrn rn rn rn rn rn rnrn rn rn rn classpath:com\test\entity\rn rn rn rn org.hibernate.dialect.MySQLDialectrn truern truern 0rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn-------------------------------------------------rnpublic class MessageService rn private MessageDAO messageDAO; rn rn rn public MessageDAO getMessageDAO() rn return messageDAO;rn rnrnrn public void setMessageDAO(MessageDAO messageDAO) rn System.out.println("aaaaaa");rn this.messageDAO = messageDAO;rn rnrnrn public Message saveMessage(Message r)rn System.out.println("dddddd");rn messageDAO.saveMessage(r);rn return r;rn rnrn-------------------------------------------------------rnpublic class MessageDAO extends HibernateDaoSupportrn rn public Message saveMessage(Message r)rn tryrn System.out.println(this.getSessionFactory());rn this.getHibernateTemplate().saveOrUpdate(r);rn return r;rn catch (Exception e) rn e.printStackTrace();rn return null;rn rn rn
自定义布局报空指针
public class LoginUIinfo extends Activity rnrn NavigationLayout mNavigationLayout; // 自定义布局rn LinearLayout linearLayout;rn int mViewCount; // 自定义控件中子控件的个数rn ImageView mImageView[]; // 底部的imageViewrn int mCurSel; // 当前选中的imageViewrnrn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn // 设置无标题创口rn// requestWindowFeature(Window.FEATURE_NO_TITLE);rn setContentView(R.layout.logininfo);rn init();rn rnrn private void init() rn// mNavigationLayout = new NavigationLayout(LoginUIinfo.this);rn mNavigationLayout = (NavigationLayout) this.findViewById(R.id.navigationLayoutID);rn linearLayout = (LinearLayout) findViewById(R.id.linerLayoutID);rn // 得到子控件的个数rn mViewCount = mNavigationLayout.getChildCount();rn mImageView = new ImageView[mViewCount];rn // 设置imageViewrn for (int i = 0; i < mViewCount; i++) rn // 得到LinearLayout中的子控件rn mImageView[i] = (ImageView) linearLayout.getChildAt(i);rn mImageView[i].setEnabled(true);// 控件激活rn mImageView[i].setOnClickListener(new MOnClickListener());rn mImageView[i].setTag(i);// 设置与view相关的标签rn rn // 设置第一个imageView不被激活rn mCurSel = 0;rn mImageView[mCurSel].setEnabled(false);rn mNavigationLayout.setOnViewChangeListener(new MOnViewChangeListener());rn rnrn // 点击事件的监听器rn private class MOnClickListener implements OnClickListener rn @Overridern public void onClick(View v) rn int pos = (Integer) v.getTag();rn System.out.println("pos:--" + pos);rn // 设置当前显示的ImageViewrn setCurPoint(pos);rn // 设置自定义控件中的哪个子控件展示在当前屏幕中rn mNavigationLayout.snapToScreen(pos);rn rn rnrn // 自定义控件中View改变的事件监听rn private class MOnViewChangeListener implements OnViewChangeListener rn @Overridern public void onViewChange(int view) rn System.out.println("view:--" + view);rn if (view < 0 || mCurSel == view) rn return;rn else if (view > mViewCount - 1) rn // 当滚动到第五个的时候activity会被关闭rn System.out.println("finish activity");rn finish();rn rn setCurPoint(view);rn rnrn rnrn /**rn * 设置当前显示的ImageViewrn * rn * @param posrn */rn private void setCurPoint(int pos) rn if (pos < 0 || pos > mViewCount - 1 || mCurSel == pos)rn return;rn // 当前的imgaeView将可以被激活rn mImageView[mCurSel].setEnabled(true);rn // 将要跳转过去的那个imageView变成不可激活rn mImageView[pos].setEnabled(false);rn mCurSel = pos;rn rnrn @Overridern protected void onResume() rn super.onResume();rn rnrn @Overridern protected void onPause() rn super.onPause();rn rnrn @Overridern protected void onDestroy() rn super.onDestroy();rn rnrnrnrnrnmNavigationLayout 获取不到是为什么啊?苦恼!!!
空指针赋值问题请教??
比如rnint *ptr;rn*ptr=10;rn定义的*ptr没有分配空间,编译器初始化为NULL,而且给*ptr<em>赋值</em>,给0地址的内容<em>赋值</em>,会引起什么样的错误,具体的错误类型,编译器分配地址都是从某个地址开始,0地址都不用的吧,如果这样给0地址<em>赋值</em>会咋杨,具体点,谢谢
指针,野指针,空指针赋值
bug中最可怕的是野指针,那么问题来了,野指针是什么?是如何产生的?为什么程序员会“忘记”? 昨天调试时,我发现了一个野指针,由此我明白了。 a的值成了乱码,而且gcc编译器并没有报错,那么请看下面的代码 #include int fun(int *a) { int i; *a=0;//添加的代码 for(i=0;i<10;i++) (*a)++; return
mediaController 报空指针异常 VideoView 关闭报空指针
用videoview在线播放视频时,滑动mediaController后马上关闭播放器会报<em>空指针</em>异常。原因是当mediaController滑动后会异步请求数据,但请求完成回调前,你已经关闭了播放的activity,造成回调无法找到mediaController对象所以报<em>空指针</em>。 解决办法:在finish 页面之前关闭mediaController if (me
读zk 节点 报空指针
map 读zk 报<em>空指针</em>  查看application.xml 引用顺序  ,被其他类引用的放在最前面 如: ××map.get("×key") bean id="××Props" class="ZookeeperConfigGroup"> constructor-arg name="configProfile" ref="××ConfigProfile" /> c
关于adapter报空指针问题
主要是因为声明了变量没有初始化!!!!!
setOnClickListener报空指针异常问题汇总
有关设置控件监听器时,报<em>空指针</em>异常问题汇总
自定义dialog 控件报空指针
先来张博主的自拍镇楼!由于项目需求 自定义了dialog 并且在很多地方要用到 只有里面显示的内容不同 当我给dialog里面的textview设置内容时候发现报了<em>空指针</em>聪明的我 一下就想到了问题的可能性 先来张错误代码:dialog在new 的时候 并不会执行 oncreateView() 方法  因此里面的控件都未初始化 而调用dialog.show()的时候才会执行oncreateView(...
activiti在启动的时候报空指针
工作流activiti,版本号是:5.18.0.1,在启动的时候报错: Caused by: java.lang.NullPointerException at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:1082) 调试了下源码,在启动的时候activiti要校验数据库的元数据,获
service 方法一直报空指针
result = jPositionProviceMapper.searchAll(); 一直运行报这<em>空指针</em>异常 @Resource private JPositionProviceMapper jPositionProviceMapper; 原因是没有加@Resource
浅谈equals报空指针异常问题
浅谈equals报<em>空指针</em>异常问题 常见格式 我们常见的equals用法如下: if("111".equals(info.getProrgcode())){ System.out.println("雷猴啊!!"); } 一般常量在前比较内容在后,这样不会出什么问题 特殊格式 特殊格式如下: if(oldStation.getProrgcode().equals(info.getProrgc...
解析xml报空指针的问题
我这个解析一个单独的xml文件可以实现,现在要用它来解析一个String形式展现的xml,运行后报如下错误;rnrn代码:rn[code=XML]rnimport java.util.Iterator;rnimport java.util.Map;rnimport java.util.HashMap;rnimport java.io.StringReader;rnrnimport javax.xml.parsers.DocumentBuilder;rnimport javax.xml.parsers.DocumentBuilderFactory;rnrnimport org.w3c.dom.Attr;rnimport org.w3c.dom.Node;rnimport org.w3c.dom.Element;rnimport org.w3c.dom.NodeList;rnimport org.w3c.dom.Document;rnimport org.xml.sax.InputSource;rnimport org.w3c.dom.NamedNodeMap;rn rnrnpublic class ReadConfig rn rn static public void main(String[] args)rn long lasting =System.currentTimeMillis();rn Map conMap=null;rn tryrn conMap = ReadConfig.read(" " +rn "" + "" + "1234" + "5.95" + "100" + "595.00" + "Super Widget Clamp" + "" +"");rn rn catch(Exception e)rn e.printStackTrace();rn rn System.out.println("解析花费时间:"+(System.currentTimeMillis()-lasting));rn while(conMap!=null)rn Iterator> iter = conMap.entrySet().iterator();rn System.out.println("iter的值:" + iter.toString());rn while(iter.hasNext())rn Map.Entry element = (Map.Entry) iter.next();rn System.out.println(element.getKey()+""+ element.getValue());rn rn rn rn rn rn rn static public Map read(String result)throws NullPointerException,Exceptionrn StringReader rd = null;rn InputSource inputSource=null;rn //DOMParser parser=null;rn Map conMap=null;rn rn try rn DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();rn DocumentBuilder dombuilder = domfac.newDocumentBuilder();rn rd = new StringReader(result);rn inputSource = new InputSource(rd);rn Document doc=dombuilder.parse(inputSource);rnrn rn //Document doc = parser.getDocument();rn printElements(doc);rn conMap= getElementAttributes(doc);rn rn rn catch(Exception e)rn throw e;rn rn if(conMap==null)rn throw new NullPointerException("Map is Null!");rn rn return conMap;rn rn rn private static void printElements(Document doc)rn System.out.println("element is->");rn NodeList n1 = doc.getElementsByTagName("*");rn Node n;rn for(int i=0;i getElementAttributes(Document doc)rn NodeList n1 = doc.getElementsByTagName("*");rn Element e;rn Attr attr;rn NamedNodeMap nnm;rn String attrname,key,value;rn String attrval;rn HashMap map = new HashMap();rn int i,len;rn len = n1.getLength();rn for(int j=0;j"+value);rn if(value.trim().length()>0)rn map.put(key,value);rn rn nnm = e.getAttributes();rn if(nnm != null)rn for(i=0;irnOrder,java.lang.NullPointerExceptionrn at com.iss.shesd2.filenet.poc.util.ReadConfig.getElementAttributes(ReadConfig.java:99)rn at com.iss.shesd2.filenet.poc.util.ReadConfig.read(ReadConfig.java:61)rn at com.iss.shesd2.filenet.poc.util.ReadConfig.main(ReadConfig.java:26)rnItem,SKU,PricePer,Quantity,Subtotal,Description,Order->nullrn解析花费时间:266rnrn各位,为什么Node的头能拿到,而里面的值却没有得到呢?rn
JSP引用struts2标签报空指针
rnrnrn一块用 就抱错 报<em>空指针</em> 不知道各位仁兄谁也碰到过
setAdapter报空指针,程序退出,求解
错误信息如图[img=https://img-bbs.csdn.net/upload/201606/12/1465722597_483680.png][/img]
使用Butter Knife报空指针
如果你使用的Butter Knife版本过高,只依赖了一个库文件,在AS中使用Butter Knife工具时,就会报<em>空指针</em>. btn1.setOnClickListener(listener);//<em>空指针</em>推荐使用版本: compile 'com.jakewharton:butterknife:7.0.1'
三目运算符报空指针,JDK自动拆箱
程序中的问题 最近发现了一个很诡异的NullPointerException,在下面这个方法抛出,一开始怎么都没想明白,dClass.getD()即使为null,那直接<em>赋值</em>给d也没问题啊。   class DClass { private Double d; public Double getD() { return d; } public void setD(Doubl...
ssh2框架,报空指针错误.
loginAction中的验证用户名的方法:rnrnpublic String loginValid(String name, String pass)rn System.out.print(name+"oo");rn String returninfo = "yes";rn List listuser = null;rn try rn listuser = service.findByUsername(name[color=#FF0000]);//错误显示在这里报<em>空指针</em>错误.[/color] catch (Exception e) rn e.printStackTrace();rn rn System.out.print(listuser.size()+"uuuuuuuu");rn if(listuser == null) rn returninfo = "nouname";return returninfo;rn rn try rn listuser = service.validateUser(name, pass);rn catch (Exception e) rn System.out.print(e.getMessage());rn rn if(listuser == null) rn returninfo = "nopass";return returninfo;rn rn return returninfo;rn rnrn这个方法我调试过了,service.findByUsername()没有执行.
Route类报空指针的问题
写的代码如下:报错指在了蓝颜色的位置,但是我打印的fromAndTo1,point2,point3 都是有值的,这个为什么呢,难道是Route类是<em>空指针</em>??rn if (point0 != null && point2 != null) rn Route.FromAndTo fromAndTo1 = new Route.FromAndTo(point2, point3);rn List routeResult1 = null;rn Log.i("test", "----fromAndTo1---"+fromAndTo1);rn Log.i("test", "----point2---"+point2);rn Log.i("test", "----point3---"+point3);rn if(null!=fromAndTo1)rn try rn routeResult1 = Route.calculateRoute(rn NavigateSimulateActivity.this,rn getString(R.string.maps_api_key), fromAndTo1,rn Route.DrivingNoFastRoad);rn catch (MapAbcException e) rn e.printStackTrace();rn rn rn rnrn rn10-23 13:05:52.765: WARN/System.err(2586): org.xml.sax.SAXParseException: Unexpected end of documentrn 10-23 13:05:52.765: WARN/System.err(2586): at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:129)rn 10-23 13:05:52.765: WARN/System.err(2586): at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.c.a(CoreUtil.java:98)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.c.c(CoreUtil.java:106)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.t.d(XmlResultHandler.java:54)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.route.d.c(DriveWalkHandler.java:96)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.r.a(XmlListResultHandler.java:1)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.k.c(ProtocalHandler.java:187)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.k.i(ProtocalHandler.java:128)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.core.k.e(ProtocalHandler.java:103)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.mapabc.mapapi.route.Route.calculateRoute(Route.java:145)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.nec.navigate.NavigateSimulateActivity.getBatterysimulatePoints(NavigateSimulateActivity.java:2034)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.nec.navigate.NavigateSimulateActivity.access$4(NavigateSimulateActivity.java:1990)rn 10-23 13:05:52.765: WARN/System.err(2586): at com.nec.navigate.NavigateSimulateActivity$3.run(NavigateSimulateActivity.java:362)rn 10-23 13:05:52.765: WARN/System.err(2586): at java.lang.Thread.run(Thread.java:1019)rn 10-23 13:05:52.765: WARN/dalvikvm(2586): threadid=17: thread exiting with uncaught exception (group=0x40015560)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): FATAL EXCEPTION: Thread-25rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): java.lang.NullPointerExceptionrn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.core.t.d(XmlResultHandler.java:55)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.route.d.c(DriveWalkHandler.java:96)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.core.r.a(XmlListResultHandler.java:1)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.core.k.c(ProtocalHandler.java:187)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.core.k.i(ProtocalHandler.java:128)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.core.k.e(ProtocalHandler.java:103)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.mapabc.mapapi.route.Route.calculateRoute(Route.java:145)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.nec.navigate.NavigateSimulateActivity.getBatterysimulatePoints(NavigateSimulateActivity.java:2034)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.nec.navigate.NavigateSimulateActivity.access$4(NavigateSimulateActivity.java:1990)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at com.nec.navigate.NavigateSimulateActivity$3.run(NavigateSimulateActivity.java:362)rn 10-23 13:05:52.769: ERROR/AndroidRuntime(2586): at java.lang.Thread.run(Thread.java:1019)rn 10-23 13:05:52.785: WARN/ActivityManager(149): Force finishing activity com.nec.navigate/.NavigateSimulateActivityrn 10-23 13:05:53.261: WARN/ActivityManager(149): Duplicate finish request for HistoryRecord408528d0 com.nec.navigate/.NavigateSimulateActivityrn rn打印出来rn 10-23 13:05:51.710: INFO/test(2586): ----fromAndTo1---com.mapabc.mapapi.route.Route$FromAndTo@406e7698rn 10-23 13:05:51.714: INFO/test(2586): ----point2---39994625,116327049rn 10-23 13:05:51.714: INFO/test(2586): ----point3---40018150,116339722rn 哪位朋友会呢?
action 进service 报空指针
2016-3-3 12:46:17 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet action threw exceptionrnjava.lang.NullPointerExceptionrn at cn.boss.kxlife.ordmain.web.OrdMainAction.departmentTreeInit(OrdMainAction.java:82)rn 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.g4studio.core.mvc.xstruts.actions.DispatchAction.dispatchMethod(DispatchAction.java:194)rn at org.g4studio.core.mvc.xstruts.actions.DispatchAction.execute(DispatchAction.java:91)rn at org.g4studio.core.mvc.xstruts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:44)rn at org.g4studio.core.mvc.xstruts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:51)rn at org.g4studio.core.mvc.xstruts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:32)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.g4studio.core.mvc.xstruts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:262)rn at org.g4studio.core.mvc.xstruts.action.ActionServlet.process(ActionServlet.java:1790)rn at org.g4studio.core.mvc.xstruts.action.ActionServlet.doPost(ActionServlet.java:346)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(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.g4studio.common.util.RequestFilter.doFilter(RequestFilter.java:109)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.g4studio.common.util.EncodingFilter.doFilter(EncodingFilter.java:48)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:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)
SSH2增加后报空指针
前段时间给SSH增加了个事务的配置:rn[code=XML]rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rn以上就是在执行get方法的时候不执行事务,然后获取数据的时候出现了一个问题,不知道是不是方法的原因呢还是配置的原因(错误见末尾)?rn第239行代码是这样的(wfid确认是不为空的):rn[code=Java]Workfireflow wf=(Workfireflow)this.definition.objectDAO.get(Workfireflow.class, Integer.parseInt(wfid));[/code]rnrn实现的方法如下:rn[code=Java]package com.yb.daoImpl;rnrnimport java.io.Serializable;rnimport java.util.List;rnrnimport org.hibernate.Hibernate;rnimport org.hibernate.Query;rnimport org.hibernate.Session;rnimport org.springframework.orm.hibernate3.HibernateCallback;rnimport org.springframework.orm.hibernate3.HibernateTemplate;rnimport org.springframework.orm.hibernate3.support.HibernateDaoSupport;rnrnimport com.yb.bean.Page;rnimport com.yb.dao.ObjectDAO;rnimport com.yb.file.fileop;rnrnpublic class DAOImpl extends HibernateDaoSupport implements ObjectDAO rn public Object get(Class clazz, Serializable id) rn tryrn return this.getHibernateTemplate().get(clazz, id);rn catch(Exception e)rn rn fileop.debug(String.valueOf(new StringBuffer("DAOImpl中get(Class clazz, Serializable id)异常").append(e.toString())));rn return null;rn rn rn[/code]rnrnrn报的错误:rnStruts Problem ReportrnStruts has detected an unhandled exception: rnrnMessages: rnFile: com/yb/struts/action/GWDefinitionAction.java rnLine number: 239 rn--------------------------------------------------------------------------------rnStacktracesrnjava.lang.NullPointerException rn com.yb.struts.action.GWDefinitionAction.definitiontemple(GWDefinitionAction.java:239)rn com.yb.struts.action.GWDefinitionAction$$FastClassByCGLIB$$5b10593e.invoke()rn net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)rn com.yb.struts.action.GWDefinitionAction$$EnhancerByCGLIB$$707fc738.definitiontemple()rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)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: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:175)rn org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)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:263)rn org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)rn org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn java.lang.Thread.run(Thread.java:619)rn rnrn--------------------------------------------------------------------------------rnrnYou 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=falsernrnin your WEB-INF/classes/struts.properties file.
用javamail 发邮件 报空指针
代码如下rnSimpleMailMessage simple=new SimpleMailMessage();rn mailSender.setHost("smtp.qq.com");rn mailSender.setUsername("544645352@qq.com");rn mailSender.setPassword("19890126520zhi");rn rn System.out.println(mailSender.getHost());rn System.out.println(mailSender.getUsername());rn System.out.println(mailSender.getPassword());rn simple.setTo("475376081@qq.com"); //设置收件人rn simple.setCc("398974002@qq.com"); //设置抄送rn simple.setBcc("373197082@qq.com"); //设置暗送rn simple.setFrom("544645352@qq.com"); //设置发件人rn simple.setSubject(this.getZhuti());//设置主题rn simple.setText(this.getNeirong()); //设置内容rn System.out.println(this.getZhuti());rn System.out.println(this.getNeirong());rn mailSender.send(simple); //使用邮件发送器 发送rnrn 错误如下:rnjava.lang.NullPointerExceptionrn at org.springframework.mail.MailSendException.getMessage(MailSendException.java:111)rn at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:770)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at cn.com.filter.SetCharacterFilter.doFilter(SetCharacterFilter.java:21)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)rn at java.lang.Thread.run(Thread.java:595)rnrnrn求解 谢谢各位
XApool连接池报空指针错误解决
NULL 博文链接:https://fableking.iteye.com/blog/954153
急!!!为什么一直报空指针
java.lang.NullPointerExceptionrn at cn.com.zzzy.servlet.PersonalServlet.update(PersonalServlet.java:74)rn at cn.com.zzzy.servlet.PersonalServlet.doPost(PersonalServlet.java:46)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 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(Unknown Source)rn
浏览根目录下index.jsp 报 空指针
工程里的jar包和tomca中的jar包冲突导致 解决:删除工程里的jsp-api.jar和servlet-api.jar两个jar包 tips: 据网上资料 删除完这两个jar,可能还是有问题,此时需要仔细查看自己工程里的.classpath文件,特别注意kind=“lib” 是不是引用了jsp-api.jar和servlet-api.jar这两个jar包,可能会引用tomcat里的ja
SSH项目报空指针错误
[color=#FF0000]错误提示:java.lang.NullPointerException[/color]rn org.hr.action.UserAction.login(UserAction.java:33)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)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)rnrn[color=#FF0000]登录的jsp:login.jsp[/color]rnrnrnrnrn rn 人事管理-系统登录rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn /login.jsprn rn rn /index.jsprn /login.jsprn rn rnrn 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 rnrn[color=#FF0000]UserAction报错的地方:[/color]rn public String login() throws Exceptionrn rn System.out.println("test");rn [color=#FF0000]Users user=userservice.check(users.getUserName(),users.getUserPwd());[/color]rn if(users!=null)rn rn Map session=(Map)ActionContext.getContext().getSession();rn session.put("user",user);rn this.users=null;rn return SUCCESS;rn elsern rn return ERROR;rn rn rn[color=#FF0000]struts的配置:[/color]rnrnrn rn[color=#FF0000]applicationContext的相关配置:[/color]rn rn rn rn并且struts-spring-plugin插件也放进去了。求各位大佬知道
Android 第二次启动报空指针
这些天在搞andorid方面的东西,发现了一个问题困扰了我好1个多小时!! 老是说onCreate()方法是<em>空指针</em>! 不知道各位大大遇见这个问题没有? 但是我在建第二个程序的时候就不会出现这样的问题。。 我没有去深究这个问题,如果各位有这个问题的解决方案麻烦跟跟帖!! 谢谢!...
Struts2+Spring+JPA(Hibernate)报空指针问题?
有没有人遇到同样的问题··代码执行到Action里时调用biz方法时返回值是空的,报<em>空指针</em>了。。rn但测试这个biz方法时没问题的。。。
Struts+Spring+Hibernate注入的时候报空指针
ApplicationContext 文件 rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.SybaseDialectrn rn rn rn rn rn rn com/ziboyanhua/oa/user/data/Yhuser.hbm.xmlrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnYhuserDAO 是生动自成的rnYhuser.hbm.xml也是自动生成rnrnUserServicernrnpublic class UserService rn public YhuserDAO yhuserDAO;rn rn rn public YhuserDAO getYhuserDAO() rn return yhuserDAO;rn rnrn public void setYhuserDAO(YhuserDAO yhuserDAO) rn this.yhuserDAO = yhuserDAO;rn rnrn public void inste()rn System.out.println(yhuserDAO);rn Yhuser yhuser=new Yhuser();rn yhuser.setUsername("wangx");rn yhuser.setPasswrod("123");rn yhuserDAO.save(yhuser);rn rnrn public static void main(String[] args) rn UserService user=new UserService();rn user.inste();rn rn rn rn rnrnrn报 rnException in thread "main" java.lang.NullPointerExceptionrn at com.ziboyanhua.oa.user.service.UserService.inste(UserService.java:24)rn at com.ziboyanhua.oa.user.service.UserService.main(UserService.java:29)rnrnrn
skb中的mac_header报空指针
用netfilter编写内核模块,放在ARM开发板上,不过运行的时候因为报<em>空指针</em>内核崩溃。rn后来查明在钩子函数中的skb->mac_header地址为空,也就是0x00000000,但是skb的地址确为0xc0470620,不为空。rnskb->mac_header的地址不应该是skb的地址加上偏移量得到的嘛,为什么会为空呢?rn本人刚学习内核,有很多方面不懂,还请各位多多指教!
去session代码报空指针
package com.logic.mail;rnrnimport uk.ltd.getahead.dwr.*;rnrnrnrn/**rnrn* DWR的session操作类rnrn* @author sunylatrnrn*/rnrnpublic class DwrSession rnrnrnrn //得到session编号rnrn public String getSessionId() rnrn WebContext webContext = WebContextFactory.get();rnrn webContext.getSession();rnrn webContext.getHttpServletRequest();rnrn webContext.getHttpServletResponse();rnrn return webContext.getSession().getId();rnrn rnrn rnrn /**rnrn * 设定制定的session值rnrn * @param value 要设定的session值rnrn * @param sessionName session名称rnrn */rnrn public void setSession(String sessionName,String value)rnrn WebContext webContext = WebContextFactory.get();rnrn //设定session值rnrn webContext.getSession().setAttribute(sessionName,value);rnrn rnrn rnrn /**rnrn * 获取指定的session值rnrn * @param sessionName session名称rnrn * @returnrnrn */rnrn public String[] getSession(String sessionName)rnrn WebContext webContext = WebContextFactory.get(); rnrn //返回session值rn //session.setAttribute("result", result);rn return (String[])webContext.getSession().getAttribute("result");rnrn rn public static void main(String args[])rn DwrSession ds = new DwrSession();rn rn// String[] result1 = new String[2];rn// result1[0] = "dddd";rn// result1[1] = "1";rn// for(int i=0;i
jstl 自定义标签报空指针错误!
common.tld 文件 路径为WEB-INF/tld/下rnrn rn rn 1.0 rn common rn rn rn subDate rn com.synball.hksis.util.bo.CommonService rn rn java.lang.String subDate(java.util.Date,java.util.Date,int) rn rn rnrnjsp文件rnrn$zy:subDate(each.eventlink_id.starttime,each.eventlink_id.starttime,2)rnjava文件rnpublic String subDate(Date date1, Date date2,int d)rn rn
动态添加树结构报空指针错误?
代码[code=C#]private void BindToTree() rn int count = 0;rn int parentID = 0;rn IArticleCategoryBusiness business = ArticleCategoryBusinessFactory.CreateArticleCategoryBusiness();rn DataTable table = business.GetNodeByArticleCategory();rn if (table != null)rn rn count = table.Rows.Count;rn TreeNode[] currentNode = new TreeNode[count];rn for (int i = 0; i < table.Rows.Count; i++)rn rn string name = table.Rows[i]["Name"].ToString();rn parentID = Convert.ToInt32(table.Rows[i]["ParentId"]);rn currentNode[parentID].Text = name;rn if (currentNode[parentID] == null)rn rn this.TreeView1.Nodes.Add(new TreeNode("没有文章"));rn rn elsern rn this.TreeView1.Nodes.Add(currentNode[parentID]);rn rn rn[/code]rn在currentNode[parentID].Text = name;报<em>空指针</em>错误,是怎么回事?rn数据库里是有数据的rn
登录模块一直报空指针
一直报<em>空指针</em>,这里: if(userDao.findByNameAndPass(name, password).size()&gt;=1) 找了半天原来是applicationContext.xml没有配好
自定义listview的ArrayAdapter报空指针
布局activity_list_view_test.xmlrn[code=html]rnrnrn rn rnrn rn rnrnrn[/code]rnrnrow list_vew_test_row.xmlrn[code=html]rnrnrnrn rnrn rnrnrn[/code]rnrnjava代码rn[code=java]rnpublic class ListViewTest extends ListActivity rnrn TextView selection;rn String[] items = rn "Apple", "orange", "Banana", "peach", "Grape", "Strawberry", "matermelon", "lemon"rn ;rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_list_view_test);rn //setContentView(R.layout.list_vew_test_row);rn // setListAdapter(new ArrayAdapter(this,rn // android.R.layout.simple_list_item_1, items));rn setListAdapter(new IconicAdapter());rnrn selection = (TextView)findViewById(R.id.txtselection);rn selection.setText("Please select");rn rnrn @Overridern public boolean onCreateOptionsMenu(Menu menu) rn // Inflate the menu; this adds items to the action bar if it is present.rn getMenuInflater().inflate(R.menu.list_view_test, menu);rn return true;rn rnrn public void onListItemClick(ListView parent, View v, int position, long id) rnrn selection.setText(items[position]);rn rnrn class IconicAdapter extends ArrayAdapter rn IconicAdapter() rn super(ListViewTest.this, R.layout.list_vew_test_row, items);rn rnrn public View getView(int position, View convertView, ViewGroup parent) rnrn LayoutInflater inflater = getLayoutInflater();rn View row = inflater.inflate(R.layout.list_vew_test_row, parent, false);rn TextView label = (TextView)findViewById(R.id.label);rn label.setText(items[position]);rnrn ImageView icon = (ImageView)findViewById(R.id.icon);rn if (items[position].length() >= 5) rn icon.setImageResource(R.drawable.ok);rn else rn icon.setImageResource(R.drawable.delete);rn rn return row;rn rn rnrn[/code]rnrnerror:rn[code=text]rnD/TextLayoutCache( 8977): Using debug level: 0 - Debug Enabled: 0rnD/AndroidRuntime( 8977): Shutting down VMrnW/dalvikvm( 8977): threadid=1: thread exiting with uncaught exception (group=0x40aaf210)rnE/AndroidRuntime( 8977): FATAL EXCEPTION: mainrnE/AndroidRuntime( 8977): java.lang.NullPointerExceptionrnE/AndroidRuntime( 8977): at com.example.test.ListViewTest$IconicAdapter.getView(ListViewTest.java:58)rnE/AndroidRuntime( 8977): at android.widget.AbsListView.obtainView(AbsListView.java:2043)rnE/AndroidRuntime( 8977): at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)rnE/AndroidRuntime( 8977): at android.widget.ListView.onMeasure(ListView.java:1155)rnE/AndroidRuntime( 8977): at android.view.View.measure(View.java:12897)rnE/AndroidRuntime( 8977): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4805)rnE/AndroidRuntime( 8977): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1385)rnE/AndroidRuntime( 8977): at android.widget.LinearLayout.measureVertical(LinearLayout.java:676)rnE/AndroidRuntime( 8977): at android.widget.LinearLayout.onMeasure(LinearLayout.java:557)rnE/AndroidRuntime( 8977): at android.view.View.measure(View.java:12897)rnE/AndroidRuntime( 8977): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4805)rnE/AndroidRuntime( 8977): at android.widget.FrameLayout.onMeasure(FrameLayout.java:297)rnE/AndroidRuntime( 8977): at android.view.View.measure(View.java:12897)rnE/AndroidRuntime( 8977): at android.widget.LinearLayout.measureVertical(LinearLayout.java:828)rnE/AndroidRuntime( 8977): at android.widget.LinearLayout.onMeasure(LinearLayout.java:557)rnE/AndroidRuntime( 8977): at android.view.View.measure(View.java:12897)rnE/AndroidRuntime( 8977): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4805)rnE/AndroidRuntime( 8977): at android.widget.FrameLayout.onMeasure(FrameLayout.java:297)rnE/AndroidRuntime( 8977): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)rnE/AndroidRuntime( 8977): at android.view.View.measure(View.java:12897)rnE/AndroidRuntime( 8977): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)rnE/AndroidRuntime( 8977): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)rnE/AndroidRuntime( 8977): at android.os.Handler.dispatchMessage(Handler.java:99)rnE/AndroidRuntime( 8977): at android.os.Looper.loop(Looper.java:137)rnE/AndroidRuntime( 8977): at android.app.ActivityThread.main(ActivityThread.java:4441)rnE/AndroidRuntime( 8977): at java.lang.reflect.Method.invokeNative(Native Method)rnE/AndroidRuntime( 8977): at java.lang.reflect.Method.invoke(Method.java:511)rnE/AndroidRuntime( 8977): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)rnE/AndroidRuntime( 8977): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)rnE/AndroidRuntime( 8977): at dalvik.system.NativeStart.main(Native Method)rnW/ActivityManager( 376): Force finishing activity com.example.test/.ListViewTestrn[/code]rnrn58行:[code=java]label.setText(items[position]);[/code]
ssm整合意外报空指针
### Error querying database.  Cause: java.lang.NullPointerException ### The error may exist in file [E:\Myeclipes\apache-tomcat-7.0.62\webapps\message_test\WEB-INF\classes\com\bawei\mapper\TMessageMa
HibernateTemplate分页条件查询报空指针
分页方法代码如下:18行报<em>空指针</em>rn[code=java]rnpublic Object[] queryPagination(final Map mpParam,rn final Integer pageIndex, final Integer pageSize) rnrn // 公用hqlrn final StringBuffer strbHQL = new StringBuffer();rn strbHQL.append("from DocumentEntry de where de.entryUuid > 0");rn if (mpParam.get("patientId") != null) rn strbHQL.append(" and de.patientId like :patientId");rn rn if (mpParam.get("title") != null) rn strbHQL.append(" and de.title like :title");rn rnrn HibernateTemplate hibernateTemplate = getHibernateTemplate();rnrn // 查询总记录数rn Integer totalCount = (Integer) hibernateTemplatern .execute(new HibernateCallback() rnrn @Overridern public Object doInHibernate(Session session)rn throws HibernateException, SQLException rn rn StringBuffer strbHQLCount = new StringBuffer();rn strbHQLCount.append("select count(de) ");rn strbHQLCount.append(strbHQL);rn Query queryCount = session.createQuery(strbHQLCountrn .toString());rn if (mpParam.get("patientId") != nullrn && !mpParam.get("patientId").equals("")) rn queryCount.setString("patientId",rn (String) mpParam.get("patientId"));rn rn if (mpParam.get("title") != null) rn queryCount.setString("title",rn (String) mpParam.get("title"));rn rnrn return ((Long) queryCount.uniqueResult()).intValue();rn rn );rnrn // 查询当前页列表rn @SuppressWarnings("unchecked")rn List list = hibernateTemplatern .executeFind(new HibernateCallback() rnrn @Overridern public Object doInHibernate(Session session)rn throws HibernateException, SQLException rn rn StringBuffer strbHQLSelect = new StringBuffer();rn strbHQLSelect.append(strbHQL);rn Query querySelect = session.createQuery(strbHQLSelectrn .toString());rn if (mpParam.get("patientId") != nullrn && !mpParam.get("patientId").equals("")) rn querySelect.setString("patientId",rn (String) mpParam.get("patientId"));rn rn if (mpParam.get("title") != null) rn querySelect.setString("title",rn (String) mpParam.get("title"));rn rn querySelect.setFirstResult((pageIndex - 1) * pageSize);rn querySelect.setMaxResults(pageSize);rnrn return querySelect.list();rn rn );rnrn return new Object[] totalCount, list ;rn rn[/code]rn[img=https://img-bbs.csdn.net/upload/201406/25/1403671924_839823.png][/img]
ThreadPoolTaskExecutor Run 执行报空指针
String tableName;rn String areaCode; rn QuartzController quartzController =new QuartzController();rn rn public RunRuleInJVMDaemen(String tableName,String areaCode)rn this.tableName = tableName;rn this.areaCode = areaCode;rn rn rn public synchronized void run() rn Map params = new HashMap();rn params.put("tableName", tableName);rn params.put("areaCode", areaCode);rn quartzController.getTableBaseInfoS(params);rn rnrn运行getTableBaseInfoS(); 方法 就报<em>空指针</em> rnException in thread "ruleExecuterPool-1" java.lang.NullPointerExceptionrn求大神告知 怎么解决
listview复用缓存报空指针
<em>空指针</em>真是经典啊,不过还是没找到问题rnrnpublic class Myadapter extends BaseAdapter rnrn private Context mcontext;rnrn public Myadapter(Context context) rnrn this.mcontext = context;rnrn rnrn @Overridern public int getCount() rn return 8;rn rnrn @Overridern public Object getItem(int position) rn return null;rn rnrn @Overridern public long getItemId(int position) rn return 0;rn rnrn @Overridern public View getView(int position, View convertView, ViewGroup parent) rn ViewHoller v = null;rn if (convertView == null) rn v = new ViewHoller();rn convertView = LayoutInflater.from(mcontext).inflate(R.layout.item,rn null);rn v.mTvNo = (TextView) convertView.findViewById(R.id.tvNo);rn v.mTvAmount = (TextView) convertView.findViewById(R.id.tvAmount);rn v.mTvState = (TextView) convertView.findViewById(R.id.tvState);rn v.mTvTime = (TextView) convertView.findViewById(R.id.tvTime);rn v.mTvOperate = (TextView) convertView.findViewById(R.id.tvOperate);rn convertView.setTag(v);rn else rn v = (ViewHoller) convertView.getTag();rn rn v.mTvNo.setText("201611021428"); [color=#FF0000] //这里报<em>空指针</em>[/color]rn v.mTvAmount.setText("188");rn v.mTvState.setText("已发货");rn v.mTvTime.setText("2016-11-02 14:28");rn v.mTvOperate.setText("");rn return convertView;rn rnrn class ViewHoller rn TextView mTvNo, mTvAmount, mTvState, mTvTime, mTvOperate;rn rn
为什么报空指针错误呢
rnclass Studentrn int number;rn double score;rn double state;rn public int getNumber() rn return number;rn rn public void setNumber(int number) rn this.number = number;rn rn public double getScore() rn return score;rn rn public void setScore(int score) rn this.score = score;rn rn public double getState() rn return state;rn rn public void setState(int state) rn this.state = state;rn rn rnrnrnpublic class ShuZu2 rn public static void main(String[] args)rn rn Student[] students = new Student[20];rn rn rn for(int number=0;number
springmvc报的service空指针的异常
今天在springmvc框架的配置中,出现了HTTP STATUS 500 Request processing failed; nested exception is java.lang.NullPointerException 具体服务器报错如下: type Exception report message Request processing failed; nested e
PHPDesigner绿色注册版下载
PHPDesigner绿色注册版 内涵注册码。PHP编程最好的ide 相关下载链接:[url=//download.csdn.net/download/kkstkkst/2644420?utm_source=bbsseo]//download.csdn.net/download/kkstkkst/2644420?utm_source=bbsseo[/url]
xor问题c++算法下载
xor(异或分类)问题的c++算法,很经典的 相关下载链接:[url=//download.csdn.net/download/tiantian0623/2760692?utm_source=bbsseo]//download.csdn.net/download/tiantian0623/2760692?utm_source=bbsseo[/url]
apk反编译工具中文版 v2.1 绿色版下载
针对安卓APK文件制作的强大逆向辅助软件,功能涵盖apk反编译打包签名;dex/jar互转替换提取修复;so反编译;xml、txt加密;字符串编码等 相关下载链接:[url=//download.csdn.net/download/nihaokong/8576445?utm_source=bbsseo]//download.csdn.net/download/nihaokong/8576445?utm_source=bbsseo[/url]
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件
我们是很有底线的