You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Puneet Kinra <pu...@customercentria.com> on 2018/01/22 10:38:26 UTC

java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp

Hi

I am getting the above error when deployed to the cluster ,trying to set
the System Property but not getting reflected inside the jobs.

I need to schedule the job as well on periodic basis , i was thinking of
calling the
jar from the CLI & put into script & schedule using cron job in linux

but stuck with the below issue.


java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to
java.sql.Timestamp
        at
org.apache.flink.api.common.typeutils.base.SqlTimestampSerializer.serialize(SqlTimestampSerializer.java:27)
        at
org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:160)
        at
org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:46)
        at
org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54)
        at
org.apache.flink.runtime.io.network.api.serialization.SpanningRecordSerializer.addRecord(SpanningRecordSerializer.java:93)
        at
org.apache.flink.runtime.io.network.api.writer.RecordWriter.sendToTarget(RecordWriter.java:114)
        at
org.apache.flink.runtime.io.network.api.writer.RecordWriter.emit(RecordWriter.java:89)
        at
org.apache.flink.runtime.operators.shipping.OutputCollector.collect(OutputCollector.java:65)
        at
org.apache.flink.runtime.operators.util.metrics.CountingCollector.collect(CountingCollector.java:35)
        at
org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:168)
        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
        at java.lang.Thread.run(Unknown Source)

-- 
*Cheers *

*Puneet Kinra*

*Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com
<pu...@customercentria.com>*

*e-mail :puneet.kinra@customercentria.com
<pu...@customercentria.com>*

Re: java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp

Posted by Timo Walther <tw...@apache.org>.
You have to make sure that the property is set on every TaskManager that 
executes your job.

I don't know if there is some easier way to set the system properties on 
the entire cluster.


