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 2012/02/03 20:35:25 UTC

Odd error

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 



Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Feb 8, 2012, at 9:37 PM, Joe Baldwin wrote:

> Does anyone have a clue as to what happened here, or should I just pour myself a beer a call it "done". :) 

I am fairy sure Cayenne logging being on or off has nothing to do with it. My guess (not knowing much about your deployment environment) is that there are some partial deploy problems with app being in inconsistent state. 

Stopping Tomcat, completely removing its work/ directory (among other things this kills previously serialized sessions), and the contents of webapps/, then deploying a fresh war and starting Tomcat back again should probably be the first step whenever such unpredictable behavior occurs. (the folders to delete are for the default Tomcat layout; of course things may live in other places if Tomcat was customized).

And then check the logs... As was mentioned in this thread, any Cayenne-originated DB exception should be preceded by the SQL statement(s) generated by Cayenne that caused the error. So it should be easy to trace the history. 

Andrus


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Problem Statement: Seemingly misleading FK exception from MySQL on production server
Repeatability: 100% on the production server, 0% on the dev server
Status:  It appears the theory of multiple universes could be part of the solution set :)

****** New Test:
1. After setting Cayenne logging to DEBUG (in the last test) => the FK error disappeared mysteriously (leaving me nonplused)
2. So I resorted to hacking.  
3. Since I had initially duplicated the Database via a MySQL dump, I decided to do it a different way.
	a. I saved the Cayenne generated DB struct to a sql file and ran it.
	b. I saved the Database data to a separate sql file an ran it.
	c. I deleted all the cache files (that I could find)
	d. I commented out the Cayenne logging directive
	d. I restarted tomcat
4. Results: The FK problem has not occurred after 5 tests.

Does anyone have a clue as to what happened here, or should I just pour myself a beer a call it "done". :)  My current (unsubstantiated) theory is the the Cayenne logging directive somehow "cleared the drains", but I am unsatisfied with this "work boot" theory.

Thanks for all the patient comments.
Joe




On Feb 8, 2012, at 12:14 PM, Durchholz, Joachim wrote:

>> One thing you can do is to insert the P6Spy database driver into your app
>> -- this jdbc driver wrapper will provide logging at the jdbc level, which
>> would let you see what's going on without having to enable java logging.
> 
> To see what part of the application is issuing the request, you could take the sources (available from http://p6spy.svn.sourceforge.net/viewvc/p6spy/trunk/src/main/java ) and insert logging of stack traces. That should at least point you in the direction what's responsible.
> 
> There's actually (commented-out) code for that in com/p6spy/engine/common/P6LogQuery.java.
> Maybe do that only if the statement is the one that shouldn't happen so you don't get huge logs.
> 
> HTH
> Jo


RE: Odd error

Posted by "Durchholz, Joachim" <Jo...@hennig-fahrzeugteile.de>.
> One thing you can do is to insert the P6Spy database driver into your app
> -- this jdbc driver wrapper will provide logging at the jdbc level, which
> would let you see what's going on without having to enable java logging.

To see what part of the application is issuing the request, you could take the sources (available from http://p6spy.svn.sourceforge.net/viewvc/p6spy/trunk/src/main/java ) and insert logging of stack traces. That should at least point you in the direction what's responsible.

There's actually (commented-out) code for that in com/p6spy/engine/common/P6LogQuery.java.
Maybe do that only if the statement is the one that shouldn't happen so you don't get huge logs.

HTH
Jo

Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
I will look into P6Spy, and post the results.

Thanks
Joe



On Feb 8, 2012, at 11:58 AM, Mike Kienenberger wrote:

> I was just trying to restate what other people said.   I don't have
> anything original to add, unfortunately.
> 
> One thing you can do is to insert the P6Spy database driver into your
> app -- this jdbc driver wrapper will provide logging at the jdbc
> level, which would let you see what's going on without having to
> enable java logging.
> 
> Mysql might also have the ability to log but I'm not really familiar with it.
> 
> On Wed, Feb 8, 2012 at 11:51 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>>> And your next step is to determine how the sort orderings are different (by looking at the log results), determine why a certain sort causes a problem,
>> 
>> OK, but I have absolutely no idea what you are talking about. :)  More importantly, I am not sure if I have described the test results well enough. Let me try again:
>> 
>> Succinct Problem Symptoms (to date)
>> 1. The FK error is generated 100% of the time (not intermittently) when I tried to add a Product entity.  In addition, simply logging into to my app (accessing the admin table), trigger the FK error for the Product - which was totally illogical since logging into admin does not INSERT a Product entity.
>> 2. I restarted tomcat and did a recursive "touch" on the JSP dir each time I performed the test to presumably clear out the memory and cache.
>> 3. The ONLY condition that results in a successful test is to use my development tomcat (on my OSX laptop), or set Cayenne logging to DEBUG on the production machine.
>> 
>> Confusion:
>> 1. I do not know how these symptoms  might point to a "sort ordering" issue based on the available test results.
>> 2. If the problem *NEVER* occurs while logging is set to DEBUG, then how would I check the logs as you suggest?
>> 
>> This is why I have suggested that this problem is "insane"; This is sort of like a perverted Heisenberg Uncertainty Principle. :)
>> 
>> Question (Based on the "DEBUG Uncertainty Principle"):
>> 1. If the FK problem ONLY occurs with DEBUG set to FALSE then I have limited visibility into the problem.
>> 2. If I set DEBUG to TRUE all the time, then I am concerned I am simply hiding a bug.
>> 3. Of course, if I set DEBUG to TRUE, then it is "Miller Time" :)
>> 
>> I have the feeling like some configuration file parameter might be corrupted.  If nobody has any other ideas (give the visibility constraints), then I guess I will try to rebuild the project cayenne config files from scratch and hack it into submission. :)  (Not looking forward to this option.)
>> 
>> Thanks
>> Joe
>> 
>> 
>> 
>> On Feb 8, 2012, at 11:18 AM, Mike Kienenberger wrote:
>> 
>>> Oops.  Didn't finish.
>>> 
>>> And your next step is to determine how the sort orderings are
>>> different (by looking at the log results), determine why a certain
>>> sort causes a problem, and then subclass the sorter to insure it sorts
>>> in a consistently-valid manner each time.
>>> 
>>> On Wed, Feb 8, 2012 at 11:15 AM, Mike Kienenberger <mk...@gmail.com> wrote:
>>>> I think what Michael is saying is that the ashwood sorter isn't
>>>> guaranteed to return the same results for the same commit operation on
>>>> the next run after the application is restarted.   So setting the
>>>> logging wasn't what caused the change -- it was restarting the app.
>>>> 
>>>> On Wed, Feb 8, 2012 at 11:02 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>> Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?
>>>>> 
>>>>> More info:
>>>>> Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.
>>>>> 
>>>>> On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:
>>>>> 
>>>>>> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>>>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
>>>>>> 
>>>>>> I actually think you want INFO instead of DEBUG.
>>>>>> 
>>>>>> 
>>>>>>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>>>>>>        - detail: it added the Product, there was no Exception
>>>>>>>        - I verified the Product by listing all of my products
>>>>>>> 
>>>>>>> So, is this 1. Insane, or 2. totally Insane?
>>>>>> 
>>>>>> I've seen AshwoodEntitySorter produce different insert orderings
>>>>>> before from different starts.  Since you shutdown the application, AES
>>>>>> would have to produce a new dependency graph on startup.  I'm not
>>>>>> saying this is responsible, but it is a possibility.  So: 0. Maybe not
>>>>>> insane.  :-)
>>>>>> 
>>>>>> mrg
>>>>> 
>> 


