[jira] Commented: (CAY-1071) NullPointer in BaseQueryMetadata while executing Queri

From: JIRA (Jürgen)
Date: Wed Jun 11 2008 - 17:07:52 EDT

  • Next message: JIRA: "[jira] Issue Comment Edited: (CAY-1071) NullPointer in BaseQueryMetadata while executing Queri"

        [ https://issues.apache.org/cayenne/browse/CAY-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12954#action_12954 ]

    Jürgen Seliger commented on CAY-1071:
    -------------------------------------

    In my Webapp I have this line:
          List result = dbcontext.performQuery(select1);

    And then I get this Error:
    008-06-11 22:57:25,330 - ERROR (WebInitServlet.java:118) - Fehler: null
    java.lang.NullPointerException
            at org.apache.cayenne.query.BaseQueryMetadata.resolve(BaseQueryMetadata.java:100)
            at org.apache.cayenne.query.SelectQueryMetadata.resolve(SelectQueryMetadata.java:45)
            at org.apache.cayenne.query.SelectQuery.getMetaData(SelectQuery.java:148)
            at org.apache.cayenne.util.ObjectContextQueryAction.<init>(ObjectContextQueryAction.java:79)
            at org.apache.cayenne.access.DataContextQueryAction.<init>(DataContextQueryAction.java:49)
            at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1336)
            at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1325)
            at de.seliger.jsweb.db.DBUpdate.existsInitialTable(DBUpdate.java:79)
            at de.seliger.jsweb.db.DBUpdate.updateDB(DBUpdate.java:43)
            at de.seliger.jsweb.init.WebInitServlet.init(WebInitServlet.java:60)
            at javax.servlet.GenericServlet.init(GenericServlet.java:212)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
            at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
            at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
            at org.apache.catalina.core.StandardService.start(StandardService.java:516)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

    Before I created the context with this lines:
                try {
                    dbcontext = DataContext.getThreadDataContext();
                }
                catch(IllegalStateException ex) {
                    // handle failure
                    dbcontext = DataContext.createDataContext();
                }

    The line
    DataContext.getThreadDataContext();
    throw an catch(IllegalStateException and I musst create a Context normal.

    > NullPointer in BaseQueryMetadata while executing Queri
    > ------------------------------------------------------
    >
    > Key: CAY-1071
    > URL: https://issues.apache.org/cayenne/browse/CAY-1071
    > Project: Cayenne
    > Issue Type: Bug
    > Components: Cayenne Core Library
    > Affects Versions: 3.0
    > Environment: openSuSE 10.3, Kernel Linux 2.6.22.17-0.1-default i686, Java 1.6.0_04
    > Reporter: Jürgen Seliger
    > Assignee: Andrus Adamchik
    >
    > I figured out a problem (NullPointerException) in Line at org.apache.cayenne.query.BaseQueryMetadata.resolve(BaseQueryMetadata.java:100) in BaseQueryMetadata class. The resolver in line 100
    > entity = resolver.lookupObjEntity((Class<?>) root);
    > is null and there is no check if there is so.
    > The methode getEntityResolver() in DataContext says it could be null. I also recommend to put the surrounding if-statement at the end of all if-else-statements, because all classes are instances of Class.
    > Hope I could help you, and you fixe the problem as soon as possible, because I want use cayenne for myself.
    > Dear
    > Jurgen Seliger

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Wed Jun 11 2008 - 17:08:20 EDT