error finding node.xml in jar-file

From: Jens Mayer (Jens.Mayer..mx.de)
Date: Tue Sep 18 2007 - 01:21:12 EDT

  • Next message: Mikaël Cluseau: "Re: Modifying projects in Java"

    Hi,

    I'm using the technique of copying datamaps (by Michael Gentry, look at http://cwiki.apache.org/CAY/copying-datamaps.html).

    Works fine as long as the configuration files are located in the filesystem. I moved them into a package (following the hints at http://cwiki.apache.org/CAYDOC/customizing-configuration.html). Now it works within the IDE (Eclipse 3.2), but not within a jar-file.

    this is the cayenne.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <domains project-version="2.0">

    <domain name="DC">
            <node name="DCNode"
                     datasource="DCNode.driver.xml"
                     factory="org.apache.cayenne.conf.DriverDataSourceFactory">
             </node>
    </domain>
    <domain name="SharedDomain">
            <map name="SharedMap" location="SharedMap.map.xml"/>

            <node name="SharedNode"
                     datasource="SharedNode.driver.xml"
                     factory="org.apache.cayenne.conf.DriverDataSourceFactory">
                            <map-ref name="SharedMap"/>
             </node>
    </domain>
    </domains>

    The cayenne.xml and SharedNode.driver.xml are found, but DCNode.driver.xml cannnot be located in the jar-file, because in that case the "jar:file:...."-Prefix isn't used by the ResourceLocator.

    Any suggestions what I am doing wrong ?

    Thanks in advance

    Jens

    This is the Logging-Output (DEBUG-Level):

    using domain file name: cayenne.xml
    canInitialize started.
    initialize starting.
    searching additional classpaths: [de/edeka/ebus/dc/db/util, de/edeka/ebus/dc/db/conf]
    searching for: de/edeka/ebus/dc/db/util/cayenne.xml
    URL not found with classloader: de/edeka/ebus/dc/db/util/cayenne.xml
    searching for: de/edeka/ebus/dc/db/conf/cayenne.xml
    URL found with classloader: jar:file:/T:/test/dcmonitor.jar!/de/edeka/ebus/dc/db/conf/cayenne.xml
    started configuration loading.
    loaded domain: DC
    loading <node name='DCNode' datasource='DCNode.driver.xml' factory='org.apache.cayenne.conf.DriverDataSourceFactory'>.
    using factory: org.apache.cayenne.conf.DriverDataSourceFactory
    loading driver information from 'DCNode.driver.xml'.
    searching additional classpaths: [de/edeka/ebus/dc/db/util, de/edeka/ebus/dc/db/conf]
    searching for: de/edeka/ebus/dc/db/util/DCNode.driver.xml
    URL not found with classloader: de/edeka/ebus/dc/db/util/DCNode.driver.xml
    searching for: de/edeka/ebus/dc/db/conf/DCNode.driver.xml
    URL not found with classloader: de/edeka/ebus/dc/db/conf/DCNode.driver.xml
    URL not found with classloader: DCNode.driver.xml
    Error: location 'DCNode.driver.xml' not found.
    Error: DataSource load failed
    org.apache.cayenne.ConfigurationException: [v.2.0.2 January 14 2007] Can't find DataSource configuration file at DCNode.driver.xml
            at org.apache.cayenne.conf.DriverDataSourceFactory.load(DriverDataSourceFactory.java:122)
            at org.apache.cayenne.conf.DriverDataSourceFactory.getDataSource(DriverDataSourceFactory.java:80)
            at org.apache.cayenne.conf.RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:297)
            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(Unknown Source)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:78)
            at org.apache.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:161)
            at org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:276)
            at de.edeka.ebus.dc.db.util.DcContextManager.<init>(DcContextManager.java:44)
            at de.edeka.ebus.dc.db.util.DcContextManager.getInstance(DcContextManager.java:54)
            at de.edeka.ebus.dc.db.Status.<clinit>(Status.java:41)
            at de.edeka.ebus.dc.util.StatusImage.<clinit>(StatusImage.java:23)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createStatusFilterGroup(ViewMkt.java:193)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createFilterComposite(ViewMkt.java:171)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createControls(ViewMkt.java:106)
            at de.edeka.ebus.dc.mvc.monitor.ViewDetail.createControls(ViewDetail.java:43)
            at de.edeka.ebus.dc.mvc.monitor.ViewMain.createControls(ViewMain.java:38)
            at de.edeka.ebus.framework.mvc.BaseMvc.<init>(BaseMvc.java:44)
            at de.edeka.ebus.dc.mvc.monitor.MvcMain.<init>(MvcMain.java:29)
            at de.edeka.ebus.dc.app.MonitorWindow.createContents(MonitorWindow.java:61)
            at org.eclipse.jface.window.Window.create(Window.java:426)
            at org.eclipse.jface.window.Window.open(Window.java:785)
            at de.edeka.ebus.dc.app.StartMonitor.main(StartMonitor.java:45)
    no adapter set, using automatic adapter.
    loaded domain: SharedDomain
    searching additional classpaths: [de/edeka/ebus/dc/db/util, de/edeka/ebus/dc/db/conf]
    searching for: de/edeka/ebus/dc/db/util/SharedMap.map.xml
    URL not found with classloader: de/edeka/ebus/dc/db/util/SharedMap.map.xml
    searching for: de/edeka/ebus/dc/db/conf/SharedMap.map.xml
    URL found with classloader: jar:file:/T:/test/dcmonitor.jar!/de/edeka/ebus/dc/db/conf/SharedMap.map.xml
    loaded <map name='SharedMap' location='SharedMap.map.xml'>.
    loading <node name='SharedNode' datasource='SharedNode.driver.xml' factory='org.apache.cayenne.conf.DriverDataSourceFactory'>.
    using factory: org.apache.cayenne.conf.DriverDataSourceFactory
    loading driver information from 'SharedNode.driver.xml'.
    searching additional classpaths: [de/edeka/ebus/dc/db/util, de/edeka/ebus/dc/db/conf]
    searching for: de/edeka/ebus/dc/db/util/SharedNode.driver.xml
    URL not found with classloader: de/edeka/ebus/dc/db/util/SharedNode.driver.xml
    searching for: de/edeka/ebus/dc/db/conf/SharedNode.driver.xml
    URL found with classloader: jar:file:/T:/test/dcmonitor.jar!/de/edeka/ebus/dc/db/conf/SharedNode.driver.xml
    loading driver null
    Created connection pool: null
            Driver class: null
            Min. connections in the pool: 1
            Max. connections in the pool: 1
    loaded datasource.
    no adapter set, using automatic adapter.
    loaded map-ref: SharedMap.
    Exception in thread "main" java.lang.ExceptionInInitializerError
            at de.edeka.ebus.dc.util.StatusImage.<clinit>(StatusImage.java:23)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createStatusFilterGroup(ViewMkt.java:193)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createFilterComposite(ViewMkt.java:171)
            at de.edeka.ebus.dc.mvc.monitor.ViewMkt.createControls(ViewMkt.java:106)
            at de.edeka.ebus.dc.mvc.monitor.ViewDetail.createControls(ViewDetail.java:43)
            at de.edeka.ebus.dc.mvc.monitor.ViewMain.createControls(ViewMain.java:38)
            at de.edeka.ebus.framework.mvc.BaseMvc.<init>(BaseMvc.java:44)
            at de.edeka.ebus.dc.mvc.monitor.MvcMain.<init>(MvcMain.java:29)
            at de.edeka.ebus.dc.app.MonitorWindow.createContents(MonitorWindow.java:61)
            at org.eclipse.jface.window.Window.create(Window.java:426)
            at org.eclipse.jface.window.Window.open(Window.java:785)
            at de.edeka.ebus.dc.app.StartMonitor.main(StartMonitor.java:45)
    Caused by: org.apache.cayenne.ConfigurationException: [v.2.0.2 January 14 2007] Error during Configuration initialization. [v.2.0.2 January 14 2007] Load failures. Main configuration class: de.edeka.e
    bus.dc.db.util.DcPackageConfiguration, details:
            domain.node.name=DCNode, domain.node.datasource=DCNode.driver.xml, reason: DataSource load failed - [v.2.0.2 January 14 2007] Can't find DataSource configuration file at DCNode.driver.xml
            at org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:285)
            at de.edeka.ebus.dc.db.util.DcContextManager.<init>(DcContextManager.java:44)
            at de.edeka.ebus.dc.db.util.DcContextManager.getInstance(DcContextManager.java:54)
            at de.edeka.ebus.dc.db.Status.<clinit>(Status.java:41)
            ... 12 more
    Caused by: org.apache.cayenne.ConfigurationException: [v.2.0.2 January 14 2007] Load failures. Main configuration class: de.edeka.ebus.dc.db.util.DcPackageConfiguration, details:
            domain.node.name=DCNode, domain.node.datasource=DCNode.driver.xml, reason: DataSource load failed - [v.2.0.2 January 14 2007] Can't find DataSource configuration file at DCNode.driver.xml
            at org.apache.cayenne.conf.RuntimeLoadDelegate.finishedLoading(RuntimeLoadDelegate.java:470)
            at org.apache.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:79)
            at org.apache.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:161)
            at org.apache.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:276)
            ... 15 more

    -- 
    Psssst! Schon vom neuen GMX MultiMessenger gehört?
    Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
    



    This archive was generated by hypermail 2.0.0 : Tue Sep 18 2007 - 01:21:46 EDT