cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <jfbald...@earthlink.net>
Subject Re: Odd error
Date Mon, 06 Feb 2012 23:12:49 GMT
Andrus,

I think that issue was due to a possible problem with the server.xml file and the webhost's
unique dir structure (and the fact that they don't communicate very well).  But, I went ahead
and moved the files as you suggested.  There is no change (i.e. it works on my dev server)
and not on the webhost.

This is getting pretty serious, as I have the tech support basically telling me that it is
my code.  The argument that it is working on my dev server does not seem to have any weight,
and thus they are not doing much of anything.   They have an apache http front end server
that I cannot modify or even inspect the config files. I am limited to the Tomcat server.xml,
but I am just hacking because I have yet to see a proper installation.

Here is the major problem
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or
update a child row: a foreign key constraint fails (`eagle1_om28`.`product`, CONSTRAINT `product_ibfk_2`
FOREIGN KEY (`packageTypeOid`) REFERENCES `packagetype` (`oid`))
This occurs whenever I try to insert a new "Product".  The Product requires a "PackageType",
which is provided to it using a Cayenne query to the PackageType table for the first entry
in the list of package-types (essentially a default packagetype is provided at build time
to Product).

While this *appears* to be a logical problem and a cogent error message, I am not convinced.
 First, this has been working fine on another project (which I copied and modified to create
this project).  Second, when I try to commit a new Vendor entity, I get the *exact* same error
i.e. it is the Product error, *NOT* a similar Vendor error.  This suggests that something
is *really* messed up.

I am confused, so I am investigating low-probability theories:
1. Is it possible that I have a mistake in one of my cayenne config files that I copied to
create this project?
	a. here are the two map defs for product & pa
		1. <db-entity name="product" schema="eagle1_om28" catalog="cmswebsite">
		2. <db-entity name="packageType" schema="eagle1_om28">
	b. what is the "catalog"? Why is it not associated with packageType?  Does catalog need to
be unique if I have two cayenne webapps running on the same tomcat server?
2. Is it possible that there is some cached MySQL INSERT that has not been purged?  


Thanks in advance for your help.  I am getting very frustrated because I have absolutely no
idea how to debug this.  Select Queries run fine, but INSERT seems to cause this problem.

Joe





On Feb 6, 2012, at 2:13 AM, Andrus Adamchik wrote:

> Is this error still an issue: 
> 
>>>> Caused by: org.apache.cayenne.ConfigurationException: [v.3.0.1 Aug 25 2010
19:42:04] Can't open config file URL: jndi:/om28.com/store/WEB-INF/config/cayenne-files/cayenne.xml
> 
> ? 
> 
> If so, please follow my advise about the location of Cayenne files and then your Tomcat
settings should not matter anymore.
> 
> Andrus
> 
> On Feb 6, 2012, at 2:48 AM, Joe Baldwin wrote:
> 
>> Andrus,
>> 
>> Is there a webhost server setting that might account for this?  (I googled this problem
and the first results appears to point to webhost settings.   I, presumably, set account privileges
for the user, but this was through a 3rd party manager interface - which is always a bit unsettling
because you can't verify it.)
>> 
>> Here is the current error (which is really odd because it is working just fine on
my dev server)
>> 
>> com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot
add or update a child row: a foreign key constraint fails (`eagle1_om28`.`product`, CONSTRAINT
`product_ibfk_2` FOREIGN KEY (`packageTypeOid`) REFERENCES `packagetype` (`oid`))
>> 
>> Thanks
>> Joe
>> 
>> 
>> 
>> On Feb 5, 2012, at 2:29 AM, Andrus Adamchik wrote:
>> 
>>> While I don't know what the cause of the error is, my recommendation would be
to put all Cayenne files in CLASSPATH (e.g. WEB-INF/classes or in a jar under WEB-INF/lib).
This is much more portable across any Java environments.
>>> 
>>> Andrus
>>> 
>>> On Feb 4, 2012, at 7:40 PM, Joe Baldwin wrote:
>>> 
>>>> Here is more research on my "odd error".  
>>>> 
>>>> Production Server Env
>>>> 	Tomcat, linux, MySQL 5.1, Java 1.6
>>>> 	I only have control of tomcat config files & start/stop operations
>>>> 	**** I am using a *temp* configuration for installation and only have an
IP which I aliased to "om28.com" in my hosts file (a standard trick)
>>>> 
>>>> Symptoms & Research:
>>>> It appears that tomcat has logged a Cayenne configuration exception
>>>> 
>>>> 	Caused by: org.apache.cayenne.ConfigurationException: [v.3.0.1 Aug 25 2010
19:42:04] Can't open config file URL: jndi:/om28.com/store/WEB-INF/config/cayenne-files/cayenne.xml
>>>> 
>>>> Which seems to be accurate because that is not were I put the cayenne.xml
file.  Here is my web.xml entry for the app
>>>> 
>>>> 	<!-- Cayenne ORM -->
>>>> 	<context-param>
>>>> 		<param-name>cayenne.configuration.path</param-name>
>>>> 		<param-value>/WEB-INF/config/cayenne-files</param-value>
>>>> 	</context-param>
>>>> 	<filter>
>>>> 		<filter-name>CayenneFilter</filter-name>
>>>> 		<filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-class>
>>>> 	</filter>
>>>> 	<filter-mapping>
>>>> 		<filter-name>CayenneFilter</filter-name>
>>>> 		<url-pattern>/*</url-pattern>
>>>> 	</filter-mapping>
>>>> 
>>>> Questions:
>>>> 1. I have no understanding of why Cayenne would be looking for the xml file
in a path that included "store". Could this be a result of it getting confused by the alias
"om28.com"?
>>>> 2. I have a demo working on the same webhost, but as a subdomain. It is using,
I believe, the identical web.xml excerpt.  This same web.xml file is working on my development
server.  Is there a way to configure cayenne or the temp installation to make this work correctly
>>>> 3. Or, am I completely on the wrong track? :)
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Feb 3, 2012, at 2:35 PM, Joe Baldwin wrote:
>>>> 
>>>>> I am manually mirroring a test app (successfully tested on my dev tomcat),
onto a remote server.  I am getting an odd error and am having trouble tracking it down. (an
excerpt is listed below)
>>>>> While it is possible that I have made a mistake in my coding, it is not
likely since the associated code has been working for a while.  I have also been fighting
some tomcat caching problems, which I have resolved by deleting the tomcat cache for this
app each time I reload it.
>>>>> I have tried standard debugging on my dev server, but the error is not
showing up.  Also, it this error shows up mostly when I am adding the parent to which it is
referring, however, it also has just shown up at random when I make a simple query via cayenne.
>>>>> Is it possible that I have missed some configuration parameter in loading
my cayenne map? It is acting so odd that I am fairly convinced that this error message may
not be pointing to the actual error.  
>>>>> Totally confused. :)
>>>>> Thanks,
>>>>> Joe
>>>>> 
>>>>> 
>>>>> com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Cannot add or update a child row: a foreign key constraint fails 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


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