HttpSession.removeAttribute() 报 java.lang.NullPointerException [问题点数:20分]

Bbs1
本版专家分:0
结帖率 0%
Bbs1
本版专家分:100
Bbs7
本版专家分:23628
版主
Blank
红花 2013年7月 Java大版内专家分月排行榜第一
报java.lang.NullPointerException 错误!!!??
HttpSession session=request.getSession(false);rnrn 高手们看看吧! 为什么 啊?
JSP页面报500错误 java.lang.NullPointerException
服务器其他页面都正常,就这个报这个错误,是哪里出现了问题rnrnError 500--Internal Server Error rnjava.lang.NullPointerExceptionrn at jsp_servlet._callout_telmarket.__report_wcqk_query_list._jspService(__report_wcqk_query_list.java:483)rn at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)rn at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)rn at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)rn at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)rn at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:391)rn at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309)rn at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)rn at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)rn at com.kingdom.kdf.CharsetFilter.doFilter(CharsetFilter.java:91)rn at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)rn at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3368)rn at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)rn at weblogic.security.service.SecurityManager.runAs(Unknown Source)rn at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2117)rn at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2023)rn at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)rn at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)rn at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)rn rn
多数据源spring 报java.lang.NullPointerException
在调用test.java的时候就会报rnrnException in thread "main" java.lang.NullPointerExceptionrn at cn.m_solution.mds.mds40.service.MDS40T01Service.getStudent(MDS40T01Service.java:23)rn at cn.m_solution.mds.mds40.service.test.main(test.java:13)rnrn请大家一定帮忙,已经弄了两天了rnrnrn[color=red]moduleContext-sys.xml:[/color]rnrnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn mds00.dorn /mds13.dorn /mds40.dorn rn rn rn rn rn rn jsrn cssrn jsprn htmlrn rn rn rn rn rn rn /pages/index.htmlrn /pages/mds40/mds40s00.jsprn rn rnrn rnrn rn rn rn rn rn rn rn /WEB-INF/config/jdbc/jdbc.propertiesrn rn rnrnrn 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 PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn rn 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 *Servicern rn rn rnrn rn rn rn rn rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rnrn rnrnrnrnrn[color=red]sqlmapconfig.xml[/color]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnsqlMap-mds40.xmlrnrnrnrn rnrnrn rn select rn syrrn from rn vehiclern where rn hpzl = #hpzl#rn and hphm = #hphm#rn rnrn rnrnrnrnrnMDS40T01Servicernrnpackage cn.m_solution.mds.mds40.service;rnrnrnimport org.springframework.orm.ibatis.SqlMapClientTemplate;rnrnimport cn.m_solution.mds.mds40.form.MDS40Form;rnrnrnpublic class MDS40T01Service rn SqlMapClientTemplate sqlMapClientTemplate;rn rnrnrn public MDS40Form getStudent()rn rn MDS40Form form40 = new MDS40Form();rn sqlMapClientTemplate.queryForObject("sql.mds40.001",form40);rn return form40;rn rn /**rn * @return the sqlMapClientTemplatern */rn public SqlMapClientTemplate getSqlMapClientTemplate() rn return sqlMapClientTemplate;rn rnrn /**rn * @param sqlMapClientTemplate the sqlMapClientTemplate to setrn */rn public void setSqlMapClientTemplate(SqlMapClientTemplate sqlMapClientTemplate) rn this.sqlMapClientTemplate = sqlMapClientTemplate;rn rnrnrnrntest.javarnrnpackage cn.m_solution.mds.mds40.service;rnrnimport org.springframework.jdbc.core.support.JdbcDaoSupport;rnrnpublic class test extends JdbcDaoSupportrnrn /**rn * @param argsrn */rn public static void main(String[] args) rn // TODO Auto-generated method stubrn MDS40T01Service s = new MDS40T01Service();rn s.getStudent();rn rnrnrn
又报错了java.lang.NullPointerException
正在学习JSP。rn做了一个BEAN叫basicJDBC.java,用于连接数据库。做了一个servlet叫login.java,用于验证输入的用户和口令。还有一个index.jsp.rnBasicJDBC.java:rn...rnpublic java.sql.Connection getConn() rn try Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();rn conn =DriverManager.getConnection( "jdbc:oracle:thin:@10.0.0.1:1521:db","test","test");rn catch (Exception e) e.printStackTrace();rn return conn;rnrn...rn------login.java--------------------------------------------rn...rndoPostrnif(IsValid(name,pswd))rn ServletContext context = getServletContext(); rn context.getRequestDispatcher("/index.jsp").forward(req,resp);rn...rnrnrnrnprivate boolean IsValid(String name, String pswd) throws SQLException rn boolean okey=false;rn BasicJDBC conDB = null;rn conDB.getConn)();rn String str="xxx";rn if(conDB.executeSql(str).next())rn okey=true;rn elsern okey=false;rn return okey;rnrn...rnrn在index.jsp中输入用户和口令提交后,提示java.lang.NullPointerException错误,请问怎么解决啊?另外,我的编写方式对不对啊?rn多谢了!!!!
conn.createStatement报java.lang.nullpointerexception错误
连接服务器的Oracle 11g,想把数据库中的一个表中的几条记录查找出来,代码如下,但是出现了<em>java.lang.nullpointerexception</em>错误,菜鸟不知道怎么解决。代码如下:rnrnpackage com.until;rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnpublic class testCon rn private static String URL = "jdbc:oracle:thin:@172.16.14.143:1521:windp";rn private static String USERNAME = "windpower01";rn private static String PASSWORD = "windpower01";rn private static Connection conn;rn public static Connection getCon() throws SQLExceptionrn Connection conn = null;rn rn try rn Class.forName("oracle.jdbc.driver.OracleDriver");rn conn = DriverManager.getConnection(URL,USERNAME,PASSWORD);rn catch (Exception e) rn e.printStackTrace();rn rn return conn;rn rn rn /**rn * @param stmt rn * @param argsrn */rn public static void main(String[] args) rn ResultSet rs=null;rn Statement stmt=null;rn String ono=null;rn String ona=null;rn String pas=null;rn tryrn stmt=conn.createStatement();rn rs=stmt.executeQuery("SELECT OPERNO,OPERNAME,PASSWORD FROM OPERATOR");rn while(rs.next())rn rn ono=rs.getString(1);rn ona=rs.getString(2);rn pas=rs.getString(3);rn System.out.println("OPERNO:"+ono+",OPERNAME:"+ona+",PASSWORD:"+pas);rn rn rn catch (Exception e) rn e.printStackTrace();rn rn rn public static void close(Connection con,Statement sm,ResultSet rs)rn try rn if(con!=null)rn con.close();rn rn if(sm!=null)rn sm.close();rn rn if(rs != null)rn rs.close();rn rn catch (SQLException e) rn e.printStackTrace();rn rn rnrn报错显示是 stmt=conn.createStatement();这里
request.getSession报java.lang.NullPointerException
代码如下:rn[code=Java]rn HttpSession userSession = request.getSession();rn Map userMap = (Map)userSession.getAttribute("userMap");rn[/code]rn环境:ssh+mysql。rn问题描述:这是一个登录过程,正常情况下没任何问题,但是在压力测试的时候,在如上代码第二行位置报java.lang.NullPointerException。rn何解?
java运行报java.lang.NullPointerException错
大家好!我是刚刚学java的,用的是sql2005和JBuilder2006.下面是程序代码。原来在我的笔记本上运行一切正常。因笔记本速度太慢最近配了台新机子,安装了sql2005和JBuilder2006,将数据库导入新机后,运行程序就报错。rnrn报错信息如下:rn rnjava.lang.NullPointerExceptionrn at com.dao.SearchDao.getBean(SearchDao.java:24)rn at com.frame.MianBan.jButton1_actionPerformed(MianBan.java:131)rn at com.frame.MianBan_jButton1_actionAdapter.actionPerformed(MianBan.java:267)rnrn请问是什么原因,JBuilder中JDBC的配置和笔记本中的一样,是不是sql2005数据库的问题?????数据库我也导过来了。代码我没有修改过,这是什么原因,马上要考试了,请各位帮帮我,谢谢!!!!!!!!!!!rnrnrnrnrnrnrnrn
hibernate 视图查询~报java.lang.NullPointerException
public List getPart(final TSpeId emin)rn rn return this.getHibernateTemplate().executeFind(new HibernateCallback()rnrn public Object doInHibernate(Session session)rn throws HibernateException, SQLException rn Query q=session.createQuery("from TSpeId as a where a.EMin=:m");rn q.setString("m", emin.getEMin());rn return q.list();rn );rn rnrnrnpublic List getPart(TSpeId emin) rn System.out.println("eeeeeeeeee");rn List ar=this.shuDAO.getPart(emin);rn System.out.println("eqqqqqqqqqqq");rn List arr=new ArrayList();rn for(int i=0;i
servlet调用连接池报java.lang.NullPointerException
com.drp.jdbc.util.DrpConnectionTest.init(DrpConnectionTest.java:32)rncom.drp.jdbc.util.DrpConnectionTest.getConnection(DrpConnectionTest.java:56)rnuser_add_servlet.doPost(user_add_servlet.java:34)rnrnrn[code=Java]package com.drp.jdbc.util;rnrnimport java.io.IOException;rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.PreparedStatement;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.util.*;rnrnpublic class DrpConnectionTest rn rn public static void main(String[] args)rn init();rn rn rn private static final String drpconfig="/drpconfig.properties";rn rn private static Map configMap = null;rn rn private static DrpConnectionTest drpconn = new DrpConnectionTest();rn rn public static void DrpConnectionTest1()rn init(); rn initDriver();rn rn rn private static void init()rn configMap = new HashMap();rn Properties ps = new Properties();rn try rn ps.load(ps.getClass().getResourceAsStream(drpconfig)); // 这就是第32行。??????rn Set keys = ps.keySet();rn for(Object key : keys)rn String value = (String)ps.get(key);rn configMap.put((String)key, value.trim());rn System.out.println("key "+ key +", value " + value);rn System.out.println("aaa "+configMap.get("drp.driver_class"));rn rn catch (IOException e) rn System.out.println(e);rn rn rn private static void initDriver()rn try rn Class.forName(configMap.get("drp.driver_class")).newInstance();rn catch (InstantiationException e) rn e.printStackTrace();rn catch (IllegalAccessException e) rn e.printStackTrace();rn catch (ClassNotFoundException e) rn e.printStackTrace();rn rn rn public static Connection getConnection() throws SQLExceptionrn init(); // 这是第56行。?????????????????rn return DriverManager.getConnection(configMap.get("drp.url"),configMap.get("drp.username"),configMap.get("drp.password"));rn rn rn public static void closePreparedStatement(PreparedStatement pstmt)rn if(pstmt != null)rn try rn pstmt.close();rn catch (SQLException e) rn e.printStackTrace();rn rn rn pstmt = null;rn rn public static void closeConnection(Connection conn)rn if(conn != null)rn try rn conn.close();rn catch (SQLException e) rn e.printStackTrace();rn rn rn conn = null;rn rn public static void closeResultSet(ResultSet rs)rn if(rs != null)rn try rn rs.close();rn catch (SQLException e) rn e.printStackTrace();rn rn rn rs = null;rn rnrn[/code]rnrn我在用main方法测试可以得到drpconfig.properties文件里的值,但为什么用serlvet调用就不行呢。。rn下面是servlet 代码rnrn[code=Java][/code]
编译时总报java.lang.nullPointerException的错误
这个是什么问题,高手指点一下,多谢了!
莫名其妙!WSAD又报java.lang.NullPointerException。
实在不知道哪里错了,很是苦恼。唉~~rn代码如下:rnclass Create_SavernString key;rnString file_path;rnString project_code;rnString project_name;rnString unit_code;rnString area_code;rnString area_name;rnrnVector files;rnint count;rnHashtable[] ht;rnrnprivate DataSource ds;rnprivate Connection conn = null;rnprivate Statement stmt = null;rnprivate ResultSet rs = null;rnprivate InitialContext ic = null;rn rnpublic Create_Save(ConnMailDB connmaildb) rn super();rn ds = connmaildb.getDataSource();rn conn = connmaildb.getConnection();rn stmt = connmaildb.getStatement();rn ic = connmaildb.getInitialContext();rnrnpublic void getDirInfo()rn rn tryrn rn ResultSet info_rs = stmt.executeQuery("select count(*) from sub_project");rn if(info_rs.next()) rn rn count = rs.getInt("count(*)"); //一到这就报java.lang.NullPointerExceptionrnrn ht = new Hashtable[count];rn rn elsern rn System.out.println("找不到上报文件的保存路径信息!");rn return;rn rn info_rs = stmt.executeQuery("select project_code,project_name from sub_project");rn if(info_rs.next())rn rn for(int i=0;i
weblogic 部署工程报 java.lang.NullpointerException
(DeploymentConfigurationHelper.java:352)rn at com.bea.console.utils.DeploymentConfigurationManager.createDeploymentConfigurationHelper(DeploymentConfigurationManager.java:238)rn at com.bea.console.utils.DeploymentConfigurationManager.getDeploymentConfiguration(DeploymentConfigurationManager.java:104)rn at com.bea.console.utils.DeploymentUtils.getMergedModuleInfo(DeploymentUtils.java:2882)rn at com.bea.console.actions.app.DeploymentsControlTableAction.createApplicationNodes(DeploymentsControlTableAction.java:288)rn at com.bea.console.actions.app.ApplicationOverviewAction.getCollection(ApplicationOverviewAction.java:107)rn at com.bea.console.actions.BaseTableAction.display(BaseTableAction.java:46)rn at com.bea.console.actions.BaseDisplayAction.execute(BaseDisplayAction.java:94)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)rn at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)rn at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)rn at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)rn at com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:262)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)rn at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)rn at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)rn at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)rn at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)rn at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)rn at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)rn at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)rn at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction( at com.bea.netuix.nf.Lifecycle.runOutbound(Lifecycle.java:208)rn at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:162)rn at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)rn at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)rn at com.bea.netuix.servlets.manager.UIServlet.doGet(UIServlet.java:211)rn at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:196)rn at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)rn at com.bea.console.utils.MBeanUtilsInitSingleFileServlet.service(MBeanUtilsInitSingleFileServlet.java:47)rn at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)rn at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)rn at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)rn at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)rn at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)rn at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)rn at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)rn at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)rn at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)rn at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)rn at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)rn at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)rn at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)rn at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)rn at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)rn at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)rnCaused by: weblogic.utils.compiler.ToolFailureException: Exception in AppMerge flows' progressionrn at weblogic.application.compiler.AppMerge.merge(AppMerge.java:172)rn at weblogic.deploy.api.internal.utils.AppMerger.merge(AppMerger.java:88)rn at weblogic.deploy.api.internal.utils.AppMerger.getMergedApp(AppMerger.java:63)rn ... 93 morernCaused by: weblogic.utils.compiler.ToolFailureException: weblogic.appc failedrn at weblogic.application.compiler.FlowDriver.handleStateChangeException(FlowDriver.java:53)rn at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:37)rn at weblogic.application.compiler.FlowDriver$CompilerFlowDriver.compile(FlowDriver.java:96)rn at weblogic.application.compiler.AppMerge.runBody(AppMerge.java:157)rn at weblogic.utils.compiler.Tool.run(Tool.java:158)rn at weblogic.utils.compiler.Tool.run(Tool.java:115)rn at weblogic.application.compiler.AppMerge.merge(AppMerge.java:169)rn ... 95 morernCaused by: java.lang.NullPointerExceptionrn at weblogic.application.utils.ClassFinderMetaDataEnumaration.hasMoreElements(ClassFinderMetaDataEnumaration.java:32)rn at weblogic.servlet.internal.WebAnnotationProcessorImpl.getAnnotatedClasses(WebAnnotationProcessorImpl.java:141)rn at weblogic.application.compiler.WARModule$WarModuleWebAppHelper.getAnnotatedClasses(WARModule.java:602)rn at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:89)rn at weblogic.application.compiler.WARModule.processAnnotations(WARModule.java:445)rn at weblogic.application.compiler.EARModule.processAnnotations(EARModule.java:227)rn at weblogic.application.compiler.WARModule.merge(WARModule.java:492)rn at weblogic.application.compiler.flow.SingleModuleMergeFlow.proecessModule(SingleModuleMergeFlow.java:16)rn at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:37)rn at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)rn at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)rn at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)rn at weblogic.application.compiler.FlowDriver$CompilerFlowDriver.compile(FlowDriver.java:96)rn at weblogic.application.compiler.ReadOnlyWarMerger.merge(ReadOnlyWarMerger.java:27)rn at weblogic.application.compiler.flow.AppMergerFlow.mergeInput(AppMergerFlow.java:88)rn at weblogic.application.compiler.flow.AppMergerFlow.compile(AppMergerFlow.java:41)rn at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)rn at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)rn at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)rn ... 100 morern> rnrn问题补充:rn 虚拟机9安装了redhat5及wls1031_linux32.bin weblogic后(部署过程中无错误),部署一个java工程。工程本地编译后上传到weblogic部署。部署时报java.lang.NullpointerException错误,上面是错误日志。rn 上传本地编译工程到别的linux安装的weblogic下,部署正常,系统运行正常。rn 把别的环境下能正常运行的工程拷贝下来,部署到虚拟机上,正常运行。rn 不知道各位有什么好的指导建议。
POI读EXCEL报java.lang.NullPointerException
public ArrayList FormExcel(String fileToBeRead) rn ArrayList list = new ArrayList();rnrn try rnrn HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(rn fileToBeRead));rnrn HSSFSheet sheet = workbook.getSheetAt(0);rn // 获得SHEET表的行数rn int num = sheet.getLastRowNum();rn System.out.println(num);rn System.out.println(sheet.getLastRowNum());rn System.out.println(sheet.getFirstRowNum());rn // Date类型数据转换为Stringrn SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd");rn for (int i = 1; i + e);rn // 读取EXCEL数据出异常就设置LIST为NULLrn list = null;rn rn return list;rn rnrnrn上面是我写的一个读取EXCEL表中的数据先一条条的封装到一个JAVABEAN中.在把这个BEAN加到ArrayList中去..现在问题就当读取EXCEL CELL是空白字符类型就会报:读取EXCLE记录有错 : java.lang.NullPointerExceptionrn感觉有些奇怪..那位大虾帮帮小弟看看.小弟在此先谢谢了.
SSH 干嘛怎报java.lang.NullPointerException
public List getOne()rn rn return this.getHibernateTemplate().executeFind(new HibernateCallback()rn rn rn public Object doInHibernate(Session session) throws HibernateException,rn SQLExceptionrn rn String sql="from TEmp as a inner join a.TPart";rn Query q=session.createQuery(sql);rn return q.list();rn rn );rn rnrnpublic List getOnePart()rn rn TEmp emp=null;rn System.out.println("dddddddd");rn [color=#FF0000]List ar=this.empDAO.getOne();[/color]rn List arr=new ArrayList();rn for(int i=0;i
一般报java.lang.NullPointerException的原因有以下几种
一般报java.lang.NullPointerException的原因有以下几种: ·字符串变量未初始化; ·接口类型的对象没有用具体的类初始化,比如: List lt; 会报错 List lt = new ArrayList(); 则不会报错了 ·当一个对象的值为空时,你没有判断为空的情况。 你可以试着把下面的代码前加一行代码: if(rb!=null);
android解析xml文件又报java.lang.NullPointerException错误
package com.huawei.biz;rnimport java.io.InputStream;rnimport javax.xml.parsers.DocumentBuilder;rnimport javax.xml.parsers.DocumentBuilderFactory;rnrnimport org.w3c.dom.Document;rnimport org.w3c.dom.Node;rnimport org.w3c.dom.NodeList;rnimport com.huawei.entity.*;rnrnimport android.app.Activity;rnimport android.content.ContentValues;rnimport android.content.Context;rnimport android.net.Uri;rnimport android.os.Bundle;rnimport android.util.Log;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnrnrnpublic class LoadXml extends Activity rn private final static String TAG="LoadXml";rn public static Context context = null;rn Document document = null;rn NodeList childsNodes = null;rn DocumentBuilderFactory factory = null;rn DocumentBuilder builder = null;rn InputStream inputStreams = null;rn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn rn Button button1=(Button)findViewById(R.id.button1);rn button1.setOnClickListener(button1OnClickListener);rn rn rn OnClickListener button1OnClickListener=new OnClickListener()rn @Overridern public void onClick(View v) rn Log.d(TAG, "onClick");rn getComplateXml();rn rn rn ;rn public void getComplateXml()rn try rn Log.d(TAG, "getComplateXml");rn readUserConfig();rn int j = 0;rn for (int i = 0; i < childsNodes.getLength(); i++) rn Log.d(TAG, "1");rn Node node = (Node) childsNodes.item(i);rn Log.d(TAG, "2");rn Uri insertUri = Uri.parse("content://com.huawei.biz.LoadContentProvider/STUDENTS");rn Log.d(TAG, "3");rn ContentValues values = new ContentValues();rn Log.d(TAG, "4");rn values.put("name", node.getNodeName());rn Log.d(TAG, node.getNodeName());rn rn values.put("id", node.getFirstChild().getNodeValue());rn Log.d(TAG, node.getFirstChild().getNodeValue());rn rn values.put("Photo",DataManager.getDrawableList().get(j));rn Log.d(TAG, DataManager.getDrawableList().get(j).toString());rn rn getContentResolver().insert(insertUri, values);rn j++;rn rn catch (Exception e) rn e.printStackTrace();rn rn rn rn rn private void readUserConfig() throws Exceptionrn Log.d(TAG, "readUserConfig");rn factory = DocumentBuilderFactory.newInstance();rn builder = factory.newDocumentBuilder();rn inputStreams = getResources().getAssets().open("student.xml");rn document = builder.parse(inputStreams);rn rn childsNodes = document.getDocumentElement().getChildNodes();rn rnrnrn这次是在Log.d(TAG, "4"); 的后面开始报错的。。rnstudent.xml文件:rnrn rn TB0904060rn TB0904061rn TB0904062rn TB0904063rn TB0904064rn TB0904065rn TB0904066rn TB0904067rn TB0904068rn TB0904069rn TB0904070rn TB0904071rn TB0904072rn TB0904073rn rnrnrn
APK启动闪退,打印信息报java.lang.NullPointerException 求解
[code=java]package android.serialport.sample;rnrnimport android.serialport.sample.VMC_Comm_Package_Class;rnrnimport java.nio.Buffer;rnrnrn/**rn * Created by kdx on 2018/1/30.rn */rnrnpublic class VMC_Comm_Tx_Class rnrn// public class LineUprn// byte[] Buffer;/*发送数据缓冲区*/rn// byte Index;/*发送数据计数器*/rn// rn byte[] Buffer;rn byte Index;rn public void VMC_Comm_Tx_Class()rn byte inc,data=0;rn this.RepeatNum = 0;rn this.WaitResponse =0;rn this.WaitResponseTimeout =0;rnrnrn byte[] Buffer = new byte[1024];rn Index =0;rn// lineUps[0].Buffer = new byte[1024];rn//rn// lineUps[0].Index = 0;rn// lineUps[1].Buffer = new byte[1024];rn// lineUps[1].Index = 0;rn// for(int i=0;i<1024;i++) rn// lineUps[0].Buffer[i] =0x33;rn// lineUps[1].Buffer[i] =0x33;rn// rn rn public void VMC_Comm_Package_Pack(byte inc,byte data)rnrn [color=#FF0000] Buffer[inc] = data;[/color]rn //lineUps[0].Buffer[inc] = data;rn rn public byte[] VMC_Comm_Package_Data()rn return Buffer;rn rn /*rn **设置消息包的长度rn */rn public void VMC_Comm_Package_set_Index(byte num,byte len)rn switch (num)rn case 0:rn rn Index = len;rn break;rn case 1:rn rn Index = len;rn rn rn rn /*rn **获取消息包的长度rn */rn public byte VMC_Comm_Package_get_Index(byte num)rn byte i =0;rn switch (num)rn case 0:rn rn //i = lineUps[0].Index;rn i=Index;rn rn break;rn case 1:rn //i= lineUps[1].Index ;rn i=Index;rn rn break;rn rn return i;rn rnrnrnrnrnrn byte RepeatNum;/*重发的次数*/rn byte WaitResponse;/* 等待PC机应答标志*/rn int WaitResponseTimeout;/*等待应答的超时时间*/rn //LineUp[] lineUps = new LineUp[2];rnrn[/code]rnrn代码如上,小弟刚开始搞java 学的不太扎实,找了一天没找到哪错了,求大神rn编译成功,但是运行时闪退 logcat 提示如下信息。rnrnCaused by: java.lang.NullPointerExceptionrn at android.serialport.sample.VMC_Comm_Tx_Class.VMC_Comm_Package_Pack(VMC_Comm_Tx_Class.java:41)rn at android.serialport.sample.MainMenu.onCreate(MainMenu.java:52)rnrnrnBuffer[inc] = data 这句话就是第41行,不知道这句话有什么错吗?谢谢。rnrn
一般报java.lang.NullPointerException的原因有以下几种
一般报java.lang.NullPointerException的原因有以下几种: ·字符串变量未初始化; ·接口类型的对象没有用具体的类初始化,比如: [code=&quot;java&quot;]List lt;会报错 List lt = new ArrayList();则不会报错了[/code] · 当一个对象的值为空时,你没有判断为空的情况。 你可以试着把下面的代码前加一行代码: [code=...
executeQuery执行查询语句报java.lang.NullPointerException错
Connection conn = null;rn Statement state = null;rn ResultSet rs = null;rn try rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); rn String url="jdbc:microsoft:sqlserver://"+ip+":1433;DatabaseName="+name; rn rn conn= DriverManager.getConnection(url,user,password); rnif(!conn.isClosed())rn System.out.println("连接DB成功!!!");rn rnstate = conn.createStatement();rn rs = state.executeQuery("select * from ACCOUNT");rn if(rs.next())rn dorn Node rootname = XmlUtil.appendNode(doc, "root/data/list@type='rootname']/rootname/rootname" );rn Node rootid = XmlUtil.appendNode( doc, "root/data/list[@type='rootname']/rootname/rootid" );rn XmlUtil.setNodeValue( rootname, rs.getString(1) );rn XmlUtil.setNodeValue( rootid, rs.getString(2) );rn while(rs.next());rn elsern System.out.println("P3中无EPS根节点!");rn rn catch (RuntimeException e) rn e.printStackTrace();rn throw new Exception("数据查询异常"); rn finallyrn ConnectionManager.freeResource(rs, state, conn);rn rnconn连接已经成功,state也初始化成功,执行rs = state.executeQuery("select * from ACCOUNT");时抛出异常:rn连接DB成功!!!rnjava.lang.NullPointerExceptionrn at com.microsoft.jdbc.sqlserver.tds.TDSConnection.getTransliteratorForCodePage(Unknown Source)rn at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processColMetaData(Unknown Source)rn at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)rn at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)rn at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)rn at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)rn at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)rn at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)rn at com.ygsoft.p3.P3EPSTree.BL_queryRootName(P3EPSTree.java:54)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:324)rn at com.primeton.tp.core.bizservice.state.MethodBizState.invoke(MethodBizState.java:79)rn at com.primeton.tp.core.bizservice.ProcessRunner.implement(ProcessRunner.java:187)rn at com.primeton.tp.core.bizservice.ProcessCaller.implement_noEJB(ProcessCaller.java:230)rn at com.primeton.tp.core.bizservice.ProcessCaller.implement(ProcessCaller.java:117)rn at com.primeton.tp.core.prservice.automation.ActionState.debugProcess(ActionState.java:430)rn at com.primeton.tp.core.prservice.automation.ActionState.doUseCase(ActionState.java:141)rn at com.primeton.tp.core.prservice.automation.ActionState.doState(ActionState.java:58)rn at com.primeton.tp.core.prservice.automation.PrAutomationRunner.processAuto(PrAutomationRunner.java:164)rn at com.primeton.tp.core.prservice.automation.PrAutomationRunner.process(PrAutomationRunner.java:74)rn at com.primeton.tp.core.prservice.controller.Controller.doAction(Controller.java:243)rn at com.primeton.tp.web.driver.webdriver.WebDriver.process(WebDriver.java:715)rn at com.primeton.tp.web.driver.webdriver.WebDriver.doPost(WebDriver.java:447)rn at com.primeton.tp.web.driver.webdriver.WebDriverUpload.doPost(WebDriverUpload.java:164)rn at com.primeton.tp.web.driver.webdriver.WebDriver.doGet(WebDriver.java:263)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)rn at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)rn at java.lang.Thread.run(Thread.java:534)rn希望哪位高人指点一下怎么解决rn
求解:Struct2 上传图片报java.lang.NullPointerException错误
上传UpLoad.jsp:rnrn rn rn rn rn rn rn rn上传成功页面 UploadList.jsp:rnrn 文件已经保存到:rn "rn target=_blank>rn rn rn rn <;rn rnrn public File getPicture() rn return picture;rn rnrn public void setPicture(File file) rn this.picture = file;rn rnrn public String getPictureContentType() rn return pictureContentType;rn rnrn public void setPictureContentType(String fileContentType) rn this.pictureContentType = fileContentType;rn rnrn public String getPictureFileName() rn return pictureFileName;rn rnrn public void setPictureFileName(String fileFileName) rn this.pictureFileName = fileFileName;rn rnrnstruct.xml:rnrn rn image/bmp,image/x-png,image/gif,image/jpegrn 204800rn rn rn /UpLoad.jsprn /UploadList.jsprn rn
般报java.lang.NullPointerException的原因有以下几种:
般报java.lang.NullPointerException的原因有以下几种: ·字符串变量未初始化; ·接口类型的对象没有用具体的类初始化,比如: List lt;会报错 List lt = new ArrayList();则不会报错了 ·当一个对象的值为空时,你没有判断为空的情况。 你可以试着把下面的代码前加一行代码: if(rb!=null && rb!="")
svn更新后,jsp页面报java.lang.NullPointerException
请大神指点 谢谢n![图片说明](https://img-ask.csdn.net/upload/201505/12/1431396439_446549.png)n
为什么总是报java.lang.NullPointerException的错误呢?
public ResultSet ViewResultSet() throws SQLExceptionrn rn res=stmt.executeQuery("select * from forum");rn rn while(res.next())rn rn System.out.print(res.getString("title")); rn System.out.print(res.getString("content"));rn rn rn rn rn return res;rn rn调用javabean的ViewResultSet()时就报java.lang.NullPointerException的错误,应该如何避免呢?rn请各位指点一下,谢谢!!
在WIN中正常,LINUX下报java.lang.NullPointerException
在win中,编译运行都很正常。到了LINUX下报空指针。。折腾死我了。。求救。rn[code=Java]rnimport javax.swing.*;rnimport java.awt.*;rnimport javax.swing.Box;rnrnclass MyWin extends Framernrn Box boxv1,boxv2,baseBox;rn MyWin(String s)rn rn super(s);rn rn Box.createVerticalBox();rn boxv1.add(new JLabel("name"));rn boxv1.add(Box.createVerticalStrut(8));rn boxv1.add(new JLabel("Email"));rn boxv1.add(Box.createVerticalStrut(8));rn boxv1.add(new JLabel("Job"));rn boxv2.createVerticalBox();rn boxv2.add(new TextField(12));rn boxv2.add(Box.createVerticalStrut(8));rn boxv2.add(new TextField(12));rn boxv2.add(Box.createVerticalStrut(8));rn boxv2.add(new TextField(12));rn baseBox.createHorizontalBox();rn baseBox.add(boxv1);rn baseBox.add(Box.createHorizontalStrut(10));rn baseBox.add(boxv2);rn setLayout(new FlowLayout());rn add(baseBox);rn setBounds(100,100,200,250);rn setVisible(true);rn validate();rn rnrnclass UseBoxLayoutrnrn public static void main(String args[])rn rn MyWin fancy=new MyWin("fancy");rn rnrn[/code]
jbpm4发布任务报java.lang.NullPointerException异常
repositoryService.createDeployment().addResourceFromString("process.jpdl.xml", proDefinition.getDefXml()).deploy()rnaddResourceFromString()方法的第一个参数是干嘛用的有人帮解答下吗
为什么老报java.lang.NullPointerException 的错!!??(急)
如下:rnpublic class Testrn class Shurn int i;rn float f;rn rnpublic static void main(String[] args)rnShu[] k=new Shu[5];rnk[0].i=1;rnk[1].i=2; rnSystem.out.print(k[0].i+"");rnSystem.out.print(k[1].i+""); rn rnrn请大虾赐教,到底为什么?是不是对象数组声明错了?还是。。。。
为什么总是报空指针java.lang.NullPointerException错误?????????
我在javabean中写了一个函数rnpackage javabean;rnpublic class Poolrn private HashMap aml=null;rn public void setaml(String code,String name)rn aml.put(code,name);rn rn public HashMap getaml()rn return aml;rn rnrnrn我想在程序中用这个方法rn我的目的是添加“代码"和“名称"到 Hashmap中rnrnrn程序总是报java.lang.NullPointerExceptionrn这种错误rn我知道是 db.setaml(code,cname)造成的,原因我不知道!rn请大家帮忙rnrnrnrnrnrn
Myeclipse安装aptana插件后报java.lang.NullPointerException解决方案
我Myeclipse用helpsoftware updates...安装了aptana插件,已经被我破解了,使用都很正常,但是每次启动Myeclipse的时候都会报一个错误java.lang.NullPointerException,虽然不影响开发,但是每次启动都报一个错误,看起来就是非常的不爽,对于完美主义者来说只要是bug就一定要解决的,嘿嘿... 所以我试了一个下午终于搞好了 其实真的很简单!!
菜鸟--继续报弱智错java.lang.NullPointerException求解!!!
求解啊各位,它现在是说我没有实例化,好吧,后来我试了,我声明了也实例化了,可是最后注册操作的时候 输入的值传到最后全变成空的了。全部变成null null null,插入数据库也全部是空的了,不知哪里传丢了。rnrnrn贴上了rnrnrnrn2012-4-20 18:05:37 org.apache.catalina.core.StandardWrapperValve invokern严重: Servletdefault的Servlet.service()发生意外(exception)rnjava.lang.NullPointerExceptionrn at service.ULoginService.add(ULoginService.java:72)rn at action.ULoginAction.add(ULoginAction.java:85)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rnrn上代码吧,ULoginService72行是红色那行rn[code=Java]rn public void add(UserModel um)rn Connection conn = ConnectionDB.getConn();rn String sql = "insert into users values(?,?,null,?,?,?)";rn PreparedStatement ps = ConnectionDB.prepare(conn, sql);rn rn //UserModel um1 = new UserModel();rn //String busID = new String(request.getParameter("busID").getBytes("ISO8859_1"),"utf-8");rn //String ownTO = new String(request.getParameter("ownTO").getBytes("ISO8859_1"),"utf-8");rn rn //System.out.println(um1.getUsername()+um1.getPassword()rn // +"/n"+um1.getSex()+"/n"+um1.getTelephone()+"/n"+um1.getEmail());rn try rn [color=#FF0000]ps.setString(1, um.getUsername());[/color]rn ps.setString(2, um.getPassword());rn ps.setString(4, um.getSex());rn ps.setString(5, um.getTelephone());rn ps.setString(6, um.getEmail());rn ps.executeUpdate();rn System.out.println("register success.....");rn catch (SQLException e) rn e.printStackTrace();rn rn ConnectionDB.close(ps);rn ConnectionDB.close(conn);rn rnrnrn[/code]rnrnULoginAction.add(ULoginAction.java:85)rnrn[code=Java]rn public String add()rn //um = new UserModel();rn [color=#FF0000]uls.add(um);[/color]rn System.out.println(um.getUsername());rn return SUCCESS;rn rn rn[/code]rnrn
myEclipse 打不开struts-config.xml 报java.lang.NullPointerException 异常
myEclipse 打不开struts-config.xml 报java.lang.NullPointerException 异常rnrnrn提示错误信息:Could not open the editor: An unexpected exception was thrown.rnjava.lang.NullPointerExceptionrn at com.genuitec.eclipse.struts.editor.modeler.model.StrutsConfigDiagram.processAction(StrutsConfigDiagram.java:574)rn at com.genuitec.eclipse.struts.editor.modeler.model.StrutsConfigDiagram.synchronizeDiagram(StrutsConfigDiagram.java:479)rn at com.genuitec.eclipse.struts.editor.modeler.model.StrutsConfigDiagram.differedSynchronize(StrutsConfigDiagram.java:120)rn at com.genuitec.eclipse.struts.editor.multipage.StrutsConfigEditor.createPages(StrutsConfigEditor.java:296)rn at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:357)rn at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:662)rn at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)rn at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)rn at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)rn at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)rn at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)rn at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)rn at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)rn at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)rn at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)rn at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)rn at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)rn at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)rn at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)rn at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)。。。。。。。。。。。rnrnrn高手进来看看啊! rn
ibatis 调用存储过程报java.lang.NullPointerException错,请问
xml:rnrn rnrn rnrn rncall invoiceInsert (?,?,?)rnrn调用:rnpublic int invoiceInsert(InvoiceBook invoicebook) rnHashMap paramMap = new HashMap();rnparamMap.put("invoicestart", invoicebook.getInvoicestart());rnparamMap.put("totalnum", invoicebook.getInvoicedicid());rnparamMap.put("invoicebookid", invoicebook.getInvoicedicid());rnreturn invoiceDao.invoiceInsert(paramMap);rnrnrn报java.lang.NullPointerException错
java.lang.NullPointerException
Date up = null;rnup = cominf.getUpdatetime(); //异常:NullPointerExceptionrn if(null!=up)rn String update = "";rn String updatetime = "";rn update = String.valueOf(up);rn if(update.length()>11)rn updatetime = update.substring(0,update.lastIndexOf("."));rn rn request.setAttribute("updatetime",updatetime);rn rnrnrn/*rnjava.lang.NullPointerExceptionrnrn有比较好的 办法没?rn向各位大虾 求教了~~rn*/
java.lang.NullPointerException ????????
==============连接数据库的Bean======================rnpackage bbsclass;rnimport java.sql.*;rnrnpublic class bbsconnrn String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";rn String sConnStr = "jdbc:odbc:bbs";rn Connection conn = null;rn ResultSet rs = null;rnrnpublic bbsconn() rntry rn Class.forName(sDBDriver); rnrncatch(java.lang.ClassNotFoundException e) rn System.err.println("bbsreg(): " + e.getMessage());rnrnrnrnpublic ResultSet executeQuery(String sql) rnrs = null;rntry rn conn = DriverManager.getConnection(sConnStr); rn Statement stmt = conn.createStatement();rn rs = stmt.executeQuery(sql);rn rncatch(SQLException ex) rn System.err.println("aq.executeQuery: " + ex.getMessage());rn System.err.println("aq.executeQuerystrSQL: " + sql);rnrnreturn rs;rnrn.....rnrn=========只是知执行一个查询的过程==========================rnimport bbsclass.bbsconn;rnimport java.io.PrintStream;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnrnpublic class TestBbs implements java.io.Serializablernrn bbsconn bbsCon=null;rn ResultSet rs;rn rn public void TestBbs()rn rn bbsCon = new bbsconn();rn rs=null;rn rnrn public boolean search()rn rn ResultSet rs = null;rn tryrn rn rs = bbsCon.executeQuery("select * from user");rn if (rs.next())rn rn return true;rn rn elsern return false;rn rn catch (SQLException e)rn rn System.err.println(e.getMessage());rn System.out.println(e.getMessage());rn return false;rn rn rnrn public static void main(String[] args)rn rn TestBbs testBbs = new TestBbs();rn if (testBbs.search())rn rn System.out.print("有数据!");rn rn elsern rn System.out.print("没有数据!");rn rn rnrnrn执行TestBbs 的时候总是报:rnjava.lang.NullPointerExceptionrn at TestBbs.search(TestBbs.java:22)rn at TestBbs.main(TestBbs.java:40)rnException in thread "main" Normal Terminationrn我该怎么处理???? rnrnrnrnrnrnrnrn
java.lang.NullPointerException???
小弟我正在做个聊天程序,服务器已经连接上了,当运行登录界面后就出现如下错误,请各位大侠指点下,不胜感激……rnException in thread "AWT-EventQueue-0" java.lang.NullPointerExceptionrn at New.login_mouseClicked(New.java:125)rn at New$1.mouseClicked(New.java:60)rn at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)rn at java.awt.Component.processMouseEvent(Unknown Source)rn at javax.swing.JComponent.processMouseEvent(Unknown Source)rn at java.awt.Component.processEvent(Unknown Source)rn at java.awt.Container.processEvent(Unknown Source)rn at java.awt.Component.dispatchEventImpl(Unknown Source)rn at java.awt.Container.dispatchEventImpl(Unknown Source)rn at java.awt.Component.dispatchEvent(Unknown Source)rn at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)rn at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)rn at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)rn at java.awt.Container.dispatchEventImpl(Unknown Source)rn at java.awt.Window.dispatchEventImpl(Unknown Source)rn at java.awt.Component.dispatchEvent(Unknown Source)rn at java.awt.EventQueue.dispatchEvent(Unknown Source)rn at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)rn at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.run(Unknown Source)rnrn
java.lang.NullPointerException?
报错“java.lang.NullPointerException“是怎么回事啊?rn
struts2很经典的软件哦下载
还在每次要看 的时候百度么?这个解决你的问题,来下载 你懂吗! 相关下载链接:[url=//download.csdn.net/download/svsesb/4313826?utm_source=bbsseo]//download.csdn.net/download/svsesb/4313826?utm_source=bbsseo[/url]
Loadrunner 11 下载地址、安装、破解和汉化.pdf下载
Loadrunner 11 下载地址、安装、破解和汉化.pdf 相关下载链接:[url=//download.csdn.net/download/sdxrh2005/4815861?utm_source=bbsseo]//download.csdn.net/download/sdxrh2005/4815861?utm_source=bbsseo[/url]
广工 算法设计与分析试卷下载
广工算法与分析的试卷,内含答案!欢迎大家下载哦! 相关下载链接:[url=//download.csdn.net/download/dbc1999/4965057?utm_source=bbsseo]//download.csdn.net/download/dbc1999/4965057?utm_source=bbsseo[/url]
我们是很有底线的