Jeff Pierson commented on CAY-785:
----------------------------------
Today I got the trunk built on my machine and tried to debug this problem. With my limited knowledge of Cayenne internals, here is what I think is happening. The Modeler application, when opening a Cayenne.xml file calls ProjectAction.buildProjectApplication() which makes a new ProjectConfiguration object. ProjectConfiguration overrides the getDataSourceFactory() method of Configuration and always returns a ProjectDataSourceFactory which extends DriverDataSourceFactory. When the RuntimeLoadDelegate.shouldLoadDataNode() attempts to load the datasource it calls getDataSourceFactory() and uses the ProjectDataSourceFactory instead of the DBCPDataSourceFactory that was passed in. It tries to parse the dbcp.properties file as if it were a driver.xml file. If you delete or rename the dbcp.properties file, the modeler will go ahead and load the project. I was hoping this was a simple fix and I could just submit a patch but I don't think that is the case. I also think this is more than a minor bug. It seems to me that the Modeler will always fail to load any project using dbcp if the dbcp.properties file exists, which is the normal case.
> Cayenne Modeler Fails to Open Project
> --------------------------------------
>
> Key: CAY-785
> URL: https://issues.apache.org/cayenne/browse/CAY-785
> Project: Cayenne
> Issue Type: Bug
> Components: CayenneModeler GUI
> Affects Versions: 2.0 [STABLE]
> Environment: Ubuntu 7.04, JDK 1.5.0_11
> Reporter: Gary Jarrel
> Assignee: Andrus Adamchik
> Priority: Minor
> Attachments: files.tar.gz
>
>
> If cayenne.xml contains an entry:
> <node name="katya"
> datasource="katya.driver.properties"
> factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
> <map-ref name="katya"/>
> </node>
> Noting the datasource: katya.driver.properties
> The following exception occurs:
> 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.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
> at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
> at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
> at java.awt.Component.processMouseEvent(Component.java:5501)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5266)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3968)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3803)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1778)
> at java.awt.Component.dispatchEvent(Component.java:3803)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> 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)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> at org.apache.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:78)
> at org.apache.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:161)
> at org.apache.cayenne.project.ApplicationProject.loadProject(ApplicationProject.java:127)
> ... 31 more
> 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.fireActionPerformed(DefaultButtonModel.java:420)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
> at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
> at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
> at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
> at java.awt.Component.processMouseEvent(Component.java:5501)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
> at java.awt.Component.processEvent(Component.java:5266)
> at java.awt.Container.processEvent(Container.java:1966)
> at java.awt.Component.dispatchEventImpl(Component.java:3968)
> at java.awt.Container.dispatchEventImpl(Container.java:2024)
> at java.awt.Component.dispatchEvent(Component.java:3803)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
> at java.awt.Container.dispatchEventImpl(Container.java:2010)
> at java.awt.Window.dispatchEventImpl(Window.java:1778)
> at java.awt.Component.dispatchEvent(Component.java:3803)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> 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)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> at org.apache.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:78)
> at org.apache.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:161)
> at org.apache.cayenne.project.ApplicationProject.loadProject(ApplicationProject.java:127)
> ... 31 more
> If the datasource is changed as follows:
> <node name="katya"
> datasource="katya.driver"
> factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
> <map-ref name="katya"/>
> </node>
> Noting: katya.driver
> The project opens file in the modeler.
> The DBCP properties file is: katya.driver.properties
-- 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 : Mon Apr 21 2008 - 17:10:22 EDT