Re: Odd error

Posted by Mike Kienenberger <mk...@gmail.com>.
I was just trying to restate what other people said.   I don't have
anything original to add, unfortunately.

One thing you can do is to insert the P6Spy database driver into your
app -- this jdbc driver wrapper will provide logging at the jdbc
level, which would let you see what's going on without having to
enable java logging.

Mysql might also have the ability to log but I'm not really familiar with it.

On Wed, Feb 8, 2012 at 11:51 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>> And your next step is to determine how the sort orderings are different (by looking at the log results), determine why a certain sort causes a problem,
>
> OK, but I have absolutely no idea what you are talking about. :)  More importantly, I am not sure if I have described the test results well enough. Let me try again:
>
> Succinct Problem Symptoms (to date)
> 1. The FK error is generated 100% of the time (not intermittently) when I tried to add a Product entity.  In addition, simply logging into to my app (accessing the admin table), trigger the FK error for the Product - which was totally illogical since logging into admin does not INSERT a Product entity.
> 2. I restarted tomcat and did a recursive "touch" on the JSP dir each time I performed the test to presumably clear out the memory and cache.
> 3. The ONLY condition that results in a successful test is to use my development tomcat (on my OSX laptop), or set Cayenne logging to DEBUG on the production machine.
>
> Confusion:
> 1. I do not know how these symptoms  might point to a "sort ordering" issue based on the available test results.
> 2. If the problem *NEVER* occurs while logging is set to DEBUG, then how would I check the logs as you suggest?
>
> This is why I have suggested that this problem is "insane"; This is sort of like a perverted Heisenberg Uncertainty Principle. :)
>
> Question (Based on the "DEBUG Uncertainty Principle"):
> 1. If the FK problem ONLY occurs with DEBUG set to FALSE then I have limited visibility into the problem.
> 2. If I set DEBUG to TRUE all the time, then I am concerned I am simply hiding a bug.
> 3. Of course, if I set DEBUG to TRUE, then it is "Miller Time" :)
>
> I have the feeling like some configuration file parameter might be corrupted.  If nobody has any other ideas (give the visibility constraints), then I guess I will try to rebuild the project cayenne config files from scratch and hack it into submission. :)  (Not looking forward to this option.)
>
> Thanks
> Joe
>
>
>
> On Feb 8, 2012, at 11:18 AM, Mike Kienenberger wrote:
>
>> Oops.  Didn't finish.
>>
>> And your next step is to determine how the sort orderings are
>> different (by looking at the log results), determine why a certain
>> sort causes a problem, and then subclass the sorter to insure it sorts
>> in a consistently-valid manner each time.
>>
>> On Wed, Feb 8, 2012 at 11:15 AM, Mike Kienenberger <mk...@gmail.com> wrote:
>>> I think what Michael is saying is that the ashwood sorter isn't
>>> guaranteed to return the same results for the same commit operation on
>>> the next run after the application is restarted.   So setting the
>>> logging wasn't what caused the change -- it was restarting the app.
>>>
>>> On Wed, Feb 8, 2012 at 11:02 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>> Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?
>>>>
>>>> More info:
>>>> Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.
>>>>
>>>> On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:
>>>>
>>>>> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
>>>>>
>>>>> I actually think you want INFO instead of DEBUG.
>>>>>
>>>>>
>>>>>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>>>>>        - detail: it added the Product, there was no Exception
>>>>>>        - I verified the Product by listing all of my products
>>>>>>
>>>>>> So, is this 1. Insane, or 2. totally Insane?
>>>>>
>>>>> I've seen AshwoodEntitySorter produce different insert orderings
>>>>> before from different starts.  Since you shutdown the application, AES
>>>>> would have to produce a new dependency graph on startup.  I'm not
>>>>> saying this is responsible, but it is a possibility.  So: 0. Maybe not
>>>>> insane.  :-)
>>>>>
>>>>> mrg
>>>>
>

Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
> And your next step is to determine how the sort orderings are different (by looking at the log results), determine why a certain sort causes a problem,

OK, but I have absolutely no idea what you are talking about. :)  More importantly, I am not sure if I have described the test results well enough. Let me try again:

Succinct Problem Symptoms (to date)
1. The FK error is generated 100% of the time (not intermittently) when I tried to add a Product entity.  In addition, simply logging into to my app (accessing the admin table), trigger the FK error for the Product - which was totally illogical since logging into admin does not INSERT a Product entity.
2. I restarted tomcat and did a recursive "touch" on the JSP dir each time I performed the test to presumably clear out the memory and cache.
3. The ONLY condition that results in a successful test is to use my development tomcat (on my OSX laptop), or set Cayenne logging to DEBUG on the production machine.

Confusion:
1. I do not know how these symptoms  might point to a "sort ordering" issue based on the available test results.
2. If the problem *NEVER* occurs while logging is set to DEBUG, then how would I check the logs as you suggest?

This is why I have suggested that this problem is "insane"; This is sort of like a perverted Heisenberg Uncertainty Principle. :)

Question (Based on the "DEBUG Uncertainty Principle"):
1. If the FK problem ONLY occurs with DEBUG set to FALSE then I have limited visibility into the problem.
2. If I set DEBUG to TRUE all the time, then I am concerned I am simply hiding a bug.
3. Of course, if I set DEBUG to TRUE, then it is "Miller Time" :)

I have the feeling like some configuration file parameter might be corrupted.  If nobody has any other ideas (give the visibility constraints), then I guess I will try to rebuild the project cayenne config files from scratch and hack it into submission. :)  (Not looking forward to this option.)

Thanks
Joe



On Feb 8, 2012, at 11:18 AM, Mike Kienenberger wrote:

> Oops.  Didn't finish.
> 
> And your next step is to determine how the sort orderings are
> different (by looking at the log results), determine why a certain
> sort causes a problem, and then subclass the sorter to insure it sorts
> in a consistently-valid manner each time.
> 
> On Wed, Feb 8, 2012 at 11:15 AM, Mike Kienenberger <mk...@gmail.com> wrote:
>> I think what Michael is saying is that the ashwood sorter isn't
>> guaranteed to return the same results for the same commit operation on
>> the next run after the application is restarted.   So setting the
>> logging wasn't what caused the change -- it was restarting the app.
>> 
>> On Wed, Feb 8, 2012 at 11:02 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>>> Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?
>>> 
>>> More info:
>>> Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.
>>> 
>>> On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:
>>> 
>>>> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
>>>> 
>>>> I actually think you want INFO instead of DEBUG.
>>>> 
>>>> 
>>>>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>>>>        - detail: it added the Product, there was no Exception
>>>>>        - I verified the Product by listing all of my products
>>>>> 
>>>>> So, is this 1. Insane, or 2. totally Insane?
>>>> 
>>>> I've seen AshwoodEntitySorter produce different insert orderings
>>>> before from different starts.  Since you shutdown the application, AES
>>>> would have to produce a new dependency graph on startup.  I'm not
>>>> saying this is responsible, but it is a possibility.  So: 0. Maybe not
>>>> insane.  :-)
>>>> 
>>>> mrg
>>> 


Re: Odd error

Posted by Mike Kienenberger <mk...@gmail.com>.
Oops.  Didn't finish.

And your next step is to determine how the sort orderings are
different (by looking at the log results), determine why a certain
sort causes a problem, and then subclass the sorter to insure it sorts
in a consistently-valid manner each time.

On Wed, Feb 8, 2012 at 11:15 AM, Mike Kienenberger <mk...@gmail.com> wrote:
> I think what Michael is saying is that the ashwood sorter isn't
> guaranteed to return the same results for the same commit operation on
> the next run after the application is restarted.   So setting the
> logging wasn't what caused the change -- it was restarting the app.
>
> On Wed, Feb 8, 2012 at 11:02 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>> Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?
>>
>> More info:
>> Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.
>>
>> On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:
>>
>>> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
>>>
>>> I actually think you want INFO instead of DEBUG.
>>>
>>>
>>>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>>>        - detail: it added the Product, there was no Exception
>>>>        - I verified the Product by listing all of my products
>>>>
>>>> So, is this 1. Insane, or 2. totally Insane?
>>>
>>> I've seen AshwoodEntitySorter produce different insert orderings
>>> before from different starts.  Since you shutdown the application, AES
>>> would have to produce a new dependency graph on startup.  I'm not
>>> saying this is responsible, but it is a possibility.  So: 0. Maybe not
>>> insane.  :-)
>>>
>>> mrg
>>

Re: Odd error

Posted by Mike Kienenberger <mk...@gmail.com>.
I think what Michael is saying is that the ashwood sorter isn't
guaranteed to return the same results for the same commit operation on
the next run after the application is restarted.   So setting the
logging wasn't what caused the change -- it was restarting the app.

On Wed, Feb 8, 2012 at 11:02 AM, Joe Baldwin <jf...@earthlink.net> wrote:
> Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?
>
> More info:
> Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.
>
> On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:
>
>> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
>>
>> I actually think you want INFO instead of DEBUG.
>>
>>
>>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>>        - detail: it added the Product, there was no Exception
>>>        - I verified the Product by listing all of my products
>>>
>>> So, is this 1. Insane, or 2. totally Insane?
>>
>> I've seen AshwoodEntitySorter produce different insert orderings
>> before from different starts.  Since you shutdown the application, AES
>> would have to produce a new dependency graph on startup.  I'm not
>> saying this is responsible, but it is a possibility.  So: 0. Maybe not
>> insane.  :-)
>>
>> mrg
>

Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Well, if it is not "insane", then what should I do?  I mean if the app only works correctly when logging is set to DEBUG then I would think that indicates a problems.  I could run the app with DEBUG on all the time, but that would just be covering up what I would assume is a serious problem.  What should I do next to debug this problem?

More info:
Each time I update my project jar file, I do a recursive "touch" (which I have found forces tomcat to recompile all the jsp's and recognize the new jar file).  After this, I restart tomcat.  There was a problem with the webhost's configuration of tomcat caching static variables from the previous jar file into jsp static non-variables.   I would *presume* this would clear out everything, but maybe not.

On Feb 8, 2012, at 9:14 AM, Michael Gentry wrote:

> On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
> 
> I actually think you want INFO instead of DEBUG.
> 
> 
>> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>>        - detail: it added the Product, there was no Exception
>>        - I verified the Product by listing all of my products
>> 
>> So, is this 1. Insane, or 2. totally Insane?
> 
> I've seen AshwoodEntitySorter produce different insert orderings
> before from different starts.  Since you shutdown the application, AES
> would have to produce a new dependency graph on startup.  I'm not
> saying this is responsible, but it is a possibility.  So: 0. Maybe not
> insane.  :-)
> 
> mrg


Re: Odd error

Posted by Michael Gentry <mg...@masslight.net>.
On Tue, Feb 7, 2012 at 6:03 PM, Joe Baldwin <jf...@earthlink.net> wrote:
> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)

I actually think you want INFO instead of DEBUG.


> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
>        - detail: it added the Product, there was no Exception
>        - I verified the Product by listing all of my products
>
> So, is this 1. Insane, or 2. totally Insane?

I've seen AshwoodEntitySorter produce different insert orderings
before from different starts.  Since you shutdown the application, AES
would have to produce a new dependency graph on startup.  I'm not
saying this is responsible, but it is a possibility.  So: 0. Maybe not
insane.  :-)

mrg

Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
So does that mean that the logging works now? That would be a good outcome in itself :)

> Before I deleted the log file, I noticed an entry that said something about not properly closing the JDBC something-R-other.  But it has not re-appeared. This is curious because I had theorized that the weirdo Exception was from a cached INSERT that was erroneously re-submitted to MySQL.

Tomcat 6 and 7 have this cool functionality detecting resource leaks during app undeploy. It is absolutely important to clean up all those if you are doing hot redeploys (swapping apps without restarting Tomcat), or otherwise Tomcat will crash with OutOfMemory at some point. If you restart Tomcat every time, it is less important, but still a good practice never the less.

As far as Cayenne is concerned, it needs to shut down the connection pool if Cayenne started it (i.e. if it is not JNDI), shut down EventManager threads, etc. WebApplicationContextFilter in 3.0.1 does all this in 'destroy' method:

    public void destroy() {
        Configuration config = Configuration.getSharedConfiguration();
        if (config != null) {
            config.shutdown();
        }
    }

But there is a chance that we overlooked proper shutdown hooks in certain configurations. So if you get those messages again, please let us know here or open a Jira with details.

Thanks,
Andrus


