[英]Null pointer exception in oracle-jdbc database change notification
DCNDemoListener: got an event (com.datasync.DCNDemoListener@587bf0 running on thread Thread[Thread-2,5,main])
Exception in thread "Thread-2" java.lang.NullPointerException
at com.datasync.DCNDemoListener.onDatabaseChangeNotification(DBChangeNotification.java:142)
at oracle.jdbc.driver.NTFRegistration.notify(NTFRegistration.java:191)
at oracle.jdbc.driver.NTFConnection.unmarshalNSDataPacket(NTFConnection.java:578)
at oracle.jdbc.driver.NTFConnection.unmarshalOneNSPacket(NTFConnection.java:404)
at oracle.jdbc.driver.NTFConnection.run(NTFConnection.java:181)
Here is my code: 这是我的代码:
public void onDatabaseChangeNotification(DatabaseChangeEvent e)
{
Thread t = Thread.currentThread();
System.out.println("DCNDemoListener: got an event ("+this+" running on thread "+t+")");
System.out.println(e.getTableChangeDescription()[0].getRowChangeDescription()[0].getRowid().stringValue()); // line142
System.out.println(e.toString());
synchronized( demo )
{ demo.notify();}
}
Tring to figure out but I have no clue what went wrong :( 试图找出答案,但我不知道出了什么问题:(
Fixed it. 修复。 I was actually trying to figure out the code I have written and while doing so I have copied a bit of code from a website which was pulling a record which is null in DB hence the error. 我实际上是想弄清楚我编写的代码,这样做的时候,我从一个网站复制了一些代码,该网站提取的记录在DB中为空,因此出现错误。 Removing the code at line 142 fixed the isse 删除第142行的代码可修复isse
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.