c3p0 - Code throwing java.net.SocketExpection -
i'm requesting data remote database, using c3p0 pool of connections approach. can nicely retrieve data need, reason, apparently seems related network socket, i'm getting java.net.socketexception
according stack trace:
com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:422) @ com.mysql.jdbc.util.handlenewinstance(util.java:408) @ com.mysql.jdbc.sqlerror.createcommunicationsexception(sqlerror.java:1137) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:3697) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:3586) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:4131) @ com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:2597) @ com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2758) @ com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2820) @ com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2769) @ com.mysql.jdbc.statementimpl.executequery(statementimpl.java:1569) @ com.mchange.v2.c3p0.impl.newproxystatement.executequery(newproxystatement.java:327) @ memsqlrequester.run(memsqlrequester.java:28) caused by: java.net.socketexception: connection timed out @ java.net.socketinputstream.socketread0(native method) @ java.net.socketinputstream.socketread(socketinputstream.java:116) @ java.net.socketinputstream.read(socketinputstream.java:170) @ java.net.socketinputstream.read(socketinputstream.java:141) @ com.mysql.jdbc.util.readaheadinputstream.fill(readaheadinputstream.java:112) @ com.mysql.jdbc.util.readaheadinputstream.readfromunderlyingstreamifnecessary(readaheadinputstream.java:159) @ com.mysql.jdbc.util.readaheadinputstream.read(readaheadinputstream.java:187) @ com.mysql.jdbc.mysqlio.readfully(mysqlio.java:3140) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:3597) ... 9 more exception in thread "main" java.lang.arrayindexoutofboundsexception: array index out of range: 0 @ java.util.vector.get(vector.java:748) @ graphtransformer$$anonfun$gettxinformationlist$1.apply$mcvi$sp(graphtransformer.scala:38) @ scala.collection.immutable.range.foreach$mvc$sp(range.scala:141) @ graphtransformer.gettxinformationlist(graphtransformer.scala:37) @ graphtransformer.getfeaturestx(graphtransformer.scala:62) @ graphtransformer.getfeatures(graphtransformer.scala:327) @ graphdatasetbuilder.lambda$publishgraphfeaturesfrommemsql$13(graphdatasetbuilder.java:62) @ java.util.vector.foreach(vector.java:1249) @ graphdatasetbuilder.publishgraphfeaturesfrommemsql(graphdatasetbuilder.java:59) @ graphdatasetbuilder.main(graphdatasetbuilder.java:124) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.apache.spark.deploy.sparksubmit$.org$apache$spark$deploy$sparksubmit$$runmain(sparksubmit.scala:674) @ org.apache.spark.deploy.sparksubmit$.dorunmain$1(sparksubmit.scala:180) @ org.apache.spark.deploy.sparksubmit$.submit(sparksubmit.scala:205) @ org.apache.spark.deploy.sparksubmit$.main(sparksubmit.scala:120) @ org.apache.spark.deploy.sparksubmit.main(sparksubmit.scala)
basically code snippet statement calls retrieve data remote dataset below:
try { ... statement stmt = connection.createstatement(); rs = stmt.executequery(this.querylist.get(queryindex)); // according stack trace, here i'm getting socketexception ... } catch (sqlexception ex) { ex.printstacktrace(); }
the problem can add catch
clause surrounding code because tells me no socketexception
being thrown. question what's going wrong here, considering apparently can't handle socketexception
in code stated in stack trace.
the stacktrace have posted not complete, cannot see exception has been thrown.
if cannot catch socketexception, presume exception receiving different one.
the socketexception caught driver , re-thrown different exception. socketexception can see in stack trace "caused by", original exception has been caught.
update
you cannot catch socketexception because not exception receive. please paste full stack trace.
it seems arrayindexoutofboundsexception new exception. can wrong, not think driver throw arrayindexoutofboundsexception. exception seems thrown spark.
i not absolutely sure, seems me that:
1) there network problem , cannot access database , open connection;
2) socketexception thrown in driver;
3) exception caught , re-thrown different exception (the stack trace incomplete , exception thrown not visible yet, guess communicationsexception);
4) consequence, spark's code trying read graph fails , throws arrayindexoutofboundsexception;
Comments
Post a Comment