Fwd: Exception in SAXParserFactory.newInstance with 3.0M4

View: New views
11 Messages — Rating Filter:   Alert me  

Parent Message unknown Fwd: Exception in SAXParserFactory.newInstance with 3.0M4

by Jerald Dawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Moving this to the list:


Begin forwarded message:

> From: Jerald Dawson <jdawson@...>
> Date: July 1, 2008 10:49:20 AM CDT
> To: "Scott Anderson" <sanderson@...>
> Cc: "Andrus Adamchik" <andrus@...>
> 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:jdawson@...]
>> 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:jdawson@...]
>>> Sent: Monday, June 30, 2008 4:36 PM
>>> To: user@...
>>> 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
>>>>>
>>>>>
>>>
>>
>


RE: Exception in SAXParserFactory.newInstance with 3.0M4

by Scott A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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:jdawson@...]
Sent: Tuesday, July 01, 2008 11:52 AM
To: user@...
Subject: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4

Moving this to the list:


Begin forwarded message:

> From: Jerald Dawson <jdawson@...>
> Date: July 1, 2008 10:49:20 AM CDT
> To: "Scott Anderson" <sanderson@...>
> Cc: "Andrus Adamchik" <andrus@...>
> 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:jdawson@...]
>> 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:jdawson@...]
>>> Sent: Monday, June 30, 2008 4:36 PM
>>> To: user@...
>>> 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
>>>>>
>>>>>
>>>
>>
>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Andrus Adamchik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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:jdawson@...]
> Sent: Tuesday, July 01, 2008 11:52 AM
> To: user@...
> Subject: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4
>
> Moving this to the list:
>
>
> Begin forwarded message:
>
>> From: Jerald Dawson <jdawson@...>
>> Date: July 1, 2008 10:49:20 AM CDT
>> To: "Scott Anderson" <sanderson@...>
>> Cc: "Andrus Adamchik" <andrus@...>
>> 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:jdawson@...]
>>> 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:jdawson@...]
>>>> Sent: Monday, June 30, 2008 4:36 PM
>>>> To: user@...
>>>> 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
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Jerald Dawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is the version info for the cayenne-server.jar that I'm using:

cayenne.version = 3.0M4

# these properties are coming from maven-cayenne-build plugin.
cayenne.build.date = May 18 2008 15:54:38

Also, I tried adding the properties into the driver.xml manually and  
it still is giving me the NPE. I'm still not sure I'm not doing  
something stupid.

-j

On Jul 1, 2008, at 11:05 AM, Andrus Adamchik wrote:

> 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:jdawson@...]
>> Sent: Tuesday, July 01, 2008 11:52 AM
>> To: user@...
>> Subject: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4
>>
>> Moving this to the list:
>>
>>
>> Begin forwarded message:
>>
>>> From: Jerald Dawson <jdawson@...>
>>> Date: July 1, 2008 10:49:20 AM CDT
>>> To: "Scott Anderson" <sanderson@...>
>>> Cc: "Andrus Adamchik" <andrus@...>
>>> 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:jdawson@...]
>>>> 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:jdawson@...]
>>>>> Sent: Monday, June 30, 2008 4:36 PM
>>>>> To: user@...
>>>>> 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
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Jerald Dawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, more info. I have been stepping through the code to see what is  
actually throwing the NPE and I've come to this code in DataSourceInfo  
class:

     public PasswordEncoding getPasswordEncoder() {
         PasswordEncoding encoder = null;

         try {
             encoder = (PasswordEncoding) Thread
                     .currentThread()
                     .getContextClassLoader()
                     .loadClass(getPasswordEncoderClass())
                     .newInstance();
             // encoder = (PasswordEncoding)
             // Class.forName(getPasswordEncoderClass()).newInstance();
         }
...

Now following the code, I notice that the getContextClassLoader call  
returns null which seems to be the source of the NPE. Is there a  
reason getContextClassLoader would be returning null?

BTW, I'm using SWT if that is pertinent.

-j

On Jul 1, 2008, at 11:05 AM, Andrus Adamchik wrote:

> 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:jdawson@...]
>> Sent: Tuesday, July 01, 2008 11:52 AM
>> To: user@...
>> Subject: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4
>>
>> Moving this to the list:
>>
>>
>> Begin forwarded message:
>>
>>> From: Jerald Dawson <jdawson@...>
>>> Date: July 1, 2008 10:49:20 AM CDT
>>> To: "Scott Anderson" <sanderson@...>
>>> Cc: "Andrus Adamchik" <andrus@...>
>>> 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:jdawson@...]
>>>> 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:jdawson@...]
>>>>> Sent: Monday, June 30, 2008 4:36 PM
>>>>> To: user@...
>>>>> 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
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Andrus Adamchik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> BTW, I'm using SWT if that is pertinent.