On Feb 8, 2012, at 2:03 AM, Joe Baldwin wrote:
> Hey Andrus,
> 
> Did you ever see the Twilight Zone?   Well get ready for this one.
> 
> 1. It took me a while to figure out out to get the logging running, and it turns out the the webhost already has it in the tomcat path (but it is sort of hidden, and they don't, of course, tell you anything about it).
> 2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
> 3. So then I deleted the logfile and restart tomcat
> 4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
> 	- detail: it added the Product, there was no Exception
> 	- I verified the Product by listing all of my products
> 
> So, is this 1. Insane, or 2. totally Insane?
> 
> NOTE:
> Before I deleted the log file, I noticed an entry that said something about not properly closing the JDBC something-R-other.  But it has not re-appeared. This is curious because I had theorized that the weirdo Exception was from a cached INSERT that was erroneously re-submitted to MySQL.
> 
> So, I am voting for "totally insane".  If you have any ideas I would LOVE to hear them - and would like to know what to do. :)  Am I going to have to run the app in debug mode to get it to work?
> 
> Thanks,
> Joe
> 
> 
> 
> 
> 
> 
> 
> On Feb 7, 2012, at 2:28 PM, Andrus Adamchik wrote:
> 
>> The simplest thing you can do is add log4J jar to your app, and add this somewhere on app startup (e.g. a filter or servlet init method, etc) : 
>> 
>>   BasicConfigurator.configure();
>> 
>> To fine-tune logging you may switch to PropertyConfigurator. But start with BasicConfigurator - it should log everything and give you an idea what's going on.
>> 
>> Andrus
>> 
>> On Feb 7, 2012, at 9:07 PM, Joe Baldwin wrote:
>>> I would do it, if I understood it.  However, I tried to tackle Cayenne logging about a year ago and could never figure it out.  I couldn't even figure out how to turn it off.  It just continued to perform the default behavior.
>>> 
>>> If you give me the exact commands and tell me exactly where to place those commands, I will follow your directions.
>>> 
>>> 
>>> On Feb 7, 2012, at 1:00 PM, Andrus Adamchik wrote:
>>> 
>>>> Can you enable Cayenne SQL logging? You'll see all the SQL executed prior to the exception.
>>>> 
>>>> http://cayenne.apache.org/doc30/configuring-logging.html
>>>> 
>>>> 
>>>> On Feb 7, 2012, at 8:49 PM, Joe Baldwin wrote:
>>>> 
>>>>> Michael,
>>>>> 
>>>>> I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).
>>>>> 
>>>>> So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.
>>>>> 
>>>>> Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)
>>>>> 
>>>>> I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.
>>>>> 
>>>>> Joe
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Stacktrace:
>>>>> 	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
>>>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>>>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>>>> 
>>>>> root cause
>>>>> 
>>>>> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
>>>>> 	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>>>>> 	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>>>>> 	cms.SessionLogger.log(Unknown Source)
>>>>> 	cms.SessionLogger.log(Unknown Source)
>>>>> 	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
>>>>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>>>> 
>>>>> root cause
>>>>> 
>>>>> 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`))
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:
>>>>> 
>>>>>> Hi Bryan,
>>>>>> 
>>>>>> I can confirm that the commit order varies.  We were seeing the issue
>>>>>> on the same environment, though.  When the AshwoodEntitySorter built
>>>>>> the object graph, it would vary from run-to-run.  Once built, it is
>>>>>> cached.  If it happens to build a proper order, you are good to go at
>>>>>> least until you restart.  For our particular issue, we had a deep
>>>>>> object graph cycle that didn't throw any exceptions.  The
>>>>>> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
>>>>>> that relationship, the problem went away.
>>>>>> 
>>>>>> mrg
>>>>>> 
>>>>>> 
>>>>>> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>>>>>>> This error reminds me of something we see in our shop.  If multiple related
>>>>>>> entities are being committed together, Cayenne can sometimes commit them
>>>>>>> out of order which can cause FK constraint violations.  The commit order
>>>>>>> seems to be indeterminate; it can work as expected on a dev machine and
>>>>>>> fail in production.
>>>>>>> 
>>>>>>> Look at the SQL issued just before the error.  On one server you might see
>>>>>>> the packagetype being inserted before the product, but the other way around
>>>>>>> on the other server.  If this is the problem, the fix is to subclass the
>>>>>>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> 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`))
>>>>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Hey Andrus,

Did you ever see the Twilight Zone?   Well get ready for this one.

1. It took me a while to figure out out to get the logging running, and it turns out the the webhost already has it in the tomcat path (but it is sort of hidden, and they don't, of course, tell you anything about it).
2. So I found their log4j.properties file and inserted "log4j.logger.org.apache.cayenne.access.QueryLogger=DEBUG"  (I hope this is what you were thinking of)
3. So then I deleted the logfile and restart tomcat
4. Rod Serling moment: when I tried to add the Product entity - for the first time it did not fail
	- detail: it added the Product, there was no Exception
	- I verified the Product by listing all of my products

So, is this 1. Insane, or 2. totally Insane?

NOTE:
Before I deleted the log file, I noticed an entry that said something about not properly closing the JDBC something-R-other.  But it has not re-appeared. This is curious because I had theorized that the weirdo Exception was from a cached INSERT that was erroneously re-submitted to MySQL.

So, I am voting for "totally insane".  If you have any ideas I would LOVE to hear them - and would like to know what to do. :)  Am I going to have to run the app in debug mode to get it to work?

Thanks,
Joe







On Feb 7, 2012, at 2:28 PM, Andrus Adamchik wrote:

> The simplest thing you can do is add log4J jar to your app, and add this somewhere on app startup (e.g. a filter or servlet init method, etc) : 
> 
>    BasicConfigurator.configure();
> 
> To fine-tune logging you may switch to PropertyConfigurator. But start with BasicConfigurator - it should log everything and give you an idea what's going on.
> 
> Andrus
> 
> On Feb 7, 2012, at 9:07 PM, Joe Baldwin wrote:
>> I would do it, if I understood it.  However, I tried to tackle Cayenne logging about a year ago and could never figure it out.  I couldn't even figure out how to turn it off.  It just continued to perform the default behavior.
>> 
>> If you give me the exact commands and tell me exactly where to place those commands, I will follow your directions.
>> 
>> 
>> On Feb 7, 2012, at 1:00 PM, Andrus Adamchik wrote:
>> 
>>> Can you enable Cayenne SQL logging? You'll see all the SQL executed prior to the exception.
>>> 
>>> http://cayenne.apache.org/doc30/configuring-logging.html
>>> 
>>> 
>>> On Feb 7, 2012, at 8:49 PM, Joe Baldwin wrote:
>>> 
>>>> Michael,
>>>> 
>>>> I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).
>>>> 
>>>> So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.
>>>> 
>>>> Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)
>>>> 
>>>> I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.
>>>> 
>>>> Joe
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Stacktrace:
>>>> 	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
>>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>>> 
>>>> root cause
>>>> 
>>>> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
>>>> 	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>>>> 	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>>>> 	cms.SessionLogger.log(Unknown Source)
>>>> 	cms.SessionLogger.log(Unknown Source)
>>>> 	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
>>>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>>> 
>>>> root cause
>>>> 
>>>> 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`))
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:
>>>> 
>>>>> Hi Bryan,
>>>>> 
>>>>> I can confirm that the commit order varies.  We were seeing the issue
>>>>> on the same environment, though.  When the AshwoodEntitySorter built
>>>>> the object graph, it would vary from run-to-run.  Once built, it is
>>>>> cached.  If it happens to build a proper order, you are good to go at
>>>>> least until you restart.  For our particular issue, we had a deep
>>>>> object graph cycle that didn't throw any exceptions.  The
>>>>> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
>>>>> that relationship, the problem went away.
>>>>> 
>>>>> mrg
>>>>> 
>>>>> 
>>>>> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>>>>>> This error reminds me of something we see in our shop.  If multiple related
>>>>>> entities are being committed together, Cayenne can sometimes commit them
>>>>>> out of order which can cause FK constraint violations.  The commit order
>>>>>> seems to be indeterminate; it can work as expected on a dev machine and
>>>>>> fail in production.
>>>>>> 
>>>>>> Look at the SQL issued just before the error.  On one server you might see
>>>>>> the packagetype being inserted before the product, but the other way around
>>>>>> on the other server.  If this is the problem, the fix is to subclass the
>>>>>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> 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`))
>>>>>>> 
>>>> 
>>> 
>> 
>> 
> 


Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
The simplest thing you can do is add log4J jar to your app, and add this somewhere on app startup (e.g. a filter or servlet init method, etc) : 

    BasicConfigurator.configure();

