RE: More Detail: NullPointerException in call to DataContext.crea teDataContext()

From: Marcia Corprew (marcia.corpre..ccesspointinc.com)
Date: Wed Oct 13 2004 - 08:40:17 EDT

  • Next message: Andrus Adamchik: "Re: Newbie help with error on commit. Possible relationship error?"

    Here is more detail on my issue to help me, the wholly uninformed Cayenne
    user:

    I'm using Cayenne 1.1B.

    Here's the Tomcat startup log section indicating Cayenne initialization
    status:

    Starting Configuration Servlet

    235 [main] DEBUG org.objectstyle.cayenne.conf.DefaultConfiguration - using
    doma
    in file name: cayenne.xml
    375 [main] DEBUG org.objectstyle.cayenne.conf.DefaultConfiguration -
    initialize
     starting.
    375 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    - s
    earching additional context paths: [/WEB-INF/]
    375 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    - s
    earching for: /WEB-INF//cayenne.xml
    391 [main] DEBUG org.objectstyle.cayenne.util.ResourceLocator - URL found
    with
    classloader:
    file:/C:/jakarta-tomcat-5.0.28/webapps/new_recon/WEB-INF/classes/ca
    yenne.xml
    422 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - started
    con
    figuration loading.
    438 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - loaded
    doma
    in: Reconciliation
    454 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    - s
    earching additional context paths: [/WEB-INF/]
    454 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    - s
    earching for: /WEB-INF//Local_Recon.map.xml
    469 [main] DEBUG org.objectstyle.cayenne.util.ResourceLocator - URL found
    with
    classloader:
    file:/C:/jakarta-tomcat-5.0.28/webapps/new_recon/WEB-INF/classes/Lo
    cal_Recon.map.xml
    641 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - loaded
    <map
     name='Local_Recon' location='Local_Recon.map.xml'>.
    641 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - loading
    <no
    de name='Recon' datasource='Recon.driver.xml'
    factory='org.objectstyle.cayenne.c
    onf.DriverDataSourceFactory'>.
    891 [main] DEBUG org.objectstyle.cayenne.util.ResourceLocator - URL found
    with
    classloader:
    file:/C:/jakarta-tomcat-5.0.28/work/Catalina/localhost/new_recon/lo
    ader/org/objectstyle/cayenne/dba/types.xml
    891 [main] DEBUG org.objectstyle.cayenne.util.ResourceLocator - resource
    found
    in classpath:
    file:/C:/jakarta-tomcat-5.0.28/work/Catalina/localhost/new_recon/l
    oader/org/objectstyle/cayenne/dba/types.xml
    1016 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - using
    fact
    ory: org.objectstyle.cayenne.conf.DriverDataSourceFactory
    1032 [main] DEBUG org.objectstyle.cayenne.conf.DriverDataSourceFactory -
    loadin
    g driver information from 'Recon.driver.xml'.
    1032 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    -
    searching additional context paths: [/WEB-INF/]
    1032 [main] DEBUG org.objectstyle.cayenne.util.WebApplicationResourceLocator
    -
    searching for: /WEB-INF//Recon.driver.xml
    1047 [main] DEBUG org.objectstyle.cayenne.util.ResourceLocator - URL found
    with
     classloader:
    file:/C:/jakarta-tomcat-5.0.28/webapps/new_recon/WEB-INF/classes/R
    econ.driver.xml
    1047 [main] DEBUG org.objectstyle.cayenne.conf.DriverDataSourceFactory -
    loadin
    g driver com.microsoft.jdbc.sqlserver.SQLServerDriver
    1063 [main] DEBUG org.objectstyle.cayenne.conf.DriverDataSourceFactory -
    loadin
    g user name and password.
    1078 [main] INFO org.objectstyle.cayenne.access.QueryLogger - Created
    connectio
    n pool: jdbc:microsoft:sqlserver://xx.xx.x.xx:1433;DatabaseName=LOCAL_RECON
            Driver class: com.microsoft.jdbc.sqlserver.SQLServerDriver
            Min. connections in the pool: 1
            Max. connections in the pool: 100
            Login: Dealerxxxxxx
            Password: *******
    1313 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - loaded
    dat
    asource.
    1328 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate - loaded
    map
    -ref: Local_Recon.
    1328 [main] DEBUG org.objectstyle.cayenne.conf.Configuration - added
    domain: Re
    conciliation
    1328 [main] DEBUG org.objectstyle.cayenne.conf.RuntimeLoadDelegate -
    finished c
    onfiguration loading in 906 ms.
    1328 [main] DEBUG org.objectstyle.cayenne.conf.DefaultConfiguration -
    initializ
    e finished.
    1328 [main] DEBUG org.objectstyle.cayenne.conf.DefaultConfiguration -
    didInitia
    lize finished.
    Oct 12, 2004 4:18:06 PM org.apache.catalina.core.StandardHostDeployer
    install
    INFO: Installing web application at context path from URL
    file:C:\jakarta-tomca
    t-5.0.28\webapps\ROOT
    Oct 12, 2004 4:18:06 PM org.apache.catalina.core.StandardHostDeployer
    install
    INFO: Installing web application at context path /servlets-examples from URL
    fil
    e:C:\jakarta-tomcat-5.0.28\webapps\servlets-examples
    Oct 12, 2004 4:18:06 PM org.apache.catalina.core.StandardHostDeployer
    install
    INFO: Installing web application at context path /tomcat-docs from URL
    file:C:\j
    akarta-tomcat-5.0.28\webapps\tomcat-docs
    Oct 12, 2004 4:18:06 PM org.apache.catalina.core.StandardHostDeployer
    install
    INFO: Installing web application at context path /webdav from URL
    file:C:\jakart
    a-tomcat-5.0.28\webapps\webdav
    Oct 12, 2004 4:18:06 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    Oct 12, 2004 4:18:07 PM org.apache.jk.common.ChannelSocket init
    INFO: JK2: ajp13 listening on /0.0.0.0:8009
    Oct 12, 2004 4:18:07 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/32
    config=C:\jakarta-tomcat-5.0.28\conf\jk2.proper
    ties
    Oct 12, 2004 4:18:07 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 7062 ms

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Wednesday, October 13, 2004 12:07 AM
    To: cayenne-use..bjectstyle.org
    Subject: Re: NullPointerException in call to DataContext.createDataContext()

    Hi Marcia,

    What version of Cayenne do you have (my latest code has line 151 at
    DataContext.java pointing to a totally different code, so is hard to
    trace the origin, though I can guess where it is of course...). But
    more importantly - could you post the log statements that according to
    your message indicate proper Cayenne startup - this may be helpful in
    diagnosing the problem further.

    Thanks
    Andrus

    On Oct 12, 2004, at 4:27 PM, Marcia Corprew wrote:

    > A former co-worker successfully used cayenne in other environments,
    > however I'm trying to mirror the environment on my own machine and am
    > getting the error below when I start my application.  Between the
    > cayenne documentation and by looking at our other working
    > environments, it appears that I have the libraries and appropriate
    > cayenne files in the correct location.  When I start Tomcat, my
    > cayenne initialization appears to be okay with no reported errors. 
    > (The output indicates that all maps and xml files were loaded, the
    > database connection pool was created and my specified domain was
    > added.)
    >
    > I've searched the entire archive, but to no avail.  I'm sure it's a
    > basic error but I've searched for longer than I care to admit for a
    > solution and am hoping someone has the patience to get me on the right
    > path.  If I need to provide more detail, let me know.  I've been
    > thrown to the wolves in regards to Cayenne and my crash course isn't
    > going very smoothly.
    >
    > The offending line of code: 
    >
    >     DataContext context = DataContext.createDataContext();
    >
    > The error:
    >
    > File name:
    > C:\jakarta-tomcat-5.0.28\webapps\new_recon\WEB-
    > INF\classes\bstResaleConvert.class
    >
    > Exception in thread "main" java.lang.NullPointerException
    >
    >         at
    > org.objectstyle.cayenne.access.DataContext.createDataContext(DataContex
    > t.java:151)
    >
    >         at
    > api.reconciliation.conversion.BellSouthResaleConverter.processRows(Bell
    > SouthResaleConverter.java:63)
    >
    >         at
    > api.reconciliation.conversion.BellSouthResaleConverter.<init>(BellSouth
    > ResaleConverter.java:43)
    >
    >         at bstResaleConvert.main(bstResaleConvert.java:33)
    >
    > Tx,
    >
    > Marcia
    >



    This archive was generated by hypermail 2.0.0 : Wed Oct 13 2004 - 08:42:41 EDT