Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package query;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import net.sf.json.JSONObject;
- import object.Dates;
- public class ReadQuery {
- // static StudentPojo sPojo;
- /**
- * @param args
- */
- public static void main(String[] args) {
- Connection con = null;
- Statement st = null;
- ResultSet rs = null;
- String dbName = "eBooking";
- String uname = "user";
- String pwd = "user";
- String url = "jdbc:mysql://localhost:3306/" + dbName;
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- con = DriverManager.getConnection(url, uname, pwd);
- System.out.println("Connection Established: " + con);
- String qry = "select bookedDate from appointment_booked";
- st = con.createStatement();
- rs = st.executeQuery(qry);
- JSONObject jObj = new JSONObject();
- ArrayList < Dates > list = new ArrayList < Dates > ();
- Map < String, String > map = new HashMap < String, String > ();
- Dates sPojo = null;
- while (rs.next()) {
- sPojo = new Dates();
- sPojo.setDates(rs.getString("bookedDate"));
- list.add(sPojo);
- }
- //System.out.println(list);
- jObj.put("dates", list);
- System.out.println(jObj.toString());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- Connection Established: com.mysql.jdbc.JDBC4Connection@ 47c62251
- net.sf.json.JSONException: java.lang.SecurityException: class "org.apache.commons.collections.FastHashMap"
- 's signer information does not match signer information of other classes in the same package
- at net.sf.json.JSONObject._fromBean(JSONObject.java:987)
- at net.sf.json.JSONObject.fromObject(JSONObject.java:168)
- at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:265)
- at net.sf.json.JSONArray._processValue(JSONArray.java:2514)
- at net.sf.json.JSONArray.processValue(JSONArray.java:2539)
- at net.sf.json.JSONArray.addValue(JSONArray.java:2526)
- at net.sf.json.JSONArray._fromCollection(JSONArray.java:1057)
- at net.sf.json.JSONArray.fromObject(JSONArray.java:123)
- at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:237)
- at net.sf.json.JSONObject._processValue(JSONObject.java:2808)
- at net.sf.json.JSONObject.processValue(JSONObject.java:2874)
- at net.sf.json.JSONObject.element(JSONObject.java:1939)
- at net.sf.json.JSONObject.element(JSONObject.java:1917)
- at net.sf.json.JSONObject.put(JSONObject.java:2533)
- at query.ReadQuery.main(ReadQuery.java:53)
- Caused by: java.lang.SecurityException: class "org.apache.commons.collections.FastHashMap"'
- s signer information does not match signer information of other classes in the same package
- at java.lang.ClassLoader.checkCerts(ClassLoader.java: 895)
- at java.lang.ClassLoader.preDefineClass(ClassLoader.java: 665)
- at java.lang.ClassLoader.defineClass(ClassLoader.java: 758)
- at java.security.SecureClassLoader.defineClass(SecureClassLoader.java: 142)
- at java.net.URLClassLoader.defineClass(URLClassLoader.java: 467)
- at java.net.URLClassLoader.access$100(URLClassLoader.java: 73)
- at java.net.URLClassLoader$1.run(URLClassLoader.java: 368)
- at java.net.URLClassLoader$1.run(URLClassLoader.java: 362)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java: 361)
- at java.lang.ClassLoader.loadClass(ClassLoader.java: 424)
- at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: 331)
- at java.lang.ClassLoader.loadClass(ClassLoader.java: 357)
- at org.apache.commons.beanutils.ConvertUtilsBean. < init > (ConvertUtilsBean.java: 125)
- at org.apache.commons.beanutils.BeanUtilsBean. < init > (BeanUtilsBean.java: 110)
- at org.apache.commons.beanutils.BeanUtilsBean$1.initialValue(BeanUtilsBean.java: 68)
- at org.apache.commons.beanutils.ContextClassLoaderLocal.get(ContextClassLoaderLocal.java: 91)
- at org.apache.commons.beanutils.BeanUtilsBean.getInstance(BeanUtilsBean.java: 78)
- at org.apache.commons.beanutils.PropertyUtilsBean.getInstance(PropertyUtilsBean.java: 101)
- at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java: 342)
- at net.sf.json.JSONObject._fromBean(JSONObject.java: 880)
- ...14 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement