Re: Deploy to Resin throws config error

From: Steve Wells (stwell..wnmail.net)
Date: Sat Sep 25 2004 - 00:12:11 EDT

  • Next message: Jason Dwyer: "RE: postgres PK serial column insert error"

    The namespace issue seems to be spot on. I did as suggested and the
    Attributes atts[0]._namespace value is null, if I set it to "" it gets
    through. I also tryed setting namespaces in the cayenne.xml such as:
    <domain xmlns="myns" myns:name="xxx"> xmlns sets the namespaceURI =
    "myns" and myns: sets the atts[0]._prefix = "myns"
    also tryed xmlns="" and <dom:domain
    xmlns:dom="http://objectstyle.org/cayenne" dom:name="my_dom">

    Anyway, back to reality, I dont think we should have to do this.

    So I found a workaround for the moment, following the directions at
    http://www.caucho.com/resin/ref/xml/parsing.xtp
    add to your web.xml
    <system-property javax.xml.parsers.DocumentBuilderFactory=
                          "com.caucho.xml.parsers.XmlDocumentBuilderFactory"/>
    <system-property javax.xml.parsers.SAXParserFactory=
                          "org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
    <system-property javax.xml.transform.TransformerFactory=
                          "org.apache.xalan.processor.TransformerFactoryImpl"/>

    and add to your WEB-INf/lib xercesImpl.jar xmlParserAPIs.jar (I copied
    mine from Tomcat 4.1.29)

    I couldn't see anything wrong with how the SAX parser is setup from the
    Cayenne side.

    I guess a workaround in code could be done but to write a kludge in this
    case seems wrong.

    Also found this at caucho:
    Resin XML parser doesn't conform with SAX2:
    http://www.caucho.com/quercus/faq/question.xtp?question_id=1003
     

    ----- Original message -----
    From: "Andrus Adamchik" <andru..bjectstyle.org>
    To: cayenne-use..bjectstyle.org
    Date: Fri, 24 Sep 2004 20:11:26 -0400
    Subject: Re: Deploy to Resin throws config error

    As I prefer to know about XML just the bare minimum that gets me by, so
    I can't point to the exact problem... Still looking at the loader code,
    this might be some XML namespace issue. Cayenne extracts element
    attributes using code like this:

    public void startElement(
                 String namespaceURI,
                 String localName,
                 String qName,
                 Attributes atts)
                 throws SAXException {

    String domainName = attrs.getValue("", "name");
    }

    ignoring all other stuff... I wonder if resin's parser doesn't like it.
    It would be nice to be able to pick at the XML parts passed to
    "startElement". The ideal way to do that is to run resin in debugger,
    and insert a breakpoint at ConfigLoader, line 190. Alternatively you
    can get Cayenne from CVS and recompile it with debug statements.

    Another random idea is to check for another cayenne.xml file floating
    around your environment...

    Andrus

    > Normally I do my web dev using Tomcat, today I tryed deploying to Resin
    > and as soon as I get the data context it throws:
    > (ok so it uses a different XML parser and personally I'd point the
    > finger at the caucho lib, but thought I'd ask here. I checked the
    > cayenne.xml and the domain tag has a valid looking name="my_domain")
    >
    > Error during Configuration initialization. [v.1.1B3 September 20 2004]
    > Domain 'name' attribute must be not null.
    >
    > Stack Trace:
    > org.objectstyle.cayenne.conf.RuntimeLoadDelegate.shouldLoadDataDomain(R
    > untimeLoadDelegate.java:179)
    > org.objectstyle.cayenne.conf.ConfigLoader$DomainHandler.init(ConfigLoad
    > er.java:235)
    > org.objectstyle.cayenne.conf.ConfigLoader$DomainsHandler.startElement(C
    > onfigLoader.java:190)
    > com.caucho.xml.XmlParser.addElement(XmlParser.java:2492)
    > com.caucho.xml.XmlParser.parseElement(XmlParser.java:633)
    > com.caucho.xml.XmlParser.parseNode(XmlParser.java:379)
    > com.caucho.xml.XmlParser.parseInt(XmlParser.java:254)
    > com.caucho.xml.AbstractParser.parse(AbstractParser.java:648)
    > org.objectstyle.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java
    > :114)
    > org.objectstyle.cayenne.conf.DefaultConfiguration.initialize(DefaultCon
    > figuration.java:185)
    > org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguratio
    > n(Configuration.java:296)
    > org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguratio
    > n(Configuration.java:278)
    > org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguratio
    > n(Configuration.java:261)
    > org.objectstyle.cayenne.conf.Configuration.getSharedConfiguration(Confi
    > guration.java:224)
    > org.objectstyle.cayenne.access.DataContext.createDataContext(DataContex
    > t.java:251)



    This archive was generated by hypermail 2.0.0 : Sat Sep 25 2004 - 00:12:46 EDT