cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rigel <zeta...@gmail.com>
Subject Loading cayenne mapped class from URLClassLoader
Date Mon, 24 Nov 2008 02:48:13 GMT

Hello,

I am trying to load some "jarred" class mappings generated by Cayenne using
the URLClassLoader,
of course if I load all libs into the starting classloader all goes well,
but when I use the URLClassLoader
I receive the following error message suddenly after invoking
"context.performQuery(select1)" :

[v.2.0.4 October 8 2007] No DataMap found, can't route query
org.apache.cayenne.query.SelectQuery@1764be1[root=class ...]

My code:

		DataContext context = DataContext.createDataContext();
		
		URLClassLoader urlClassLoader = new URLClassLoader(remoteLibs);
		try {
			//Class<?> clzz =
Class.forName("org.someproject.SomeClass",true,urlClassLoader);
			Class<?> clzz = urlClassLoader.loadClass("org.someproject.SomeClass");
			Method m = clzz.getDeclaredMethod("executeCustom", new
Class[]{DataContext.class});
			m.invoke(null, new Object[]{context});
		} catch (Throwable e) {
			e.printStackTrace();
		}

Just to run it, where can I declare some local filesystem position to search
for XML data mappings?

P.S.
I noticed FileConfiguration.addResourcePath & co. but it works only if all
libraries are loaded
by the starting classloader

-- 
View this message in context: http://www.nabble.com/Loading-cayenne-mapped-class-from-URLClassLoader-tp20654024p20654024.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message