日期:2014-05-18  浏览次数:20751 次

关于proxool使用问题
我是用javabean写了一连接的类  


代码
Connection   conn   =   null   ;      
      public   java.sql.Connection   getConn(){      
        try{      
                     
          Class.forName( "org.logicalcobwebs.proxool.ProxoolDriver ");      
          conn   =   DriverManager.getConnection( "proxool.xml-test ");//读取配置文件      
           
   
        }      
        catch(Exception   e){      
        e.printStackTrace();      
        }      
        return   this.conn   ;      
    }    


然后在JSP文件里面调用它


代码
<jsp:useBean   id= "wu "   scope= "page "   class= "wm.bean.dbcon "   />      
<%      
   
Connection   conn   =   wu.getConn();      
       
    Statement   stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);            
    String   sql= "select   *   from   liuyan_temp ";       //我的数据库表名      
    ResultSet   rs=stmt.executeQuery(sql);            
    rs.next();      
         
    out.print(rs.getString(1));      
         
    rs.close();            
    stmt.close();            
    conn.close();          


运行时TOMCAT和IE里同时抱错   at   wm.bean.dbcon.getConn(dbcon.java:19)  
org.apache.jasper.JasperException:   java.lang.NullPointerException  
这是哪个地方错了~~


------解决方案--------------------
wm.bean.dbcon.getConn(dbcon.java:19)
第19行代码错误,应该你的getconn方法返回的是null

所以会报空指针异常
------解决方案--------------------
ghgh
------解决方案--------------------
居然不用配置文件。