Loading cayenne mapped class from URLClassLoader

From: rigel (zetata..mail.com)
Date: Sun Nov 23 2008 - 21:48:13 EST

  • Next message: rigel: "Re: Loading cayenne mapped class from URLClassLoader"

    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.SelectQuer..764be1[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.
    



    This archive was generated by hypermail 2.0.0 : Sun Nov 23 2008 - 21:48:50 EST