To fine-tune logging you may switch to PropertyConfigurator. But start with BasicConfigurator - it should log everything and give you an idea what's going on.

Andrus

On Feb 7, 2012, at 9:07 PM, Joe Baldwin wrote:
> I would do it, if I understood it.  However, I tried to tackle Cayenne logging about a year ago and could never figure it out.  I couldn't even figure out how to turn it off.  It just continued to perform the default behavior.
> 
> If you give me the exact commands and tell me exactly where to place those commands, I will follow your directions.
> 
> 
> On Feb 7, 2012, at 1:00 PM, Andrus Adamchik wrote:
> 
>> Can you enable Cayenne SQL logging? You'll see all the SQL executed prior to the exception.
>> 
>> http://cayenne.apache.org/doc30/configuring-logging.html
>> 
>> 
>> On Feb 7, 2012, at 8:49 PM, Joe Baldwin wrote:
>> 
>>> Michael,
>>> 
>>> I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).
>>> 
>>> So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.
>>> 
>>> Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)
>>> 
>>> I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.
>>> 
>>> Joe
>>> 
>>> 
>>> 
>>> 
>>> Stacktrace:
>>> 	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>> 
>>> root cause
>>> 
>>> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
>>> 	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>>> 	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>>> 	cms.SessionLogger.log(Unknown Source)
>>> 	cms.SessionLogger.log(Unknown Source)
>>> 	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
>>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>>> 
>>> root cause
>>> 
>>> 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`))
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:
>>> 
>>>> Hi Bryan,
>>>> 
>>>> I can confirm that the commit order varies.  We were seeing the issue
>>>> on the same environment, though.  When the AshwoodEntitySorter built
>>>> the object graph, it would vary from run-to-run.  Once built, it is
>>>> cached.  If it happens to build a proper order, you are good to go at
>>>> least until you restart.  For our particular issue, we had a deep
>>>> object graph cycle that didn't throw any exceptions.  The
>>>> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
>>>> that relationship, the problem went away.
>>>> 
>>>> mrg
>>>> 
>>>> 
>>>> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>>>>> This error reminds me of something we see in our shop.  If multiple related
>>>>> entities are being committed together, Cayenne can sometimes commit them
>>>>> out of order which can cause FK constraint violations.  The commit order
>>>>> seems to be indeterminate; it can work as expected on a dev machine and
>>>>> fail in production.
>>>>> 
>>>>> Look at the SQL issued just before the error.  On one server you might see
>>>>> the packagetype being inserted before the product, but the other way around
>>>>> on the other server.  If this is the problem, the fix is to subclass the
>>>>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>>>>> 
>>>>> 
>>>>> 
>>>>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>>> 
>>>>>> 
>>>>>> 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`))
>>>>>> 
>>> 
>> 
> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
I would do it, if I understood it.  However, I tried to tackle Cayenne logging about a year ago and could never figure it out.  I couldn't even figure out how to turn it off.  It just continued to perform the default behavior.

If you give me the exact commands and tell me exactly where to place those commands, I will follow your directions.


On Feb 7, 2012, at 1:00 PM, Andrus Adamchik wrote:

> Can you enable Cayenne SQL logging? You'll see all the SQL executed prior to the exception.
> 
> http://cayenne.apache.org/doc30/configuring-logging.html
> 
> 
> On Feb 7, 2012, at 8:49 PM, Joe Baldwin wrote:
> 
>> Michael,
>> 
>> I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).
>> 
>> So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.
>> 
>> Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)
>> 
>> I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.
>> 
>> Joe
>> 
>> 
>> 
>> 
>> Stacktrace:
>> 	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>> 
>> root cause
>> 
>> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
>> 	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>> 	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>> 	cms.SessionLogger.log(Unknown Source)
>> 	cms.SessionLogger.log(Unknown Source)
>> 	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
>> 
>> root cause
>> 
>> 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`))
>> 
>> 
>> 
>> 
>> 
>> On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:
>> 
>>> Hi Bryan,
>>> 
>>> I can confirm that the commit order varies.  We were seeing the issue
>>> on the same environment, though.  When the AshwoodEntitySorter built
>>> the object graph, it would vary from run-to-run.  Once built, it is
>>> cached.  If it happens to build a proper order, you are good to go at
>>> least until you restart.  For our particular issue, we had a deep
>>> object graph cycle that didn't throw any exceptions.  The
>>> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
>>> that relationship, the problem went away.
>>> 
>>> mrg
>>> 
>>> 
>>> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>>>> This error reminds me of something we see in our shop.  If multiple related
>>>> entities are being committed together, Cayenne can sometimes commit them
>>>> out of order which can cause FK constraint violations.  The commit order
>>>> seems to be indeterminate; it can work as expected on a dev machine and
>>>> fail in production.
>>>> 
>>>> Look at the SQL issued just before the error.  On one server you might see
>>>> the packagetype being inserted before the product, but the other way around
>>>> on the other server.  If this is the problem, the fix is to subclass the
>>>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>>>> 
>>>> 
>>>> 
>>>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>>> 
>>>>> 
>>>>> 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`))
>>>>> 
>> 
> 


Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
Can you enable Cayenne SQL logging? You'll see all the SQL executed prior to the exception.

