Re: Error loading project after selecting DBCPDataSourceFactory

From: Gary Jarrel (garyjarre..mail.com)
Date: Thu May 03 2007 - 20:44:22 EDT

  • Next message: Andrus Adamchik: "Re: Error loading project after selecting DBCPDataSourceFactory"

    Interesting cause I'm using 2.0.2 and noticed that if my cayenne.xml
    is as follows:

    <node name="katya"
        datasource="katya.driver.properties"
        factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
            <map-ref name="katya"/>
    </node>

    Then an exception as follows:

     org.apache.cayenne.project.ProjectException: [v.2.0.2 January 14
    2007] Error initializaing project configuration.
            at org.apache.cayenne.project.ApplicationProject.loadProject(ApplicationProject.java:130)
            at org.apache.cayenne.project.ApplicationProject.postInitialize(ApplicationProject.java:106)
            at org.apache.cayenne.project.ApplicationProject.<init>(ApplicationProject.java:90)
            at org.apache.cayenne.modeler.action.OpenProjectAction.openProject(OpenProjectAction.java:111)
            at org.apache.cayenne.modeler.action.OpenProjectAction.performAction(OpenProjectAction.java:99)
            at org.apache.cayenne.modeler.util.CayenneAction.actionPerformed(CayenneAction.java:163)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
            at javax.swing.DefaultButtonModel.fireActionPer

    <snip>

    Caused by: org.apache.cayenne.CayenneRuntimeException: [v.2.0.2
    January 14 2007] Null dataSource
            at org.apache.cayenne.dba.AutoAdapter.<init>(AutoAdapter.java:105)
            at org.apache.cayenne.dba.AutoAdapter.<init>(AutoAdapter.java:95)
            at org.apache.cayenne.modeler.util.ModelerDbAdapter.<init>(ModelerDbAdapter.java:50)
            at org.apache.cayenne.modeler.action.ModelerProjectLoadDelegate.initAdapter(ModelerProjectLoadDelegate.java:48)
            at org.apache.cayenne.conf.RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:315)
            at org.apache.cayenne.conf.ConfigLoader$NodeHandler.init(ConfigLoader.java:330)
            at org.apache.cayenne.conf.ConfigLoader$DomainHandler.startElement(ConfigLoader.java:219)

    <snip>

    However if I change the cayenne.xml file as follows:

    <node name="katya"
        datasource="katya.driver"
        factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
        <map-ref name="katya"/>
    </node>

    Then everything loads fine.

    Keeping in mind that the properties file name is: katya.driver.properties

    I've tried it about 30 seconds ago and this was the sequence of events.

    Perhaps the extra dot (.) in the file name?

    Gary

    On 5/3/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Actually this issue is addressed in 2.0 and 3.0, so this is gotta be
    > something else. Here is a relevant code, it handles location with or
    > without extension:
    >
    > InputStream in = resourceLocator.findResourceStream(location);
    >
    > // try appending ".properties" extension..
    > if (in == null && !location.endsWith(".properties")) {
    > in = resourceLocator.findResourceStream(location +
    > ".properties");
    > }
    >
    > Andrus
    >
    >
    > On May 3, 2007, at 5:09 AM, Gary Jarrel wrote:
    >
    > > I believe one reason for this is that in your data node configuration
    > > yuor dbcp properties file is specified as "dbcp.properties" try simply
    > > specifying "dbcp" and ignoring the .properties extension.
    > >
    > > You'll probably wont be able to open this project in cayenne modeler
    > > until you make the change manually in cayenne.xml file under the
    > > node->datasource
    > >
    > > Hope this helps
    > >
    > > Cheers,
    > >
    > > Gary
    > >
    > > On 4/29/07, Ryan Holmes <rya..yperstep.com> wrote:
    > > <snip>
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu May 03 2007 - 20:44:55 EDT