1 public static CachedRowSetImpl getRowSet(String sql){ 2 Connection conn = null; 3 PreparedStatement prep = null; 4 ResultSet rs = null; 5 CachedRowSetImpl rowset = null; 6 try { 7 conn = getConnection(); 8 rowset = new CachedRowSetImpl(); 9 prep = conn.prepareStatement(sql); 10 rs = prep.executeQuery(); 11 rowset.populate(rs); 12 } catch (Exception e) { 13 e.printStackTrace(); 14 }finally{ 15 close(prep,conn); 16 } 17 return rowset; 18 }
09:24:49,642 ERROR [stderr] (http--0.0.0.0-8080-1) java.lang.NullPointerException
09:24:49,644 ERROR [stderr] (http--0.0.0.0-8080-1) at java.util.Properties$LineReader.readLine(Unknown Source)
09:24:49,645 ERROR [stderr] (http--0.0.0.0-8080-1) at java.util.Properties.load0(Unknown Source)
09:24:49,645 ERROR [stderr] (http--0.0.0.0-8080-1) at java.util.Properties.load(Unknown Source)
09:24:49,646 ERROR [stderr] (http--0.0.0.0-8080-1) at java.util.PropertyResourceBundle.<init>(Unknown Source)
09:24:49,647 ERROR [stderr] (http--0.0.0.0-8080-1) at com.sun.rowset.JdbcRowSetResourceBundle.<init>(Unknown Source)
09:24:49,648 ERROR [stderr] (http--0.0.0.0-8080-1) at com.sun.rowset.JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(Unknown Source)
09:24:49,649 ERROR [stderr] (http--0.0.0.0-8080-1) at com.sun.rowset.CachedRowSetImpl.<init>(Unknown Source)
09:24:49,650 ERROR [stderr] (http--0.0.0.0-8080-1) at com.util.DBUtil.getRowSet(DBUtil.java:103)<!--此处就是代码标记空指针处-->
09:24:49,650 ERROR [stderr] (http--0.0.0.0-8080-1) at com.e6gps.Servlet.doPost(Servlet.java:67)
把异常信息贴出来看看
在JdbcRowSetResourceBundle.java 构造函数中存在一行代码:
propResBundle = (PropertyResourceBundle) ResourceBundle.getBundle(PATH, locale, Thread.currentThread().getContextClassLoader());
如果在tomcat中是好的,感觉出错的可能是locale问题, 建议看看jboss默认locale是什么,然后JAR包com/sun/rowset/RowSetResourceBundle 这个路径下看看资源文件都支持哪几种区域