http://cayenne.apache.org/doc30/configuring-logging.html


On Feb 7, 2012, at 8:49 PM, Joe Baldwin wrote:

> Michael,
> 
> I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).
> 
> So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.
> 
> Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)
> 
> I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.
> 
> Joe
> 
> 
> 
> 
> Stacktrace:
> 	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
> 
> root cause
> 
> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
> 	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
> 	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
> 	cms.SessionLogger.log(Unknown Source)
> 	cms.SessionLogger.log(Unknown Source)
> 	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
> 
> root cause
> 
> 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`))
> 
> 
> 
> 
> 
> On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:
> 
>> Hi Bryan,
>> 
>> I can confirm that the commit order varies.  We were seeing the issue
>> on the same environment, though.  When the AshwoodEntitySorter built
>> the object graph, it would vary from run-to-run.  Once built, it is
>> cached.  If it happens to build a proper order, you are good to go at
>> least until you restart.  For our particular issue, we had a deep
>> object graph cycle that didn't throw any exceptions.  The
>> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
>> that relationship, the problem went away.
>> 
>> mrg
>> 
>> 
>> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>>> This error reminds me of something we see in our shop.  If multiple related
>>> entities are being committed together, Cayenne can sometimes commit them
>>> out of order which can cause FK constraint violations.  The commit order
>>> seems to be indeterminate; it can work as expected on a dev machine and
>>> fail in production.
>>> 
>>> Look at the SQL issued just before the error.  On one server you might see
>>> the packagetype being inserted before the product, but the other way around
>>> on the other server.  If this is the problem, the fix is to subclass the
>>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>>> 
>>> 
>>> 
>>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>>> 
>>>> 
>>>> 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`))
>>>> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Michael,

I have new info that makes this problem look even screwier.  (Please refer to the error msgs below).

So, you might say: "so what, ... this looks like the same error".  Yes, it does! However, I just got this error after I restarted tomcat and tried to login to my app.  There is ABSOLUTELY no code that attempts to add/update a Product entity during a login.

Is it possible, that there is a cached operation that is attempting to be committed?  (Sort of like a printer trying to print a job that you have already deleted.)

I have never heard of a DBMS/JDBC-lib/ORM attempting to do this, but then again, I do not have control over the server and the techsupport dudes sound like they are very inexeprienced.

Joe




Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)

root cause

org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Aug 25 2010 19:42:04] Commit Exception
	org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
	org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
	cms.SessionLogger.log(Unknown Source)
	cms.SessionLogger.log(Unknown Source)
	org.apache.jsp.staff.admin.main.AdminLoginVerify_jsp._jspService(AdminLoginVerify_jsp.java:85)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)

root cause

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`))





On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:

> Hi Bryan,
> 
> I can confirm that the commit order varies.  We were seeing the issue
> on the same environment, though.  When the AshwoodEntitySorter built
> the object graph, it would vary from run-to-run.  Once built, it is
> cached.  If it happens to build a proper order, you are good to go at
> least until you restart.  For our particular issue, we had a deep
> object graph cycle that didn't throw any exceptions.  The
> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
> that relationship, the problem went away.
> 
> mrg
> 
> 
> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>> This error reminds me of something we see in our shop.  If multiple related
>> entities are being committed together, Cayenne can sometimes commit them
>> out of order which can cause FK constraint violations.  The commit order
>> seems to be indeterminate; it can work as expected on a dev machine and
>> fail in production.
>> 
>> Look at the SQL issued just before the error.  On one server you might see
>> the packagetype being inserted before the product, but the other way around
>> on the other server.  If this is the problem, the fix is to subclass the
>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>> 
>> 
>> 
>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>> 
>>> 
>>> 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`))
>>> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Bryan & Michael,

It sounds to me like the scenario that you are describing has to do with committing multiple entities and that the *order* can be re-set from what was intended.

Since I have no idea what the problem is, I am open to suggestions.  However, I checked the code, and it appears that there is only one entity being committed.

The Product entity has a "toOne" relationship with PackageType.  The PackageType table is populated once for the life of the app.  When I build a new Product entity, I first obtain a default PackageType with a custom static method:
	PackageType packageType = PackageType.fetchPackageTypeList().get(0);
Then I set the Product PackageType
	entity.setPackageType(packageType); // default: smallest package
Then, after initializing the rest of the Product entity, I commit changes
	BaseContext.getThreadObjectContext().commitChanges();

Essentially, I am getting an entity from MySQL via Cayenne, supplying that entity to the second entity and then committing the creation of the the second entity.  This is like Cayenne-elementary-school.

