This is a problem on all versions of Cayenne. Here is a patch that
explains the change. I will log it in Jira and apply to all versions.
Andrus
Index: cayenne-java/src/cayenne/java/org/objectstyle/cayenne/conf/
JNDIDataSourceFactory.java
===================================================================
--- cayenne-java/src/cayenne/java/org/objectstyle/cayenne/conf/
JNDIDataSourceFactory.java (revision 504920)
+++ cayenne-java/src/cayenne/java/org/objectstyle/cayenne/conf/
JNDIDataSourceFactory.java (working copy)
..-144,9 +144,10 @@
// as we don't want compile dependencies on the Modeler,
instantiate factory via
// reflection ...
+ ClassLoader loader = Thread.currentThread
().getContextClassLoader();
DataSourceFactory prefsFactory = (DataSourceFactory) Class
.forName(
-
"org.objectstyle.cayenne.modeler.pref.PreferencesDataSourceFactory")
+
"org.objectstyle.cayenne.modeler.pref.PreferencesDataSourceFactory",
true, loader)
.newInstance();
prefsFactory.initializeWithParentConfiguration(parentConfig);
On Feb 16, 2007, at 10:21 AM, Peter Schröder wrote:
> jey! kick ass! it works!
>
> what did you change? is it only a 1.2 problem?
>
> -----Ursprüngliche Nachricht-----
> Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
> Gesendet: Freitag, 16. Februar 2007 16:02
> An: use..ayenne.apache.org
> Betreff: Re: AW: AW: AW: cayenne with jetty6
>
>
> On Feb 16, 2007, at 3:57 AM, Peter Schröder wrote:
>
>> 16 Feb 2007 09:55:03.928 [INFO] [main]
>> [org.objectstyle.cayenne.conf.JNDIDataSourceFactory] - failed
>> loading from local preferences
>> java.lang.ClassCastException:
>> org.objectstyle.cayenne.modeler.pref.PreferencesDataSourceFactory
>> at
>> org.objectstyle.cayenne.conf.JNDIDataSourceFactory.loadFromPreference
>> s
>> (JNDIDataSourceFactory.java:147)
>> at org.objectstyle.cayenne.conf.JNDIDataSourceFactory.getDataSource
>> (JNDIDataSourceFactory.java:111)
>> at
>> org.objectstyle.cayenne.conf.RuntimeLoadDelegate.shouldLoadDataNode
>> (RuntimeLoadDelegate.java:324)
>> at org.objectstyle.cayenne.conf.ConfigLoader$NodeHandler.init
>> (ConfigLoader.java:366)
>> at org.objectstyle.cayenne.conf.ConfigLoader
>> $DomainHandler.startElement(ConfigLoader.java:255)
>> at org.apache.xerces.parsers.AbstractSAXParser.startElement
>> (Unknown Source)
>
> Cool, we are getting somewhere. Maven ClassLoaders are a mystery to
> me, but I think I might know the fix. Could you try this patched
> cayenne.jar and tell me if it works?
>
> http://people.apache.org/~aadamchik/patched/cayenne-1.2-02162007.jar
>
> Andrus
>
This archive was generated by hypermail 2.0.0 : Fri Feb 16 2007 - 10:36:36 EST