Re: ConfigurationException

From: Malcolm Edgar (malcolm.edga..mail.com)
Date: Mon Jul 16 2007 - 02:41:30 EDT

  • Next message: Andrus Adamchik: "Re: Modifying projects in Java"

    Hi Joe,

    With Cayenne web applications I would recommend that you use a filter in
    front of you application to set a the DataContext to a thread local
    variable.

    Cayenne provides such a filter out of the box.

    http://cayenne.apache.org/doc20/web-applications.html

    Please note this filter stores the DataContext in the user's session, so any
    uncommitted changes will be carried through to the next request, and may be
    committed later.

    regards Malcolm Edgar

    On 7/16/07, Joe Baldwin <jfbaldwi..arthlink.net> wrote:
    >
    > I have been converting a JSP project from JDBC to Cayenne for the
    > last few days. Everything has been going incredibly well: I used
    > CayenneModeler to convert my database and create Java classes. I
    > stored the configuration files in WEB-INF and everything has been
    > going great. I verified that the JSP was integrated with Cayenne,
    > Tomcat, & MySQL. I started experimenting with storing the DataContext
    > with the session and at some point Cayenne reported problems. So I
    > reverted back to the archived project that was working and now that
    > does not work anymore.
    >
    > I wrote an app that does not use JSP and it has no problems.
    >
    > I *suspect* that it might have something to do with the DataModeler
    > config files and Tomcat being out of sync but I am a bit unsure with
    > how to move forward with my testing.
    >
    > The trigger line in my JSP file is:
    > DataContext dataContext = DataContext.createDataContext();
    >
    > The current error reported by Tomcat is:
    >
    > org.apache.cayenne.ConfigurationException: [v.2.0.3 May 6 2007] Error
    > during Configuration initialization. [v.2.0.3 May 6 2007]
    > [org.apache.cayenne.conf.DefaultConfiguration] : Domain configuration
    > file "cayenne.xml" is not found.
    >
    > org.apache.cayenne.conf.Configuration.initializeSharedConfiguration
    > (Configuration.java:285)
    >
    > org.apache.cayenne.conf.Configuration.initializeSharedConfiguration
    > (Configuration.java:258)
    >
    > org.apache.cayenne.conf.Configuration.initializeSharedConfiguration
    > (Configuration.java:239)
    > org.apache.cayenne.conf.Configuration.getSharedConfiguration
    > (Configuration.java:176)
    > org.apache.cayenne.access.DataContext.createDataContext
    > (DataContext.java:206)
    > org.apache.jsp.Products_jsp._jspService(Products_jsp.java:145)
    >
    > As I said I have reverted back to my old project that I archived, but
    > am now getting this error from the project that functioned properly.
    > Also, as I said, similar but non-JSP code seems to work with no
    > problems.
    >
    > Second question: is there a singleton solution for accessing the same
    > DataContext instance from multiple JSP's?
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Jul 16 2007 - 02:41:55 EDT