You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Joe Baldwin <jf...@earthlink.net> on 2007/07/15 23:39:00 UTC

ConfigurationException

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?



Re: ConfigurationException

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi,

> 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.

Could you doublecheck where your XML files are located (should be in  
WEB-INF or WEB-INF/classes)?

> Second question: is there a singleton solution for accessing the  
> same DataContext instance from multiple JSP's?

Totally... with a session pattern that won't be a singleton per se.  
Check out this page:

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

The filter setup would allow you to obtain a session DataContext with  
this code within JSP's:

     DataContext context = DataContext.getThreadDataContext();

Andrus


On Jul 16, 2007, at 12:39 AM, Joe Baldwin 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?
>
>


Re: ConfigurationException

Posted by Malcolm Edgar <ma...@gmail.com>.
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 <jf...@earthlink.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?
>
>
>