I have been coding Cayenne power apps for over a year with this method.  In fact, I have an app, (that I duplicated) currently running on the same webhost, using the same custom Cayenne powered code I created, that has never once failed due to this error.

I have verified the libs about 5x.  Checked my code about 10x.  Checked the pool manager configuration about 3x. I rebuilt the app and stress tested it 100% successfully on my dev server.  It continues to fail 100% of the time on the production server.

If the "MySQLIntegrityConstraintViolationException" is indicative of anything, I have *absolutely* no idea how to gain any more visibility into the problem.  (So I simply put println statements in the code so I could log that it was actually returning the PackageType entity, and of course, it was returning the correct object completely populated.  The Exception cannot be verified as being correct given the empirical data.)

I am going to be *really* upset if this turns out to be the WebHost dudes forgot to flip some switch on my account (which, btw, has happened before). :)

Joe



On Feb 7, 2012, at 11:48 AM, Michael Gentry wrote:

> Hi Bryan,
> 
> I can confirm that the commit order varies.  We were seeing the issue
> on the same environment, though.  When the AshwoodEntitySorter built
> the object graph, it would vary from run-to-run.  Once built, it is
> cached.  If it happens to build a proper order, you are good to go at
> least until you restart.  For our particular issue, we had a deep
> object graph cycle that didn't throw any exceptions.  The
> AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
> that relationship, the problem went away.
> 
> mrg
> 
> 
> On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
>> This error reminds me of something we see in our shop.  If multiple related
>> entities are being committed together, Cayenne can sometimes commit them
>> out of order which can cause FK constraint violations.  The commit order
>> seems to be indeterminate; it can work as expected on a dev machine and
>> fail in production.
>> 
>> Look at the SQL issued just before the error.  On one server you might see
>> the packagetype being inserted before the product, but the other way around
>> on the other server.  If this is the problem, the fix is to subclass the
>> AshwoodEntitySorter as has been discussed a couple of times in the list.
>> 
>> 
>> 
>> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>> 
>>> 
>>> 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`))
>>> 


Re: Odd error

Posted by Michael Gentry <mg...@masslight.net>.
Hi Bryan,

I can confirm that the commit order varies.  We were seeing the issue
on the same environment, though.  When the AshwoodEntitySorter built
the object graph, it would vary from run-to-run.  Once built, it is
cached.  If it happens to build a proper order, you are good to go at
least until you restart.  For our particular issue, we had a deep
object graph cycle that didn't throw any exceptions.  The
AshwoodEntitySorter doesn't work so well with cycles.  Once we removed
that relationship, the problem went away.

mrg


On Mon, Feb 6, 2012 at 7:18 AM, Bryan Lewis <jb...@gmail.com> wrote:
> This error reminds me of something we see in our shop.  If multiple related
> entities are being committed together, Cayenne can sometimes commit them
> out of order which can cause FK constraint violations.  The commit order
> seems to be indeterminate; it can work as expected on a dev machine and
> fail in production.
>
> Look at the SQL issued just before the error.  On one server you might see
> the packagetype being inserted before the product, but the other way around
> on the other server.  If this is the problem, the fix is to subclass the
> AshwoodEntitySorter as has been discussed a couple of times in the list.
>
>
>
> On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:
>
>>
>> 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`))
>>

Re: Odd error

Posted by Bryan Lewis <jb...@gmail.com>.
This error reminds me of something we see in our shop.  If multiple related
entities are being committed together, Cayenne can sometimes commit them
out of order which can cause FK constraint violations.  The commit order
seems to be indeterminate; it can work as expected on a dev machine and
fail in production.

Look at the SQL issued just before the error.  On one server you might see
the packagetype being inserted before the product, but the other way around
on the other server.  If this is the problem, the fix is to subclass the
AshwoodEntitySorter as has been discussed a couple of times in the list.



On Sun, Feb 5, 2012 at 6:48 PM, Joe Baldwin <jf...@earthlink.net> wrote:

>
> 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`))
>

Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hard to say without access to the server... NoClassDefFoundError... Is there a full stack trace somewhere?

On Feb 7, 2012, at 3:17 AM, Joe Baldwin wrote:

> Andrus,
> 
> I just found an associated error (via doing a simple println statement)
> 
> Caused by: java.lang.NoClassDefFoundError: org/apache/cayenne/conn/PoolManager
> 
> This is of course clearly not the case, since I have been using the same DBCP cayenne-config for over a year now. Is it possible, that the webhost has imposed a DB connection limit, and the techsupport guys don't know about it?  If this is the case, then this app may not be able to get a connection from the pool.
> 
> This is a weird theory, since I am getting enough connections to to select queries.
> 
> I am back to being confused. I sure hope you have some ideas. :)
> 
> 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 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
Andrus,

I just found an associated error (via doing a simple println statement)

Caused by: java.lang.NoClassDefFoundError: org/apache/cayenne/conn/PoolManager

This is of course clearly not the case, since I have been using the same DBCP cayenne-config for over a year now. Is it possible, that the webhost has imposed a DB connection limit, and the techsupport guys don't know about it?  If this is the case, then this app may not be able to get a connection from the pool.

This is a weird theory, since I am getting enough connections to to select queries.

I am back to being confused. I sure hope you have some ideas. :)

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


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
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 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
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 
>>>> 
>>>> 
>>> 
>> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
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 
>>> 
>>> 
>> 
> 


Re: Odd error

Posted by Andrus Adamchik <an...@objectstyle.org>.
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 
>> 
>> 
> 


Re: Odd error

Posted by Joe Baldwin <jf...@earthlink.net>.
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 
> 
>