Re: Exception in SAXParserFactory.newInstance with 3.0M4

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jul 01 2008 - 12:05:03 EDT

  • Next message: Jerald Dawson: "Re: Exception in SAXParserFactory.newInstance with 3.0M4"

    Hmmm... I vaguely remember fixing that in M4 (i.e. making
    "encoderClass", "passwordLocation", "passwordSource" attributes
    optional). There was indeed a version of Cayenne that absolutely
    required those attributes (M3?). Now I think it shouldn't. Can you
    doublecheck the runtime version of cayenne-server.jar that causes the
    NPE?

    Andrus

    On Jul 1, 2008, at 6:57 PM, Scott Anderson wrote:

    > To summarize, a NullPointerException in
    > DataSourceInfo.getPasswordEncoder() is presumably caused by a missing
    > encoderClass attribute in the driver.xml file, despite this field
    > being
    > specified with the modeler.
    >
    > Sounds to me like a candidate for a JIRA against the modeler.
    >
    > -----Original Message-----
    > From: Jerald Dawson [mailto:jdawso..rk.com]
    > Sent: Tuesday, July 01, 2008 11:52 AM
    > To: use..ayenne.apache.org
    > Subject: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4
    >
    > Moving this to the list:
    >
    >
    > Begin forwarded message:
    >
    >> From: Jerald Dawson <jdawso..rk.com>
    >> Date: July 1, 2008 10:49:20 AM CDT
    >> To: "Scott Anderson" <sanderso..irvana.com>
    >> Cc: "Andrus Adamchik" <andru..bjectstyle.org>
    >> Subject: Re: Exception in SAXParserFactory.newInstance with 3.0M4
    >>
    >> Thats interesting. Here is my drive.xml file:
    >>
    >> <?xml version="1.0" encoding="utf-8"?>
    >> <driver project-version="3.0" class="com.mysql.jdbc.Driver">
    >> <url value="jdbc:mysql://10.20.1.10/SystemRunner?
    >> capitalizeTypenames=true"/>
    >> <connectionPool min="1" max="1"/>
    >> <login userName="systemrunner" password="*******"/>
    >> </driver>
    >>
    >> As you can see, I do not have the encoderClass, passwordLocation and
    >> passwordSource attributes in the login item. I'm going to try adding
    >> those manually and see what happens. Again, this file was created
    >> with Modeler.
    >>
    >> -j
    >>
    >> On Jul 1, 2008, at 10:30 AM, Scott Anderson wrote:
    >>
    >>> Judging from the stack trace, I'd guess that the encoderClass
    >>> attribute
    >>> of the login entity is invalid in the .driver.xml file. I'm not
    >>> sure how
    >>> that could happen if you created the file using the modeler. I'm
    >>> copying
    >>> Andrus on this, since he'll probably have a better understand of
    >>> what's
    >>> going on.
    >>>
    >>> Here's what my working driver.xml file looks like, for comparison:
    >>>
    >>> <?xml version="1.0" encoding="utf-8"?>
    >>> <driver project-version="3.0" class="com.mysql.jdbc.Driver">
    >>> <url value="jdbc:mysql://hostname/dbname"/>
    >>> <connectionPool min="1" max="1"/>
    >>> <login userName="user" password="pass"
    >>> encoderClass="org.apache.cayenne.conf.PlainTextPasswordEncoder"
    >>> passwordLocation="model" passwordSource="Not Applicable"/>
    >>> </driver>
    >>>
    >>> -----Original Message-----
    >>> From: Jerald Dawson [mailto:jdawso..rk.com]
    >>> Sent: Tuesday, July 01, 2008 10:41 AM
    >>> To: Scott Anderson
    >>> Subject: Re: Exception in SAXParserFactory.newInstance with 3.0M4
    >>>
    >>> Ok, I removed all the jars from my classpath except for the ones
    >>> specifically needed for cayenne and that seemed to fix my class
    >>> problem. I've not dug into it yet to see what jar was specifically
    >>> causing it but now when I run my app, it attempts to load the
    >>> cayenne.xml file. However, its throwing an exception when it tries
    >>> to
    >>> load the user name and password thats stored in the xml files for
    >>> access the mysql database. The exception is:
    >>>
    >>> ...
    >>> Jul 1, 2008 9:32:24 AM
    >>> org.apache.cayenne.conf.DriverDataSourceFactory
    >>> $LoginHandler init
    >>> INFO: loading user name and password.
    >>> Jul 1, 2008 9:32:24 AM org.apache.cayenne.conf.RuntimeLoadDelegate
    >>> shouldLoadDataNode
    >>> INFO: Error: DataSource load failed
    >>> java.lang.NullPointerException
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne.conn.DataSourceInfo.getPasswordEncoder(DataSourceInfo.java:
    >>> 207)
    >>> at org.apache.cayenne.conf.DriverDataSourceFactory
    >>> $LoginHandler.init(DriverDataSourceFactory.java:324)
    >>> ...
    >>>
    >>> I've checked the xml files and the username and password are stored
    >>> in
    >>> the files. The model's password encoder is set to
    >>> org.apache.cayenne.conf.PlainTextPasswordEncoder,
    >>>
    >>> Any help would be greatly appreciated. I feel like a newbie
    >>> again. :-)
    >>>
    >>> -j
    >>>
    >>> On Jul 1, 2008, at 7:45 AM, Scott Anderson wrote:
    >>>
    >>>> You sure you have all of them? Ashwood, collections, lang, logging,
    >>>> and
    >>>> velocity, in addition to the server jar and your mysql/j driver?
    >>>> In my
    >>>> experience, Cayenne generally fail how you describe when one of the
    >>>> non-server jars is missing.
    >>>>
    >>>> -----Original Message-----
    >>>> From: Jerald Dawson [mailto:jdawso..rk.com]
    >>>> Sent: Monday, June 30, 2008 4:36 PM
    >>>> To: use..ayenne.apache.org
    >>>> Subject: Re: Exception in SAXParserFactory.newInstance with 3.0M4
    >>>>
    >>>> Hi Andrus
    >>>>
    >>>> I'm using Eclipse 3.4 for development. I've added the cayenne jars
    >>>> to
    >>>> my classpath and I'm running my app inside eclipse.
    >>>>
    >>>> -j
    >>>>
    >>>> On Jun 30, 2008, at 3:07 PM, Andrus Adamchik wrote:
    >>>>
    >>>>>> Seems to be throwing a class not found exception but I can't be
    >>>>>> sure since it just ungracefully terminates the app with not stack
    >>>>>> dump.
    >>>>>
    >>>>> This is unusual for a Java application. What type of application
    >>>>> is
    >>>>> that and how do you compile and run it?
    >>>>>
    >>>>> (and yes - SAX parser is part of JDK, and .. well, it just works).
    >>>>>
    >>>>> Andrus
    >>>>>
    >>>>>
    >>>>> On Jun 30, 2008, at 10:55 PM, Jerald Dawson wrote:
    >>>>>> Hello
    >>>>>>
    >>>>>> I'm new to cayenne (actually a webobjects guy) and I'm trying to
    >>>>>> get it working. I'm was able able to get modeler working and I
    >>>>>> created a model for accessing a mysql database. Everything seemed
    >>>>>> pretty simple but now when I try to run my app that uses the
    >>>>>> model,
    >>>>>> when I call DataContext.createDataContext(), it terminates my
    >>>>>> app.
    >>>>>> I've poked around a bit and the crash is actually happening in
    >>>>>> the
    >>>>>> SAXParserFactory.newInstance method that is called during the
    >>>>>> ConfigLoader initialization, specifically during the "parser =
    >>>>>> Util.createXmlReader();" call. Seems to be throwing a class not
    >>>>>> found exception but I can't be sure since it just ungracefully
    >>>>>> terminates the app with not stack dump. Anyway, that kind of
    >>>>>> puzzles me since my understanding was the all the SAX parser
    >>>>>> stuff
    >>>>>> came with java (I'm using 1.5 on Mac OS X 10.5). I thought it
    >>>>>> might
    >>>>>> be that it could be that it can't find my xml files but I tried
    >>>>>> just hard coding the path to the cayanne.xml file and it still
    >>>>>> does
    >>>>>> not work. Any help would be appreciated.
    >>>>>>
    >>>>>> jerald dawson
    >>>>>>
    >>>>>>
    >>>>
    >>>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Jul 01 2008 - 12:05:36 EDT