I am trying to update a Vertex of type user with the following code. I am using OrientDB Enterprise 2.7
public static Vertex updateVertex(String id,
Map<String, Object> properties) {
OrientGraph graph = getGraphFactory().getTx();
// Add vertex types
int retry = 0;
Vertex vertex = null;
while (retry++ != MAX_RETRY) {
try {
vertex = graph.getVertex(id);
for (String property : properties.keySet()) {
vertex.setProperty(property, properties.get(property));
}
graph.commit();
return vertex;
} catch (ONeedRetryException ex) {
logger.warn("Retry for exception - " + id);
} catch (Exception e) {
logger.error("Can not create vertex - ", e);
e.printStackTrace();
graph.rollback();
break;
}
}
return vertex;
}
I get the following on commit step. I am not sure what is wrong with the code, I had this similar code working a while back.
com.orientechnologies.orient.core.exception.OTransactionException: Error on committing distributed transaction
DB name="SocialPosts3"
DB name="SocialPosts3"
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.throwSerializedException(OChannelBinaryAsynchClient.java:428)
at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:379)
at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:261)
at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:153)
at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:2133)
at com.orientechnologies.orient.client.remote.OStorageRemote$28.execute(OStorageRemote.java:1316)
at com.orientechnologies.orient.client.remote.OStorageRemote$28.execute(OStorageRemote.java:1289)
at com.orientechnologies.orient.client.remote.OStorageRemote$2.execute(OStorageRemote.java:198)
at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:230)
at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperation(OStorageRemote.java:195)
at com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:1289)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:560)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:106)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2733)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2703)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:175)
at com.readypulse.influencergraphmanager.graphutils.GraphUtil.updateVertex(GraphUtil.java:199)
at com.readypulse.influencergraphmanager.UserRandomDataPopulator.main(UserRandomDataPopulator.java:48)
Caused by: java.lang.NullPointerException
Server logs:
2016-08-24 05:08:25:772 WARNI Error deserializing record with id #30:968 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEUWOwAAAFRBAAAAVT0AAABnNwAAAGo/AAAAcDUAAAB1ABQxOTI5OTU4NDM3AQAAAAEAJQAAAAAAAiQ6QCIzMy4yMTUxTiA5Ny4xNDE3V56EBgpUZXhhcwhNQUxFDERlbnRvbg== [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:25:817 WARNI Error deserializing record with id #30:969 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEQWOwAAAF1BAAAAXj0AAABwNwAAAHM/AAAAeDUAAAB9ABI4NDE1NjQ5MjkBAAAAAgAlAAAAAAACJN8AJQAAAAAAAiT4ICIzOS4xMzk5TiA4NC41MDY0V4LkBwhPaGlvCE1BTEUUQ2luY2lubmF0aQ== [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:25:843 WARNI Error deserializing record with id #30:970 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEQWOwAAAFNBAAAAVD0AAABVNwAAAFg/AAAAYTUAAABmABIxOTQ3MjQ3NDMBAAAAAQAlAAAAAAACJaZKAJK7BRBWaXJnaW5pYQhNQUxFFENoZXNhcGVha2U= [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:26:120 WARNI Error deserializing record with id #30:971 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEQWOwAAAGdBAAAAaD0AAAB7NwAAAH4/AAAAiTUAAACOABIzMjc4Njk0OTEBAAAAAwAlAAAAAAACKPIAJAAAAAAAAieuACQAAAAAAAInrh4kMzguMjU2OE4gMTIyLjAzOTdXkpMJFENhbGlmb3JuaWEITUFMRRJGYWlyZmllbGQ= [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:26:161 WARNI Error deserializing record with id #30:972 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEQWOwAAAOlBAAAA6j0AAAD8NwAAAP8/AAABCDUAAAEPABI0NjA2MzUyNTkBAAAAEAAlAAAAAAACKRUAJAAAAAAAAifQACQAAAAAAAIoAgAlAAAAAAACKVYAJQAAAAAAAilWACUAAAAAAAIpVgAkAAAAAAACKAEAJQAAAAAAAilIACUAAAAAAAIpVgAlAAAAAAACKVYAJQAAAAAAAilGACUAAAAAAAIpVgAlAAAAAAACKVYAJQAAAAAAAilHACUAAAAAAAIpVgAlAAAAAAACKVYQIjM4LjA0MDJOIDg0LjQ1ODRXjPQGEEtlbnR1Y2t5DEZFTUFMRRJMZXhpbmd0b24= [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:26:196 WARNI Error deserializing record with id #30:973 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEQWOwAAAFNBAAAAVD0AAABnNwAAAGo/AAAAczUAAAB4ABIzNzI4Mzk4OTYBAAAAAQAlAAAAAAACKZIIJDM5LjkxODBOIDEwNC45NDU0V/rfCBBDb2xvcmFkbwhNQUxFEFRob3JudG9u [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
2016-08-24 05:08:26:245 WARNI Error deserializing record with id #30:974 send this data for debugging: AAhVc2VyMQAAADoUb3V0X1Bvc3RlZAAAAEUWOwAAAjRBAAACNT0AAAJHNwAAAko/AAACTzUAAAJUABQxODE1MDQ0NTM1AQAAADEAJAAAAAAAAijYACQAAAAAAAIoyAAlAAAAAAACKf8AJAAAAAAAAijJACUAAAAAAAIqAgAkAAAAAAACKM0AJQAAAAAAAioRACQAAAAAAAIozgAlAAAAAAACKhIAJAAAAAAAAijPACQAAAAAAAIo0AAlAAAAAAACKggAJQAAAAAAAioJACQAAAAAAAIo0QAkAAAAAAACKNIAJQAAAAAAAiobACQAAAAAAAIo1AAkAAAAAAACKNMAJQAAAAAAAioZACUAAAAAAAIqHAAkAAAAAAACKNUAJQAAAAAAAioYACUAAAAAAAIqNwAkAAAAAAACKO0AJQAAAAAAAio/ACUAAAAAAAIqHQAlAAAAAAACKiAAJAAAAAAAAijWACUAAAAAAAIqHgAkAAAAAAACKNcAJAAAAAAAAijaACUAAAAAAAIqIQAlAAAAAAACKiIAJAAAAAAAAijcACUAAAAAAAIqJAAkAAAAAAACKN0AJAAAAAAAAijeACQAAAAAAAIo4QAlAAAAAAACKigAJQAAAAAAAiopACUAAAAAAAIqLgAkAAAAAAACKOcAJQAAAAAAAipLACUAAAAAAAIqOAAlAAAAAAACKjEAJAAAAAAAAijwACUAAAAAAAIqNQAlAAAAAAACKksAJQAAAAAAAipLQCIzOS43Nzc0TiA4NC4xOTk2V5rrBghPaGlvCE1BTEUMRGF5dG9u [ORecordSerializerBinary][Batman] Error on distributed transaction commit
java.lang.NullPointerException
Related
I can consume produced protobuf message data from kafka topic using different tool like conduktor. However, when I try to poll data using JdbcSinkConnector, it throws the exception like
org.apache.kafka.common.errors.SerializationException: Error
deserializing Protobuf message
Please take a look at the following error detail when I call kafka-connect api as follows
URL : http://localhost:8083/connectors?expand=info&expand=status
JSON Response and trace
{
"sink_postgres_03_proto":{
"info":{
"name":"sink_postgres_03_proto",
"config":{
"connector.class":"io.confluent.connect.jdbc.JdbcSinkConnector",
"connection.password":"54321",
"topics":"order-messages",
"value.converter.schema.registry.url":"http://localhost:8081",
"key.converter.schemas.enable":"false",
"auto.evolve":"true",
"connection.user":"postgres",
"value.converter.schemas.enable":"true",
"name":"sink_postgres_03_proto",
"auto.create":"true",
"connection.url":"jdbc:postgresql://localhost:5432/CallHistoryService",
"value.converter":"io.confluent.connect.protobuf.ProtobufConverter",
"insert.mode":"insert",
"key.converter":"org.apache.kafka.connect.storage.StringConverter"
},
"tasks":[
{
"connector":"sink_postgres_03_proto",
"task":0
}
],
"type":"sink"
},
"status":{
"name":"sink_postgres_03_proto",
"connector":{
"state":"RUNNING",
"worker_id":"kafka-connect:8083"
},
"tasks":[
{
"id":0,
"state":"FAILED",
"worker_id":"kafka-connect:8083",
"trace":"org.apache.kafka.connect.errors.ConnectException: Tolerance exceeded in error handler\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:196)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:122)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.convertAndTransformRecord(WorkerSinkTask.java:495)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.convertMessages(WorkerSinkTask.java:472)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:226)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:198)\n\tat org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185)\n\tat org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:235)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\nCaused by: org.apache.kafka.connect.errors.DataException: Failed to deserialize data for topic order-messages to Protobuf: \n\tat io.confluent.connect.protobuf.ProtobufConverter.toConnectData(ProtobufConverter.java:123)\n\tat org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:495)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:146)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:180)\n\t... 13 more\nCaused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Protobuf message for id 1\nCaused by: java.net.ConnectException: Connection refused (Connection refused)\n\tat java.base/java.net.PlainSocketImpl.socketConnect(Native Method)\n\tat java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)\n\tat java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)\n\tat java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)\n\tat java.base/java.net.Socket.connect(Socket.java:609)\n\tat java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)\n\tat java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)\n\tat java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)\n\tat java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)\n\tat java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)\n\tat java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)\n\tat java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)\n\tat java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)\n\tat io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:272)\n\tat io.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:352)\n\tat io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:660)\n\tat io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:642)\n\tat io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:217)\n\tat io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaBySubjectAndId(CachedSchemaRegistryClient.java:291)\n\tat io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaById(CachedSchemaRegistryClient.java:276)\n\tat io.confluent.kafka.serializers.protobuf.AbstractKafkaProtobufDeserializer.deserialize(AbstractKafkaProtobufDeserializer.java:117)\n\tat io.confluent.kafka.serializers.protobuf.AbstractKafkaProtobufDeserializer.deserializeWithSchemaAndVersion(AbstractKafkaProtobufDeserializer.java:235)\n\tat io.confluent.connect.protobuf.ProtobufConverter$Deserializer.deserialize(ProtobufConverter.java:163)\n\tat io.confluent.connect.protobuf.ProtobufConverter.toConnectData(ProtobufConverter.java:107)\n\tat org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:495)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:146)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:180)\n\tat org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:122)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.convertAndTransformRecord(WorkerSinkTask.java:495)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.convertMessages(WorkerSinkTask.java:472)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:226)\n\tat org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:198)\n\tat org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185)\n\tat org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:235)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\n"
}
],
"type":"sink"
}
}
}
Please advice
Thanks you!
If you take the trace node and convert the \n and \t to newlines and tabs you get a readable stack trace with shows the problem:
Caused by: org.apache.kafka.connect.errors.DataException: Failed to deserialize data for topic order-messages to Protobuf:
at io.confluent.connect.protobuf.ProtobufConverter.toConnectData(ProtobufConverter.java:123)
at org.apache.kafka.connect.storage.Converter.toConnectData(Converter.java:87)
at org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:495)
at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:146)
at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:180)
... 13 more
Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Protobuf message for id 1
Caused by: java.net.ConnectException: Connection refused (Connection refused)
The error is java.net.ConnectException: Connection refused and means that either (a) you've misconfigured the location of your Schema Registry or (b) the Schema Registry is not running
I get this Exception while making repartition operation(decreasing partition size).
Caused by: java.lang.IllegalArgumentException: Size exceeds Integer.MAX_VALUE
While trying to catch this exception somehow below try-catch block doesn't work. It didn't catch the exception.
try{
someDF.repartition(10)
.persist(StorageLevel.MEMORY_AND_DISK)
.write.mode("overwrite").format(format).save(temp_location)
}
catch {
case ex: java.lang.IllegalArgumentException => {
// Do something else
}
But if I make exception type more generic it started to catch exception.
try{
someDF.repartition(10)
.persist(StorageLevel.MEMORY_AND_DISK)
.write.mode("overwrite").format(format).save(temp_location)
}
catch {
case ex: Exception => {
// Do something else
}
So what is the reason behind it?
Does spark somehow throw an other exception internally, different than written as error message?
Note "caused by" in the exception message; it means IllegalArgumentException is the cause of the exception and you should look at the stack trace before it for the exception class and message itself. It'll look like
Exception in thread "<thread-name>" <exception-class>: <message>
See also Setting Exception cause in java which gives this example stack trace:
Exception in thread "main" java.lang.RuntimeException: Some other message
at Exceptions.main(Exceptions.java:4)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.RuntimeException: Some message
at Exceptions.main(Exceptions.java:3)
... 5 more
There are four levels in my application: (1) My application, (2) pivot4j, (3) olap4j, and (4) Mondrian
If I run this code in Scala:
try {
renderer.render(model, new HtmlRenderCallback(sw))
}
catch {
case ex: Exception => println(ex.getMessage)
}
The application prints the error thrown by pivot4j:
org.olap4j.OlapException: mondrian gave exception while parsing query
If I don't catch the error, the stack trace is (in bold the relevant messages):
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution
exception[[PivotException: org.olap4j.OlapException: mondrian gave
exception while parsing query]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:293)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:220)
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:160)
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:188)
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:345)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) Caused
by: org.pivot4j.PivotException: org.olap4j.OlapException: mondrian
gave exception while parsing query
at org.pivot4j.impl.PivotModelImpl.getCellSet(PivotModelImpl.java:598)
at org.pivot4j.ui.table.TableRenderer.render(TableRenderer.java:425)
at olap.process.RunOlap.doRunMdx(RunOlap.scala:91)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:53)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:51)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:47)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:42)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) Caused
by: org.olap4j.OlapException: mondrian gave exception while parsing
query
at mondrian.olap4j.MondrianOlap4jConnection$Helper.createException(MondrianOlap4jConnection.java:858)
at mondrian.olap4j.MondrianOlap4jStatement.parseQuery(MondrianOlap4jStatement.java:375)
at mondrian.olap4j.MondrianOlap4jStatement.executeOlapQuery(MondrianOlap4jStatement.java:346)
at org.pivot4j.impl.PivotModelImpl.executeMdx(PivotModelImpl.java:646)
at org.pivot4j.impl.PivotModelImpl.getCellSet(PivotModelImpl.java:596)
at org.pivot4j.ui.table.TableRenderer.render(TableRenderer.java:425)
at olap.process.RunOlap.doRunMdx(RunOlap.scala:91)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:53)
at olap.process.RunOlap$$anonfun$runMdx$1.apply(RunOlap.scala:51)
at login.Authentication$LoggedAction$$anonfun$invokeBlock$1.apply(LoggedAction.scala:47)
Caused by: mondrian.olap.MondrianException: Mondrian Error: MDX object '[Measures].[Unit Cost]' not found in cube 'Sales'
Mondrian is the one that is originating the error, and I need to get the message that is throwing:
MDX object '[Measures].[Unit Cost]' not found in cube 'Sales'
I tried:
try {
renderer.render(model, new HtmlRenderCallback(sw))
}
catch {
case ex: MondrianException => println(ex.getMessage)
}
But is not catching the error.
Use Apache Commons ExceptionUtils to get the root exception.
I am developing Spring boot server with Spring kafka(1.3.2.RELEASE), apache avro(1.8.2) and io.confluent's Schema Registry(3.1.2). So evenytime the kafka listener gets a kafka message, it will find the schema id in message and get the avro schema from the registry server by id. The problem is, if the scheme registry config server is down, my listener will keep trying to send http request to the registry server to get the avro schema when it get a message(also prints large amount of error log), and it will block all the next kafka message since the offset won't move on.
16:56:41.541 ERROR KafkaMessageListenerContainer$ListenerConsumer - - org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1 - Container exception
org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition trade-0 at offset 810845
Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 21
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:153)
at io.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:187)
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:323)
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:316)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:63)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getBySubjectAndID(CachedSchemaRegistryClient.java:118)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:121)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:92)
at io.confluent.kafka.serializers.KafkaAvroDeserializer.deserialize(KafkaAvroDeserializer.java:54)
at org.apache.kafka.common.serialization.ExtendedDeserializer$Wrapper.deserialize(ExtendedDeserializer.java:65)
at org.apache.kafka.common.serialization.ExtendedDeserializer$Wrapper.deserialize(ExtendedDeserializer.java:55)
at org.apache.kafka.clients.consumer.internals.Fetcher.parseRecord(Fetcher.java:918)
at org.apache.kafka.clients.consumer.internals.Fetcher.access$2600(Fetcher.java:93)
at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.fetchRecords(Fetcher.java:1095)
at org.apache.kafka.clients.consumer.internals.Fetcher$PartitionRecords.access$1200(Fetcher.java:944)
at org.apache.kafka.clients.consumer.internals.Fetcher.fetchRecords(Fetcher.java:567)
at org.apache.kafka.clients.consumer.internals.Fetcher.fetchedRecords(Fetcher.java:528)
at org.apache.kafka.clients.consumer.KafkaConsumer.pollOnce(KafkaConsumer.java:1086)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1043)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:614)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
I have tried to use RetryTemplate to set the max attempts but it didn't work, It seems that the RetryTemplate may only works in my listener method. Also I didn't find any helpful config in the io confluent's website.
Now I replace the KafkaAvroDeserializer by using a CustomAvroDeserializer, which extends the KafkaAvroDeserializer and override its deserialize method with adding a try-catch to its content, like this:
#Log4j
public class CustomAvroDeserializer extends KafkaAvroDeserializer {
#Override
public Object deserialize(String s, byte[] bytes) {
try {
return this.deserialize(bytes);
} catch (Exception e) {
log.error("encounter a problem when deserializer message with schema registry:{}", e);
return null;
}
}
}
I work with Wildfly and OpenJPA. I have a situation of Optimistic Lock Exception.
The error message that I get is:
00:08:29,373 WARN [com.arjuna.ats.arjuna] (default task-39)
ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for
SynchronizationImple< 0:ffffc0a82f91:-3d767137:5a736fa1:d7c,
org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList#244256b9
: org.apache.openjpa.persistence.OptimisticLockException: Optimistic
locking errors were detected when flushing to the data store. The
following objects may have been concurrently modified in another
transaction: [com.earnix.eo.entities.optimizer.PricingMixEntity-30400]
....
00:08:29,381 ERROR [org.jboss.as.ejb3.invocation] (default task-39)
WFLYEJB0034: EJB Invocation failed on component PricingRuleAccessor
for method public abstract java.util.List
com.earnix.eo.sessions.navigator.PricingRuleAccessor.releasePricingMix(int,int)
throws
com.earnix.utils.EOException,com.earnix.eo.sessions.utils.EODeadlockException,java.rmi.RemoteException:
javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:137)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:117)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:279)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:79)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.deployment.processors.EjbSuspendInterceptor.processInvocation(EjbSuspendInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$1.processInvocation(EjbExceptionTransformingInterceptorFactories.java:75)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:328)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$100(MethodInvocationMessageHandler.java:67)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:201)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:263)
at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.processMessage(VersionOneProtocolChannelReceiver.java:213)
at org.jboss.as.ejb3.remote.protocol.versiontwo.VersionTwoProtocolChannelReceiver.processMessage(VersionTwoProtocolChannelReceiver.java:76)
at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.handleMessage(VersionOneProtocolChannelReceiver.java:159)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:456)
at org.jboss.remoting3.EndpointImpl$TrackingExecutor$1.run(EndpointImpl.java:731)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1212)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:89)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91)
... 47 more
Caused by: org.apache.openjpa.persistence.OptimisticLockException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [com.earnix.eo.entities.optimizer.PricingMixEntity-30400]
at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2357)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2205)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2103)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2021)
at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.beforeCompletion(JCAOrderedLastSynchronizationList.java:116)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:368)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1200)
... 50 more
Caused by: org.apache.openjpa.persistence.OptimisticLockException: An optimistic lock violation was detected when flushing object instance "com.earnix.eo.entities.optimizer.PricingMixEntity-30400" to the data store. This indicates that the object was concurrently modified in another transaction.
FailedObject: com.earnix.eo.entities.optimizer.PricingMixEntity-30400
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:124)
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.batchOrExecuteRow(BatchingPreparedStatementManagerImpl.java:100)
at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:83)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:100)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:88)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:107)
at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:59)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:104)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:77)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:731)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
My problem is that EJBTransactionRolledbackException is thrown and not OptimisticLockException. Therefore, my code doesn't consider the exception as OptimisticLockException. Do you know how I can make Wildfly/JPA throw an EJBTransactionRolledbackException ?
I also looked at the 'cause' field of TransactionRolledbackException and I see there null.
Some code:
#Override
public List<PricingMixHeader> releasePricingRule(PricingMixHeader header) throws EOException {
for (int i = 0; ; i++) {
try {
return pricingRuleAccessor.releasePricingMix(header.getPk(), getSessionPk());
} catch (RemoteException e) {
DeadlockUtils.handleRemoteException(e, i);
} catch (EODeadlockException e) {
// recover from the deadlock
DeadlockUtils.recover(i, e.getOriginalExceptionStack());
}
}
}
This is the code in the client side. pricingRuleAccessor.releasePricingMix(...) is a remote-mothod invocation call to a method in server side. In the server side Optimistic Lock Exception occured and then RemoteException was caught (TransactionRolledbackException inherits from RemoteException).
I would suggest 2 things:
1) You could call a em.flush() before the point that the 'OptimisticLockException' exception occurs, to get this exception and then throw it as you want.
2) Other possibility is to ignore the details that are ocurring an OptimisticLockException, and create a new 'MyRemoteException' ( an ApplicationException that extends EJBException). It'd be like that:
#ApplicationException(rollback = true)
public class MyRemoteException extends EJBException {
...
}
Throw this exception to be caught by your 'view layer' and then it will decide what information to show.
JBoss always wraps the thrown exception, in your case OptimisticLockException, in a EJBTransactionRollbackException when the thrown exception is a RuntimeException that causes a rollback.
In your client code you must check for EJBTransactionRollbackException and then check if the cause is a OptimisticLockException:
try {
...
} catch (EJBTransactionRollbackException e) {
if (e.getCause() instanceof OptimisticLockException) {
...
}
}