1.java.util.Date转java.sql.Date时分秒丢失!!
解决:
使用Timestamp代替java.sql.Date:
long curMillis = System.currentTimeMillis(); Timestamp currentDate = new Timestamp(curMillis); Date time = DateUtils.parseDate(errorCodeCountBean.getTime(), NginxConfig.TIME_PATTERN); String sql = "insert into ERROR_CODE_COUNT (ID, ERRCODECOUNT,TIME,CREATE_DATE,UPDATE_DATE) VALUES (?,?,?,?,?)"; pstmt = conn.prepareStatement(sql); pstmt.setLong(1, curMillis); pstmt.setInt(2, errorCodeCountBean.getErrcodecount()); pstmt.setTimestamp(3, new Timestamp(time.getTime())); pstmt.setTimestamp(4, currentDate); pstmt.setTimestamp(5, currentDate);
2.Strom一个Bolt对象只能用一次:
下面的printBolt对象使用了两次:
PrinterBolt printBolt=new PrinterBolt(); builder.setBolt("print", printBolt,1).shuffleGrouping("ErrorCodeStatisticsBolt"); builder.setBolt("print", printBolt,1).shuffleGrouping("UVRealTimeBolt");
Exception in thread "main" java.lang.IllegalArgumentException: Bolt has already been declared for id print
at backtype.storm.topology.TopologyBuilder.validateUnusedId(TopologyBuilder.java:212)
at backtype.storm.topology.TopologyBuilder.setBolt(TopologyBuilder.java:139)
at backtype.storm.topology.TopologyBuilder.setBolt(TopologyBuilder.java:171)
at com.handpay.hawkeye.core.storm.topology.LogTopology.main(LogTopology.java:62)
时间: 2024-11-07 11:47:52