jdk7 と tomcat7 で mysql-connector-java-5.1.20-bin.jar を使用していますが、私のコードは callableStatement.closeOnCompletion() の実行中に abstractMethodError を与えています。コードを以下に示します。
試す {
Session session = HibernateUtil.currentSession();
CallableStatement st = session.connection().prepareCall(
"{call getOfflineNodes('" + strDevice + "',"
+ System.currentTimeMillis() + "," + polltime + ","+ status + ")}");
ResultSet rs = st.executeQuery();
Transaction tx = session.beginTransaction();
st.closeOnCompletion();
tx.commit();
HibernateUtil.closeSession();
return rs;
}
完全な例外は次のとおりです。
java.lang.AbstractMethodError: com.mysql.jdbc.JDBC4CallableStatement.closeOnCompletion()V
at com.clearcube.util.DMLLayer.getOfflineNodes(DMLLayer.java:90)
at com.clearcube.logging.ShutBladeAlertService.<init>(ShutBladeAlertService.java:80)
at com.clearcube.common.CMSServiceLoaderServlet.init(CMSServiceLoaderServlet.java:95)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
この例外が発生する理由と、これを処理する方法を誰か教えてください。
この返された結果セットを使用しているコードは次のとおりです。
timer.scheduleAtFixedRate(new TimerTask() {
public void run()
{
String bladeMacs = "";
String vmMacs = "";
try
{
int poll = Integer.parseInt(
ServerConfigurationService.getProperty("blade.refresh.time"));
Calendar callendar = Calendar.getInstance();
String strblade = "";
String strvm = "";
String Ip = "";
ResultSet BladeRs = (ResultSet)DMLLayer.getOfflineNodes(
"Blade", poll, 1);
if (BladeRs != null) {
boolean isBladeAlive = false;
int x = 0;
try {
while (BladeRs.next()) {
String mac = BladeRs.getString("macAddress");
String ip = BladeRs.getString("Ip");
isBladeAlive =
EchoUDPClientDiscoveryObjectResponse.echo(InetAddress.getByName(BladeRs
.getString("Ip")), 6502, "any",
3, 500);
if (!isBladeAlive) {
if (x > 0)
{
strblade = strblade + "\n";
bladeMacs = bladeMacs + "\n";
}
strblade = strblade + ip;
x = 2;
bladeMacs = bladeMacs + mac;
}
else
{
String query = "update DiscoveredNode set DateModified=:DateModified where MacAddress=:MacAddress";
ShutBladeAlertService.objTypeVector.removeAllElements();
ShutBladeAlertService.objFieldVector.removeAllElements();
ShutBladeAlertService.objValueVector.removeAllElements();
ShutBladeAlertService.objTypeVector.add("Long");
ShutBladeAlertService.objFieldVector.add("DateModified");
ShutBladeAlertService.objValueVector.add(
Long.valueOf(System.currentTimeMillis()));
ShutBladeAlertService.objTypeVector.add("String");
ShutBladeAlertService.objFieldVector.add("MacAddress");
ShutBladeAlertService.objValueVector.add(mac);
DMLLayer.runUpdateQuery(query,
ShutBladeAlertService.objFieldVector, ShutBladeAlertService.objValueVector,
ShutBladeAlertService.objTypeVector);
}
}
BladeRs.close();
}
catch (Exception ex1) {
ex1.printStackTrace();
}
}
}
}
前もって感謝します。