Am 1/22/18 um 12:25 PM schrieb Puneet Kinra:
> Interesting System property working while submitting from the portal 
> not working when
> submitting job from the CLI.
>
> On Mon, Jan 22, 2018 at 4:42 PM, Puneet Kinra 
> <puneet.kinra@customercentria.com 
> <ma...@customercentria.com>> wrote:
>
>     I tried but System property are not visible to the jobs,
>
>     On Mon, Jan 22, 2018 at 4:20 PM, Timo Walther <twalthr@apache.org
>     <ma...@apache.org>> wrote:
>
>         According to Stackoverflow
>         (https://stackoverflow.com/questions/13269564/java-lang-classcastexception-oracle-sql-timestamp-cannot-be-cast-to-java-sql-ti
>         <https://stackoverflow.com/questions/13269564/java-lang-classcastexception-oracle-sql-timestamp-cannot-be-cast-to-java-sql-ti>)
>         setting the system property accordingly should work.
>
>         Maybe you can share how you do it?
>
>         Regards,
>         Timo
>
>
>         Am 1/22/18 um 11:45 AM schrieb Puneet Kinra:
>>         I am getting this issue while reading from the database using
>>         jdbc connector , can you guide me how to read
>>         from there as  a string or may mapped to another type while
>>         reading from the database
>>
>>         On Mon, Jan 22, 2018 at 4:12 PM, Timo Walther
>>         <twalthr@apache.org <ma...@apache.org>> wrote:
>>
>>             Hi Puneet,
>>
>>             Flink SQL does only supports java.sql.Timestamp. You need
>>             to convert it in a user-defined function or map function
>>             accordingly.
>>
>>             Regards,
>>             Timo
>>
>>
>>
>>             Am 1/22/18 um 11:38 AM schrieb Puneet Kinra:
>>>             Hi
>>>             I am getting the above error when deployed to the
>>>             cluster ,trying to set the System Property but not
>>>             getting reflected inside the jobs.
>>>
>>>             I need to schedule the job as well on periodic basis , i
>>>             was thinking of calling the
>>>             jar from the CLI & put into script & schedule using cron
>>>             job in linux
>>>
>>>             but stuck with the below issue.
>>>
>>>
>>>             java.lang.ClassCastException: oracle.sql.TIMESTAMP
>>>             cannot be cast to java.sql.Timestamp
>>>                     at
>>>             org.apache.flink.api.common.typeutils.base.SqlTimestampSerializer.serialize(SqlTimestampSerializer.java:27)
>>>                     at
>>>             org.apache.flink.api.java.typeutils.runtime.RowSerializer.se
>>>             <http://utils.runtime.RowSerializer.se>rialize(RowSerializer.java:160)
>>>                     at
>>>             org.apache.flink.api.java.typeutils.runtime.RowSerializer.se
>>>             <http://utils.runtime.RowSerializer.se>rialize(RowSerializer.java:46)
>>>                     at
>>>             org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54)
>>>                     at org.apache.flink.runtime.io
>>>             <http://org.apache.flink.runtime.io>.network.api.serialization.SpanningRecordSerializer.addRecord(SpanningRecordSerializer.java:93)
>>>                     at org.apache.flink.runtime.io
>>>             <http://org.apache.flink.runtime.io>.network.api.writer.RecordWriter.sendToTarget(RecordWriter.java:114)
>>>                     at org.apache.flink.runtime.io
>>>             <http://org.apache.flink.runtime.io>.network.api.writer.RecordWriter.emit(RecordWriter.java:89)
>>>                     at
>>>             org.apache.flink.runtime.operators.shipping.OutputCollector.collect(OutputCollector.java:65)
>>>                     at
>>>             org.apache.flink.runtime.operators.util.metrics.CountingCollector.collect(CountingCollector.java:35)
>>>                     at
>>>             org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:168)
>>>                     at
>>>             org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
>>>                     at java.lang.Thread.run(Unknown Source)
>>>
>>>             -- 
>>>             *Cheers *
>>>             *
>>>             *
>>>             *Puneet Kinra*
>>>             *
>>>             *
>>>
>>>             *Mobile:+918800167808 | Skype :
>>>             puneet.kinra@customercentria.com
>>>             <ma...@customercentria.com>*
>>>
>>>             *e-mail :puneet.kinra@customercentria.com
>>>             <ma...@customercentria.com>*
>>>
>>>
>>
>>
>>
>>
>>         -- 
>>         *Cheers *
>>         *
>>         *
>>         *Puneet Kinra*
>>         *
>>         *
>>
>>         *Mobile:+918800167808 | Skype :
>>         puneet.kinra@customercentria.com
>>         <ma...@customercentria.com>*
>>
>>         *e-mail :puneet.kinra@customercentria.com
>>         <ma...@customercentria.com>*
>>
>>
>
>
>
>
>     -- 
>     *Cheers *
>     *
>     *
>     *Puneet Kinra*
>     *
>     *
>
>     *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com
>     <ma...@customercentria.com>*
>
>     *e-mail :puneet.kinra@customercentria.com
>     <ma...@customercentria.com>*
>
>
>
>
>
> -- 
> *Cheers *
> *
> *
> *Puneet Kinra*
> *
> *
>
> *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
> *e-mail :puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
>


Re: java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp

Posted by Timo Walther <tw...@apache.org>.
According to Stackoverflow 
(https://stackoverflow.com/questions/13269564/java-lang-classcastexception-oracle-sql-timestamp-cannot-be-cast-to-java-sql-ti) 
setting the system property accordingly should work.

Maybe you can share how you do it?

Regards,
Timo


Am 1/22/18 um 11:45 AM schrieb Puneet Kinra:
> I am getting this issue while reading from the database using jdbc 
> connector , can you guide me how to read
> from there as  a string or may mapped to another type while reading 
> from the database
>
> On Mon, Jan 22, 2018 at 4:12 PM, Timo Walther <twalthr@apache.org 
> <ma...@apache.org>> wrote:
>
>     Hi Puneet,
>
>     Flink SQL does only supports java.sql.Timestamp. You need to
>     convert it in a user-defined function or map function accordingly.
>
>     Regards,
>     Timo
>
>
>
>     Am 1/22/18 um 11:38 AM schrieb Puneet Kinra:
>>     Hi
>>     I am getting the above error when deployed to the cluster ,trying
>>     to set the System Property but not getting reflected inside the jobs.
>>
>>     I need to schedule the job as well on periodic basis , i was
>>     thinking of calling the
>>     jar from the CLI & put into script & schedule using cron job in
>>     linux
>>
>>     but stuck with the below issue.
>>
>>
>>     java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast
>>     to java.sql.Timestamp
>>             at
>>     org.apache.flink.api.common.typeutils.base.SqlTimestampSerializer.serialize(SqlTimestampSerializer.java:27)
>>             at
>>     org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:160)
>>             at
>>     org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:46)
>>             at
>>     org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54)
>>             at org.apache.flink.runtime.io
>>     <http://org.apache.flink.runtime.io>.network.api.serialization.SpanningRecordSerializer.addRecord(SpanningRecordSerializer.java:93)
>>             at org.apache.flink.runtime.io
>>     <http://org.apache.flink.runtime.io>.network.api.writer.RecordWriter.sendToTarget(RecordWriter.java:114)
>>             at org.apache.flink.runtime.io
>>     <http://org.apache.flink.runtime.io>.network.api.writer.RecordWriter.emit(RecordWriter.java:89)
>>             at
>>     org.apache.flink.runtime.operators.shipping.OutputCollector.collect(OutputCollector.java:65)
>>             at
>>     org.apache.flink.runtime.operators.util.metrics.CountingCollector.collect(CountingCollector.java:35)
>>             at
>>     org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:168)
>>             at
>>     org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
>>             at java.lang.Thread.run(Unknown Source)
>>
>>     -- 
>>     *Cheers *
>>     *
>>     *
>>     *Puneet Kinra*
>>     *
>>     *
>>
>>     *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com
>>     <ma...@customercentria.com>*
>>
>>     *e-mail :puneet.kinra@customercentria.com
>>     <ma...@customercentria.com>*
>>
>>
>
>
>
>
> -- 
> *Cheers *
> *
> *
> *Puneet Kinra*
> *
> *
>
> *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
> *e-mail :puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
>


Re: java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp

Posted by Timo Walther <tw...@apache.org>.
Hi Puneet,

Flink SQL does only supports java.sql.Timestamp. You need to convert it 
in a user-defined function or map function accordingly.

Regards,
Timo



Am 1/22/18 um 11:38 AM schrieb Puneet Kinra:
> Hi
> I am getting the above error when deployed to the cluster ,trying to 
> set the System Property but not getting reflected inside the jobs.
>
> I need to schedule the job as well on periodic basis , i was thinking 
> of calling the
> jar from the CLI & put into script & schedule using cron job in linux
>
> but stuck with the below issue.
>
>
> java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to 
> java.sql.Timestamp
>         at 
> org.apache.flink.api.common.typeutils.base.SqlTimestampSerializer.serialize(SqlTimestampSerializer.java:27)
>         at 
> org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:160)
>         at 
> org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:46)
>         at 
> org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54)
>         at 
> org.apache.flink.runtime.io.network.api.serialization.SpanningRecordSerializer.addRecord(SpanningRecordSerializer.java:93)
>         at 
> org.apache.flink.runtime.io.network.api.writer.RecordWriter.sendToTarget(RecordWriter.java:114)
>         at 
> org.apache.flink.runtime.io.network.api.writer.RecordWriter.emit(RecordWriter.java:89)
>         at 
> org.apache.flink.runtime.operators.shipping.OutputCollector.collect(OutputCollector.java:65)
>         at 
> org.apache.flink.runtime.operators.util.metrics.CountingCollector.collect(CountingCollector.java:35)
>         at 
> org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:168)
>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
>         at java.lang.Thread.run(Unknown Source)
>
> -- 
> *Cheers *
> *
> *
> *Puneet Kinra*
> *
> *
>
> *Mobile:+918800167808 | Skype : puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
> *e-mail :puneet.kinra@customercentria.com 
> <ma...@customercentria.com>*
>
>