Re: problem creating standalone DataContext

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jan 04 2006 - 08:05:45 EST

  • Next message: Andrus Adamchik: "Re: Dynamic Data Maps"

    For Cayenne to load XML files from WEB-INF, a servlet container is
    required (i.e. an application lifecycle compatible with the servlet
    spec is assumed). In your JUnit environment you won't have that. A
    solution - put the XML files in CLASSPATH (wherever that might be).

    Andrus

    On Jan 4, 2006, at 6:22 AM, Lothar Krenzien wrote:

    > Hi there,
    >
    > for testing purposes (JUnit for example) I want to create a
    > DataContext using the following command:
    > DataContext.createDataContext().
    > But I get always an error like that "URL not found with
    > classloader: cayenne.xml" . I tried it also with these commands :
    > CayenneDataContextManager.createDataContext("LocalDomain")
    > DataContext.createDataContext()
    >
    > I have the cayenne.xml and LocalDomain.map.xml files in my Web-INF
    > dir and a copy in the root of the source dir. But nothing works.
    > When I create the DataContext from a request with the command
    > CayenneDataContextManager.getDataContext(ctx.getRequest())
    > it works fine. so what I'm doing wrong ?
    >
    > Thanks, Lothar



    This archive was generated by hypermail 2.0.0 : Wed Jan 04 2006 - 08:05:51 EST