It probably is. The ClassLoader settings are likely different.

Anyways the code in question does look suspect. I implemented a bit  
more paranoid version of this method (without actually knowing whether  
null values are valid here or not). The code is checked in to trunk,  
and you may try this cayenne-server.jar that contains the fix:

http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008.jar

Andrus




On Jul 1, 2008, at 9:02 PM, Jerald Dawson wrote:

> Ok, more info. I have been stepping through the code to see what is  
> actually throwing the NPE and I've come to this code in  
> DataSourceInfo class:
>
>   public PasswordEncoding getPasswordEncoder() {
>       PasswordEncoding encoder = null;
>
>       try {
>           encoder = (PasswordEncoding) Thread
>                   .currentThread()
>                   .getContextClassLoader()
>                   .loadClass(getPasswordEncoderClass())
>                   .newInstance();
>           // encoder = (PasswordEncoding)
>           // Class.forName(getPasswordEncoderClass()).newInstance();
>       }
> ...
>
> Now following the code, I notice that the getContextClassLoader call  
> returns null which seems to be the source of the NPE. Is there a  
> reason getContextClassLoader would be returning null?
>
> BTW, I'm using SWT if that is pertinent.




Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Jerald Dawson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Andrus

I got through that exception but now am getting another one where the  
org.apache.cayenne.conn.DriverDataSource is trying to load the jdbc  
driver class. I looked in the source and see that it is similar to the  
other code we were having issues with so I'm wondering if its the same  
thing. Here is the code in question where the exception is happening:

    private static Driver loadDriver(String driverClassName) throws  
SQLException {

         Class<?> driverClass;
         try {
             driverClass = Class.forName(driverClassName, true, Thread
                     .currentThread()
                     .getContextClassLoader());
         }
         catch (Exception ex) {
             throw new SQLException("Can not load JDBC driver named '"
                     + driverClassName
                     + "': "
                     + ex.getMessage());
         }
...

And here is the stack from the exception:
INFO: *** Connecting: FAILURE.
java.sql.SQLException: Can not load JDBC driver named  
'com.mysql.jdbc.Driver': com/mysql/jdbc/Driver
        at  
org
.apache.cayenne.conn.DriverDataSource.loadDriver(DriverDataSource.java:
62)
        at  
org
.apache
.cayenne
.conn.DriverDataSource.setDriverClassName(DriverDataSource.java:256)

As you can see, driverClass is again using getContextClassLoad from  
Thread,currentThread(). Not 100% sure that its the issue but it seems  
reasonable. Also, I have verified that the mysql jars are in my  
classpath. Also, modeler seems to see it fine and is able to access my  
database.

jerald dawson

On Jul 1, 2008, at 1:18 PM, Andrus Adamchik wrote:

>> BTW, I'm using SWT if that is pertinent.
>
> It probably is. The ClassLoader settings are likely different.
>
> Anyways the code in question does look suspect. I implemented a bit  
> more paranoid version of this method (without actually knowing  
> whether null values are valid here or not). The code is checked in  
> to trunk, and you may try this cayenne-server.jar that contains the  
> fix:
>
> http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008.jar
>
> Andrus
>
>
>
>
> On Jul 1, 2008, at 9:02 PM, Jerald Dawson wrote:
>
>> Ok, more info. I have been stepping through the code to see what is  
>> actually throwing the NPE and I've come to this code in  
>> DataSourceInfo class:
>>
>>  public PasswordEncoding getPasswordEncoder() {
>>      PasswordEncoding encoder = null;
>>
>>      try {
>>          encoder = (PasswordEncoding) Thread
>>                  .currentThread()
>>                  .getContextClassLoader()
>>                  .loadClass(getPasswordEncoderClass())
>>                  .newInstance();
>>          // encoder = (PasswordEncoding)
>>          // Class.forName(getPasswordEncoderClass()).newInstance();
>>      }
>> ...
>>
>> Now following the code, I notice that the getContextClassLoader  
>> call returns null which seems to be the source of the NPE. Is there  
>> a reason getContextClassLoader would be returning null?
>>
>> BTW, I'm using SWT if that is pertinent.
>
>


RE: Exception in SAXParserFactory.newInstance with 3.0M4

by Scott A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jerald,

If this is a similar ClassLoader issue, you can try explicitly sending a
(String)null to Cayenne for the driver name, forcing it to go through
the DriverManger, with which you will register your JDBC driver.

I have a similar situation in one of my applications, except that I am
forcing Cayenne to go through a different ClassLoader than the JVM's
default. You have the exact opposite case from mine, but my solution
should work for you as well, as long as you're able to instantiate the
JDBC driver.

http://bnubot.googlecode.com/svn/trunk/BNUBot/src/net/bnubot/db/conf/Cay
enneConfiguration.java


HTH,
Scott

-----Original Message-----
From: Jerald Dawson [mailto:jdawson@...]
Sent: Tuesday, July 01, 2008 2:44 PM
To: user@...
Subject: Re: Exception in SAXParserFactory.newInstance with 3.0M4

Thanks Andrus

I got through that exception but now am getting another one where the  
org.apache.cayenne.conn.DriverDataSource is trying to load the jdbc  
driver class. I looked in the source and see that it is similar to the  
other code we were having issues with so I'm wondering if its the same  
thing. Here is the code in question where the exception is happening:

    private static Driver loadDriver(String driverClassName) throws  
SQLException {

         Class<?> driverClass;
         try {
             driverClass = Class.forName(driverClassName, true, Thread
                     .currentThread()
                     .getContextClassLoader());
         }
         catch (Exception ex) {
             throw new SQLException("Can not load JDBC driver named '"
                     + driverClassName
                     + "': "
                     + ex.getMessage());
         }
...

And here is the stack from the exception:
INFO: *** Connecting: FAILURE.
java.sql.SQLException: Can not load JDBC driver named  
'com.mysql.jdbc.Driver': com/mysql/jdbc/Driver
        at  
org
.apache.cayenne.conn.DriverDataSource.loadDriver(DriverDataSource.java:
62)
        at  
org
.apache
.cayenne
.conn.DriverDataSource.setDriverClassName(DriverDataSource.java:256)

As you can see, driverClass is again using getContextClassLoad from  
Thread,currentThread(). Not 100% sure that its the issue but it seems  
reasonable. Also, I have verified that the mysql jars are in my  
classpath. Also, modeler seems to see it fine and is able to access my  
database.

jerald dawson

On Jul 1, 2008, at 1:18 PM, Andrus Adamchik wrote:

>> BTW, I'm using SWT if that is pertinent.
>
> It probably is. The ClassLoader settings are likely different.
>
> Anyways the code in question does look suspect. I implemented a bit  
> more paranoid version of this method (without actually knowing  
> whether null values are valid here or not). The code is checked in  
> to trunk, and you may try this cayenne-server.jar that contains the  
> fix:
>
>
http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008.
jar

>
> Andrus
>
>
>
>
> On Jul 1, 2008, at 9:02 PM, Jerald Dawson wrote:
>
>> Ok, more info. I have been stepping through the code to see what is  
>> actually throwing the NPE and I've come to this code in  
>> DataSourceInfo class:
>>
>>  public PasswordEncoding getPasswordEncoder() {
>>      PasswordEncoding encoder = null;
>>
>>      try {
>>          encoder = (PasswordEncoding) Thread
>>                  .currentThread()
>>                  .getContextClassLoader()
>>                  .loadClass(getPasswordEncoderClass())
>>                  .newInstance();
>>          // encoder = (PasswordEncoding)
>>          // Class.forName(getPasswordEncoderClass()).newInstance();
>>      }
>> ...
>>
>> Now following the code, I notice that the getContextClassLoader  
>> call returns null which seems to be the source of the NPE. Is there  
>> a reason getContextClassLoader would be returning null?
>>
>> BTW, I'm using SWT if that is pertinent.
>
>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Andrus Adamchik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't have SWT experience, but clearly thread ClassLoader is not  
present there by default. I hope otherwise the structure is flat and  
there is no nested CL. Anyways, I committed the fix. The link to the  
patched jar is the same:

    http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008.jar

Don't have time now to check what other places reference the thread CL.

(but of course there's always an option to do this:  
Thread
.currentThread
().setContextClassLoader(myclass.getClass().getClassLoader()))

Andrus

On Jul 1, 2008, at 9:51 PM, Scott Anderson wrote:

> Jerald,
>
> If this is a similar ClassLoader issue, you can try explicitly  
> sending a
> (String)null to Cayenne for the driver name, forcing it to go through
> the DriverManger, with which you will register your JDBC driver.
>
> I have a similar situation in one of my applications, except that I am
> forcing Cayenne to go through a different ClassLoader than the JVM's
> default. You have the exact opposite case from mine, but my solution
> should work for you as well, as long as you're able to instantiate the
> JDBC driver.
>
> http://bnubot.googlecode.com/svn/trunk/BNUBot/src/net/bnubot/db/conf/Cay
> enneConfiguration.java
>
>
> HTH,
> Scott
>
> -----Original Message-----
> From: Jerald Dawson [mailto:jdawson@...]
> Sent: Tuesday, July 01, 2008 2:44 PM
> To: user@...
> Subject: Re: Exception in SAXParserFactory.newInstance with 3.0M4
>
> Thanks Andrus
>
> I got through that exception but now am getting another one where the
> org.apache.cayenne.conn.DriverDataSource is trying to load the jdbc
> driver class. I looked in the source and see that it is similar to the
> other code we were having issues with so I'm wondering if its the same
> thing. Here is the code in question where the exception is happening:
>
>    private static Driver loadDriver(String driverClassName) throws
> SQLException {
>
>         Class<?> driverClass;
>         try {
>             driverClass = Class.forName(driverClassName, true, Thread
>                     .currentThread()
>                     .getContextClassLoader());
>         }
>         catch (Exception ex) {
>             throw new SQLException("Can not load JDBC driver named '"
>                     + driverClassName
>                     + "': "
>                     + ex.getMessage());
>         }
> ...
>
> And here is the stack from the exception:
> INFO: *** Connecting: FAILURE.
> java.sql.SQLException: Can not load JDBC driver named
> 'com.mysql.jdbc.Driver': com/mysql/jdbc/Driver
> at
> org
> .apache
> .cayenne.conn.DriverDataSource.loadDriver(DriverDataSource.java:
> 62)
> at
> org
> .apache
> .cayenne
> .conn.DriverDataSource.setDriverClassName(DriverDataSource.java:256)
>
> As you can see, driverClass is again using getContextClassLoad from
> Thread,currentThread(). Not 100% sure that its the issue but it seems
> reasonable. Also, I have verified that the mysql jars are in my
> classpath. Also, modeler seems to see it fine and is able to access my
> database.
>
> jerald dawson
>
> On Jul 1, 2008, at 1:18 PM, Andrus Adamchik wrote:
>
>>> BTW, I'm using SWT if that is pertinent.
>>
>> It probably is. The ClassLoader settings are likely different.
>>
>> Anyways the code in question does look suspect. I implemented a bit
>> more paranoid version of this method (without actually knowing
>> whether null values are valid here or not). The code is checked in
>> to trunk, and you may try this cayenne-server.jar that contains the
>> fix:
>>
>>
> http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008 
> .
> jar
>>
>> Andrus
>>
>>
>>
>>
>> On Jul 1, 2008, at 9:02 PM, Jerald Dawson wrote:
>>
>>> Ok, more info. I have been stepping through the code to see what is
>>> actually throwing the NPE and I've come to this code in
>>> DataSourceInfo class:
>>>
>>> public PasswordEncoding getPasswordEncoder() {
>>>     PasswordEncoding encoder = null;
>>>
>>>     try {
>>>         encoder = (PasswordEncoding) Thread
>>>                 .currentThread()
>>>                 .getContextClassLoader()
>>>                 .loadClass(getPasswordEncoderClass())
>>>                 .newInstance();
>>>         // encoder = (PasswordEncoding)
>>>         // Class.forName(getPasswordEncoderClass()).newInstance();
>>>     }
>>> ...
>>>
>>> Now following the code, I notice that the getContextClassLoader
>>> call returns null which seems to be the source of the NPE. Is there
>>> a reason getContextClassLoader would be returning null?
>>>
>>> BTW, I'm using SWT if that is pertinent.
>>
>>
>
>


Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Jerald Dawson :: Rate this Message: