NullPointerException in SelectTranslator

From: Michael Schuldt (m..scensys.de)
Date: Mon Oct 06 2003 - 10:20:09 EDT

  • Next message: Mike Kienenberger: "prefetching & restrictingQualifier implemented with DataContextDelegate.willPerformSelect()"

    Hi,

    I discussed this error with Andrus over the last weekend. It was based on an
    application still running under Cayenne alpha 6. We came to the solution,
    that upgrading to release version will fix this problem but no way. Error is
    also in release version.

    I had the following code running in a thread for cleaning the database every
    minute. Cause I thought of an error caused by the thread I put it in the
    first servlet (I’m using tomcat 4.0.4 and mysql 4.0.4) and changed a bit of
    the code. I didn’t use the wait-function and made it break after at least 1
    hour. I also changed the frequency to 500ms so I don’t have to wait 3 hours
    for the error to occur.

    So the error even occurs in release version, can you tell me if I’m doing
    something wrong in my coding? Is there something wrong with the DataContext?
    Am I reading to frequently (In my real application I’m performing this query
    in the thread every minute)?

    What with my main thread? Will this one also crashs after some thousand
    queries?

    I hope there’s an answer!

    So here’s the code: (Because this code has to recognize changings to the
    database done in other threads, I changed the position of “DataContext ctxt
    = DataContext.createDataContext ();” to within the while-loop. But this will
    cause the same problem)

            logger.info("In IndexAction...");

            DataContext ctxt = DataContext.createDataContext ();

            int i = 0;
            boolean ok = true;
            while (ok)
            {
                    long lStart = System.currentTimeMillis();
                    long lWeiter = System.currentTimeMillis() + 1;

                    while (lWeiter < lStart + 500)
                    {
                        // Wir warten jeweils 5 Sekunden!
                        lWeiter = System.currentTimeMillis() + 1;
                    }

                    i++;

                    System.out.println("------------Anfang Run
    DBCleanerThread------------------");

                    Expression qual = ExpressionFactory.binaryPathExp
    (Expression.EQUAL_TO,
                                                                       "status",
                                                                       "on");

                    Long lAktTime = new Long (System.currentTimeMillis() + 1);
                    qual = qual.andExp (ExpressionFactory.binaryPathExp
    (Expression.LESS_THAN,

    "angebotsEnde",

    lAktTime));

                    SelectQuery query = new SelectQuery(TbAngebot.class, qual);

                    query.setLoggingLevel(Level.WARN);

                    List angebote = ctxt.performQuery(query);
                    System.out.println("------------Ende Run
    DBCleanerThread------------------" + i + "-------");

                    if (i > 7200)
                    {
                        ok = false;
                    }
            }

    And here’s the error after exactly 2422 performQuery-calls:

    06.10.03 16:00:26 - QueryLogger - WARN: *** error.
    java.lang.NullPointerException
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.appendAttributes(Selec
    tTranslator.java:305)
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.buildColumnList(Select
    Translator.java:245)
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(Select
    Translator.java:117)
                at
    org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement(QueryAss
    embler.java:134)
                at
    org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:377)
                at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:281)
                at
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:466
    )
                at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:8
    33)
                at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:885
    )
                at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:763
    )
                at de.best4rest.boerse.IndexAction.perform(IndexAction.java:79)
                at
    org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
    va:1787)
                at
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
                at
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.SendMailFilter.doFilter(SendMailFilter.java:80)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.WerbungFilter.doFilter(WerbungFilter.java:199)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at de.best4rest.boerse.UtilFilter.doFilter(UtilFilter.java:422)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.LogRequestParameterFilter.doFilter(LogRequestParameterFi
    lter.java:72)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:243)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:190)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    .java:475)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
                at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    )
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:170)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
    )
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
    1027)
                at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
    )
                at java.lang.Thread.run(Thread.java:536)
    06.10.03 16:00:26 - QueryLogger - WARN: *** error.
    java.lang.NullPointerException
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.appendAttributes(Selec
    tTranslator.java:305)
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.buildColumnList(Select
    Translator.java:245)
                at
    org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(Select
    Translator.java:117)
                at
    org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement(QueryAss
    embler.java:134)
                at
    org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:377)
                at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:281)
                at
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:466
    )
                at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:8
    33)
                at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:885
    )
                at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:763
    )
                at de.best4rest.boerse.IndexAction.perform(IndexAction.java:79)
                at
    org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
    va:1787)
                at
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
                at
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.SendMailFilter.doFilter(SendMailFilter.java:80)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.WerbungFilter.doFilter(WerbungFilter.java:199)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at de.best4rest.boerse.UtilFilter.doFilter(UtilFilter.java:422)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    de.best4rest.boerse.LogRequestParameterFilter.doFilter(LogRequestParameterFi
    lter.java:72)
                at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
                at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
                at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:243)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:190)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    .java:475)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
                at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    )
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:170)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
    )
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    64)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
                at
    org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
    66)
                at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at
    org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
    1027)
                at
    org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
    )
                at java.lang.Thread.run(Thread.java:536)

    Michael

    ascensys
    Software & Consulting
    Schuldt und Spajic GbR

    Individualsoftware · Sicherheitskonzepte · Internetlösungen · Schulungen
    individual software · security concepts · internet solutions · trainings

    Leidhecke 24
    D-51570 Windeck
    Germany

    fon: +49 (0) 2292 6801-47
    fax: +49 (0) 2292 6801-48

    internet: http://www.ascensys.de <http://www.ascensys.de/>
    e-mail: inf..scensys.de <mailto:info@ascensys.de>

    Confidentiality Notice: This e-mail is privileged and confidential and for
    the use of the addressee only. Should you have received this e-mail in error
    please notify us by replying directly to the sender or by sending a message
    to the sender and delete the e-mail. Unauthorised use, disclosure or copying
    of the contents of this e-mail, or any similar action, is prohibited. Thank
    you.



    This archive was generated by hypermail 2.0.0 : Mon Oct 06 2003 - 10:20:23 EDT