Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. package query;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.ResultSet;
  6. import java.sql.Statement;
  7. import java.util.ArrayList;
  8. import java.util.HashMap;
  9. import java.util.Iterator;
  10. import java.util.List;
  11. import java.util.Map;
  12.  
  13. import net.sf.json.JSONObject;
  14. import object.Dates;
  15.  
  16. public class ReadQuery {
  17. // static StudentPojo sPojo;
  18. /**
  19. * @param args
  20. */
  21. public static void main(String[] args) {
  22. Connection con = null;
  23. Statement st = null;
  24. ResultSet rs = null;
  25. String dbName = "eBooking";
  26. String uname = "user";
  27. String pwd = "user";
  28. String url = "jdbc:mysql://localhost:3306/" + dbName;
  29.  
  30.  
  31. try {
  32. Class.forName("com.mysql.jdbc.Driver").newInstance();
  33. con = DriverManager.getConnection(url, uname, pwd);
  34. System.out.println("Connection Established: " + con);
  35. String qry = "select bookedDate from appointment_booked";
  36.  
  37. st = con.createStatement();
  38. rs = st.executeQuery(qry);
  39.  
  40. JSONObject jObj = new JSONObject();
  41. ArrayList < Dates > list = new ArrayList < Dates > ();
  42. Map < String, String > map = new HashMap < String, String > ();
  43. Dates sPojo = null;
  44. while (rs.next()) {
  45. sPojo = new Dates();
  46.  
  47. sPojo.setDates(rs.getString("bookedDate"));
  48. list.add(sPojo);
  49.  
  50. }
  51. //System.out.println(list);
  52.  
  53. jObj.put("dates", list);
  54.  
  55. System.out.println(jObj.toString());
  56.  
  57. } catch (Exception e) {
  58. e.printStackTrace();
  59. }
  60. }
  61. }
  62.  
  63. Connection Established: com.mysql.jdbc.JDBC4Connection@ 47c62251
  64. net.sf.json.JSONException: java.lang.SecurityException: class "org.apache.commons.collections.FastHashMap"
  65. 's signer information does not match signer information of other classes in the same package
  66. at net.sf.json.JSONObject._fromBean(JSONObject.java:987)
  67. at net.sf.json.JSONObject.fromObject(JSONObject.java:168)
  68. at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:265)
  69. at net.sf.json.JSONArray._processValue(JSONArray.java:2514)
  70. at net.sf.json.JSONArray.processValue(JSONArray.java:2539)
  71. at net.sf.json.JSONArray.addValue(JSONArray.java:2526)
  72. at net.sf.json.JSONArray._fromCollection(JSONArray.java:1057)
  73. at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
  74. at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:237)
  75. at net.sf.json.JSONObject._processValue(JSONObject.java:2808)
  76. at net.sf.json.JSONObject.processValue(JSONObject.java:2874)
  77. at net.sf.json.JSONObject.element(JSONObject.java:1939)
  78. at net.sf.json.JSONObject.element(JSONObject.java:1917)
  79. at net.sf.json.JSONObject.put(JSONObject.java:2533)
  80. at query.ReadQuery.main(ReadQuery.java:53)
  81. Caused by: java.lang.SecurityException: class "org.apache.commons.collections.FastHashMap"'
  82. s signer information does not match signer information of other classes in the same package
  83. at java.lang.ClassLoader.checkCerts(ClassLoader.java: 895)
  84. at java.lang.ClassLoader.preDefineClass(ClassLoader.java: 665)
  85. at java.lang.ClassLoader.defineClass(ClassLoader.java: 758)
  86. at java.security.SecureClassLoader.defineClass(SecureClassLoader.java: 142)
  87. at java.net.URLClassLoader.defineClass(URLClassLoader.java: 467)
  88. at java.net.URLClassLoader.access$100(URLClassLoader.java: 73)
  89. at java.net.URLClassLoader$1.run(URLClassLoader.java: 368)
  90. at java.net.URLClassLoader$1.run(URLClassLoader.java: 362)
  91. at java.security.AccessController.doPrivileged(Native Method)
  92. at java.net.URLClassLoader.findClass(URLClassLoader.java: 361)
  93. at java.lang.ClassLoader.loadClass(ClassLoader.java: 424)
  94. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 331)
  95. at java.lang.ClassLoader.loadClass(ClassLoader.java: 357)
  96. at org.apache.commons.beanutils.ConvertUtilsBean. < init > (ConvertUtilsBean.java: 125)
  97. at org.apache.commons.beanutils.BeanUtilsBean. < init > (BeanUtilsBean.java: 110)
  98. at org.apache.commons.beanutils.BeanUtilsBean$1.initialValue(BeanUtilsBean.java: 68)
  99. at org.apache.commons.beanutils.ContextClassLoaderLocal.get(ContextClassLoaderLocal.java: 91)
  100. at org.apache.commons.beanutils.BeanUtilsBean.getInstance(BeanUtilsBean.java: 78)
  101. at org.apache.commons.beanutils.PropertyUtilsBean.getInstance(PropertyUtilsBean.java: 101)
  102. at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java: 342)
  103. at net.sf.json.JSONObject._fromBean(JSONObject.java: 880)
  104. ...14 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement