You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Thomas Franke <fr...@softenergy.de> on 2005/11/11 14:50:36 UTC

NoSuchElementException

Hello there,

if we call

log = (Logbuch) broker.getObjectByQuery(query);

we get a NoSuchElementException.
At the moment because of a fresh database we know there aren't any records.
We're using Informix Dynamik Server 9.4 and Informix JDBC.3.00.JC1 driver.

I could imagine it is rather a jdbc driver problem but I don't know.

Any suggestions are welcome as always. :)

Here is the full stack trace:
-------------------------------------------------------------------------------
2005-11-11 13:37:59 [FATAL]
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook - getFirstEntry(Integer
weaId):
java.util.NoSuchElementException: Could not obtain next object: inner hasNext
was false
	at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:299)
	at org.apache.ojb.broker.accesslayer.PagingIterator.next(PagingIterator.java:187)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1636)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
	at
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getFirstEntry(OjbLogBook.java:5017)
	at
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getStartTermCalculation(OjbLogBook.java:2268)
	at
de.mhr.wis.businessLayer.logic.management.LogBook.calculateTermForEachStatus(LogBook.java:194)
	at
de.mhr.wis.businessLayer.logic.management.LogBook.importStatusdaten(LogBook.java:983)
	at
de.softenergy.wis.businesslayer.facades.comserver.RawDataFacade.importStatusdaten(RawDataFacade.java:51)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.SAXEnronStatusV4ImportHandler.endDocument(SAXEnronStatusV4ImportHandler.java:188)
	at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importXml(EnronImporter.java:373)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importXml(EnronImporter.java:385)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.xml2Enron_status(EnronImporter.java:346)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importStatusData(EnronImporter.java:276)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importRawFile(EnronImporter.java:133)
	at
de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importRawFile(EnronImporter.java:518)
	at
de.mhr.wis.communicationlayer.communicationmanager.RawFileManager.run(RawFileManager.java:205)
-------------------------------------------------------------------------------

Regards,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: NoSuchElementException

Posted by Thomas Franke <fr...@softenergy.de>.
Thomas Franke wrote:

> org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during the
> execution of the query (for de.mhr.wis.DBAdapter.rawdata.analyses.Logbuch):
> Cannot write sorted rows.
We got it. It seems with the latest driver we solved the problem. The exception
above occurs if the database server needs more memory.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: NoSuchElementException

Posted by Thomas Franke <fr...@softenergy.de>.
Hi Armin,

> It could be a jdbc-driver problem
It seems that it is really a driver problem.
We changed the driver to the latest version and the exception changed too. ;)
The exception comes directly from the jdbc driver.
Here is the stack trace in full:


11.11.2005 18:06:41 [ERROR]
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook - getFirstEntry(Integer
weaId):
org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during the
execution of the query (for de.mhr.wis.DBAdapter.rawdata.analyses.Logbuch):
Cannot write sorted rows.
    at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:349)
    at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74)
    at org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:185)
    at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
    at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1918)
    at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1493)
    at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1620)
    at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
    at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
    at
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getFirstEntry(OjbLogBook.java:5017)
    at
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getStartTermCalculation(OjbLogBook.java:2268)
    at
de.mhr.wis.businessLayer.logic.management.LogBook.calculateTermForEachStatus(LogBook.java:194)
    at
de.mhr.wis.businessLayer.logic.management.LogBookQueue.run(LogBookQueue.java:115)
Caused by: java.sql.SQLException: Cannot write sorted rows.
    at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3208)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:1532)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1471)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1401)
    at com.informix.jdbc.IfxResultSet.a(IfxResultSet.java:204)
    at com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java:1192)
    at
com.informix.jdbc.IfxPreparedStatement.executeQuery(IfxPreparedStatement.java:369)
    at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:312)
    ... 12 more




Regards,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: NoSuchElementException

Posted by Thomas Franke <fr...@softenergy.de>.
Hi Armin,

> I setup a test against the latest version of OJB_1_0_RELEASE branch
> using maxDB and hsql with an empty table.
That's great, thanks.

> All tests pass without problems. So we have isolate your issue (not
> really ;-)): It could be a jdbc-driver problem or a bug in an older
> version of OJB.
That's what I think. We're using ojb 1.0.3 from the source code because of my
changing in the PlatformInformixImpl class. Right now we're testing our
application against mysql and informix but in another environment.

Regards,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: NoSuchElementException

Posted by Armin Waibel <ar...@apache.org>.
Hi Thomas,

I setup a test against the latest version of OJB_1_0_RELEASE branch 
using maxDB and hsql with an empty table.

public void testObjectByQuery_1() throws Exception
{
     String dummy = "nothing_to_find";
     Criteria criteria         = new Criteria();
     criteria.addEqualTo("name", dummy);
     QueryByCriteria query   = QueryFactory.newQuery(TestObject.class, 
criteria);
     Object result = broker.getObjectByQuery(query);
     assertNull("We don't expect a result object", result);
}

All tests pass without problems. So we have isolate your issue (not 
really ;-)): It could be a jdbc-driver problem or a bug in an older 
version of OJB. If you can run the same test against hsql or another DB 
we will find the answer (sorry, i don't have an old version of OJB at my 
fingertips).

regards,
Armin



Thomas Franke wrote:
> Hello there,
> 
> if we call
> 
> log = (Logbuch) broker.getObjectByQuery(query);
> 
> we get a NoSuchElementException.
> At the moment because of a fresh database we know there aren't any records.
> We're using Informix Dynamik Server 9.4 and Informix JDBC.3.00.JC1 driver.
> 
> I could imagine it is rather a jdbc driver problem but I don't know.
> 
> Any suggestions are welcome as always. :)
> 
> Here is the full stack trace:
> -------------------------------------------------------------------------------
> 2005-11-11 13:37:59 [FATAL]
> de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook - getFirstEntry(Integer
> weaId):
> java.util.NoSuchElementException: Could not obtain next object: inner hasNext
> was false
> 	at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:299)
> 	at org.apache.ojb.broker.accesslayer.PagingIterator.next(PagingIterator.java:187)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1636)
> 	at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
> 	at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
> 	at
> de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getFirstEntry(OjbLogBook.java:5017)
> 	at
> de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogBook.getStartTermCalculation(OjbLogBook.java:2268)
> 	at
> de.mhr.wis.businessLayer.logic.management.LogBook.calculateTermForEachStatus(LogBook.java:194)
> 	at
> de.mhr.wis.businessLayer.logic.management.LogBook.importStatusdaten(LogBook.java:983)
> 	at
> de.softenergy.wis.businesslayer.facades.comserver.RawDataFacade.importStatusdaten(RawDataFacade.java:51)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.SAXEnronStatusV4ImportHandler.endDocument(SAXEnronStatusV4ImportHandler.java:188)
> 	at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
> 	at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
> 	at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> 	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> 	at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> 	at
> org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
> Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> 	at javax.xml.parsers.SAXParser.parse(Unknown Source)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importXml(EnronImporter.java:373)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importXml(EnronImporter.java:385)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.xml2Enron_status(EnronImporter.java:346)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importStatusData(EnronImporter.java:276)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importRawFile(EnronImporter.java:133)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.importers.EnronImporter.importRawFile(EnronImporter.java:518)
> 	at
> de.mhr.wis.communicationlayer.communicationmanager.RawFileManager.run(RawFileManager.java:205)
> -------------------------------------------------------------------------------
> 
> Regards,
> 
> Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org