Re: ArrayIndexOutOfBoundsException

2006-06-24 Thread Jay Sissom

Thanks for your help.  I'm glad this update will be in 1.0.5.

Jay

On 6/23/06, Armin Waibel <[EMAIL PROTECTED]> wrote:

Hi Eric,

Westfall, Eric Curtis wrote:
> Here is a JIRA issue which describes the problem and the fix along with
> the fixed version of PersistenceBrokerAbstractImpl attached.
>
> http://issues.apache.org/jira/browse/OJB-114
>

Many thanks for the patch! I checked in the new version of
PBAbstractImpl (in OJB_1_0_RELEASE branch) and close the issue in JIRA.


> It seems like if there was a way to get rid of the use of the finalize()
> method in this context that would be a superior long term solution.

I think this isn't possible, because you can't decide whether or not a
started Iterator (Iterator it = broker.getIteratorByQuery(q)) will be
used later. Only if
- the user does a complete loop
- the PB was closed (all connection resources closed)
- the Iterator instance itself was GC
it's allowed to close the underlying DB resources.

Nevertheless, I look forward to your suggestions ;-)

regards,
Armin


> That way you wouldn't have to worry about the cost of both running the
> finalize method and synchronizing access to the underlying collections.
> However that may or may not be possible. I'm not really too familiar
> with the codebase ;)
>
> Thanks,
> Eric
>
>> -Original Message-
>> From: Jay Sissom [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, June 22, 2006 11:38 AM
>> To: OJB Users List
>> Subject: Re: ArrayIndexOutOfBoundsException
>>
>> Unfortunately, I don't have a simple, repeatable test case right now.
>> This happens on a long running process and is related to the GC.
>>
>> We took the code in CVS mentioned in your email and tried it, but it
>> didn't solve the problem.  We added some synchronizing to it and that
>> did solve it.
>>
>> This problem might have started when we switched to JDK 1.5.  It
>> happens on a Mac and Linux so it isn't based on a specific
>> implementation.  I'm not sure about this, but it could be when this
>> started.
>>
>> We'll send the patch we made to make the problem go away a little
> later.
>> Thanks
>> Jay
>>
>>
>> On 6/22/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
>>> Hi Jay,
>>>
>>> Jay Sissom wrote:
>>>> Hello, I am using OJB 1.0.4 and Spring 1.2.8.  A spring
> interceptor is
>>>> handling transactions for me.  All my OJB code is written using
> the
>>>> Spring PersistenceBrokerDaoSupport class.
>>>>
>>>> I have a long running process that does quite a bit of data
>>>> manipulation.  It is a single threaded app that starts up Spring,
> does
>>>> it's work, then ends.  It runs from the command line.
>>>>
>>>> All the database work happens in a single Spring managed
> transaction
>>>> against a single Oracle database.
>>>>
>>>> If this process runs for a while, I will receive an exception in
> the
>>>> log like this:
>>>>
>>> If it isn't a concurrency issue (and it seems not, because you said
>>> it's a single threaded app) it seems to be a bug in OJB.
>>>
>>>
>>>> 2006-06-21 18:59:27,619 [Finalizer] ERROR
>>>> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Error
> when
>>>> try to remove RsIterator resource listener
>>>> java.lang.ArrayIndexOutOfBoundsException: 107
>>>>at
>>>>
> org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(
> Un
>> known
>>> This seems to indicate a concurrency problem. The
>>> ArrayIndexOutOfBoundsException could only happen when at the same
> time
>>> different threads remove listener objects. I think it could be that
> the
>>> FinalizerThread conflicts with the application thread, because
> modern
>>> gc's do no longer stop all app threads before gc run.
>>>
>>> Anyway I can't reproduce your problem on my system. I run a test
> case
>>> (against hsql and maxDB) which does many PB.getIteratorByQuery(q)
> calls
>>> without iteration of all objects. This will prevent OJB from cleanup
>>> RsIterator resources (because the iterator still has next objects).
> I
>>> can see many info-log statements when RsIterator was finalized, but
> I
>>> never get your concurrency issue. The GC runs within the
>>> PB.getIteratorByQuery(q) calls but I don't know if app thread was
>>> stopped between the GC runs.
>>>
>>

Re: ArrayIndexOutOfBoundsException

2006-06-23 Thread Armin Waibel

Hi Eric,

Westfall, Eric Curtis wrote:

Here is a JIRA issue which describes the problem and the fix along with
the fixed version of PersistenceBrokerAbstractImpl attached.

http://issues.apache.org/jira/browse/OJB-114



Many thanks for the patch! I checked in the new version of 
PBAbstractImpl (in OJB_1_0_RELEASE branch) and close the issue in JIRA.




It seems like if there was a way to get rid of the use of the finalize()
method in this context that would be a superior long term solution.


I think this isn't possible, because you can't decide whether or not a 
started Iterator (Iterator it = broker.getIteratorByQuery(q)) will be 
used later. Only if

- the user does a complete loop
- the PB was closed (all connection resources closed)
- the Iterator instance itself was GC
it's allowed to close the underlying DB resources.

Nevertheless, I look forward to your suggestions ;-)

regards,
Armin



That way you wouldn't have to worry about the cost of both running the
finalize method and synchronizing access to the underlying collections.
However that may or may not be possible. I'm not really too familiar
with the codebase ;)

Thanks,
Eric


-Original Message-
From: Jay Sissom [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 22, 2006 11:38 AM
To: OJB Users List
Subject: Re: ArrayIndexOutOfBoundsException

Unfortunately, I don't have a simple, repeatable test case right now.
This happens on a long running process and is related to the GC.

We took the code in CVS mentioned in your email and tried it, but it
didn't solve the problem.  We added some synchronizing to it and that
did solve it.

This problem might have started when we switched to JDK 1.5.  It
happens on a Mac and Linux so it isn't based on a specific
implementation.  I'm not sure about this, but it could be when this
started.

We'll send the patch we made to make the problem go away a little

later.

Thanks
Jay


On 6/22/06, Armin Waibel <[EMAIL PROTECTED]> wrote:

Hi Jay,

Jay Sissom wrote:

Hello, I am using OJB 1.0.4 and Spring 1.2.8.  A spring

interceptor is

handling transactions for me.  All my OJB code is written using

the

Spring PersistenceBrokerDaoSupport class.

I have a long running process that does quite a bit of data
manipulation.  It is a single threaded app that starts up Spring,

does

it's work, then ends.  It runs from the command line.

All the database work happens in a single Spring managed

transaction

against a single Oracle database.

If this process runs for a while, I will receive an exception in

the

log like this:


If it isn't a concurrency issue (and it seems not, because you said
it's a single threaded app) it seems to be a bug in OJB.



2006-06-21 18:59:27,619 [Finalizer] ERROR
org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Error

when

try to remove RsIterator resource listener
java.lang.ArrayIndexOutOfBoundsException: 107
   at


org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(
Un

known

This seems to indicate a concurrency problem. The
ArrayIndexOutOfBoundsException could only happen when at the same

time

different threads remove listener objects. I think it could be that

the

FinalizerThread conflicts with the application thread, because

modern

gc's do no longer stop all app threads before gc run.

Anyway I can't reproduce your problem on my system. I run a test

case

(against hsql and maxDB) which does many PB.getIteratorByQuery(q)

calls

without iteration of all objects. This will prevent OJB from cleanup
RsIterator resources (because the iterator still has next objects).

I

can see many info-log statements when RsIterator was finalized, but

I

never get your concurrency issue. The GC runs within the
PB.getIteratorByQuery(q) calls but I don't know if app thread was
stopped between the GC runs.



Source)
   at

org.apache.ojb.broker.accesslayer.RsIterator.release(Unknown

Source)
   at


org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown

Source)
   at

org.apache.ojb.broker.accesslayer.RsIterator.finalize(Unknown

Source)
   at java.lang.ref.Finalizer.invokeFinalizeMethod(Native

Method)

   at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
   at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
   at

java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

This might happen many times during the process.  The process

doesn't

stop running after one of these exceptions.

yep, these exceptions are caught (and logged) by class RsIterator,
because call RsIterator.releaseDbResources cause "only" a resource
cleanup issue.



At the end of the run,
when Spring should commit the transaction, it does a rollback with
this message:

2006-06-21 19:09:19,786 [main] ERROR
org.springframework.orm.ojb.PersistenceBrokerTransaction

RE: ArrayIndexOutOfBoundsException

2006-06-22 Thread Westfall, Eric Curtis
Here is a JIRA issue which describes the problem and the fix along with
the fixed version of PersistenceBrokerAbstractImpl attached.

http://issues.apache.org/jira/browse/OJB-114

It seems like if there was a way to get rid of the use of the finalize()
method in this context that would be a superior long term solution.
That way you wouldn't have to worry about the cost of both running the
finalize method and synchronizing access to the underlying collections.
However that may or may not be possible. I'm not really too familiar
with the codebase ;)

Thanks,
Eric

> -Original Message-
> From: Jay Sissom [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 22, 2006 11:38 AM
> To: OJB Users List
> Subject: Re: ArrayIndexOutOfBoundsException
> 
> Unfortunately, I don't have a simple, repeatable test case right now.
> This happens on a long running process and is related to the GC.
> 
> We took the code in CVS mentioned in your email and tried it, but it
> didn't solve the problem.  We added some synchronizing to it and that
> did solve it.
> 
> This problem might have started when we switched to JDK 1.5.  It
> happens on a Mac and Linux so it isn't based on a specific
> implementation.  I'm not sure about this, but it could be when this
> started.
> 
> We'll send the patch we made to make the problem go away a little
later.
> 
> Thanks
> Jay
> 
> 
> On 6/22/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
> > Hi Jay,
> >
> > Jay Sissom wrote:
> > > Hello, I am using OJB 1.0.4 and Spring 1.2.8.  A spring
interceptor is
> > > handling transactions for me.  All my OJB code is written using
the
> > > Spring PersistenceBrokerDaoSupport class.
> > >
> > > I have a long running process that does quite a bit of data
> > > manipulation.  It is a single threaded app that starts up Spring,
does
> > > it's work, then ends.  It runs from the command line.
> > >
> > > All the database work happens in a single Spring managed
transaction
> > > against a single Oracle database.
> > >
> > > If this process runs for a while, I will receive an exception in
the
> > > log like this:
> > >
> >
> > If it isn't a concurrency issue (and it seems not, because you said
> > it's a single threaded app) it seems to be a bug in OJB.
> >
> >
> > > 2006-06-21 18:59:27,619 [Finalizer] ERROR
> > > org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Error
when
> > > try to remove RsIterator resource listener
> > > java.lang.ArrayIndexOutOfBoundsException: 107
> > >at
> > >
>
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(
Un
> known
> > >
> >
> > This seems to indicate a concurrency problem. The
> > ArrayIndexOutOfBoundsException could only happen when at the same
time
> > different threads remove listener objects. I think it could be that
the
> > FinalizerThread conflicts with the application thread, because
modern
> > gc's do no longer stop all app threads before gc run.
> >
> > Anyway I can't reproduce your problem on my system. I run a test
case
> > (against hsql and maxDB) which does many PB.getIteratorByQuery(q)
calls
> > without iteration of all objects. This will prevent OJB from cleanup
> > RsIterator resources (because the iterator still has next objects).
I
> > can see many info-log statements when RsIterator was finalized, but
I
> > never get your concurrency issue. The GC runs within the
> > PB.getIteratorByQuery(q) calls but I don't know if app thread was
> > stopped between the GC runs.
> >
> >
> > > Source)
> > >at
org.apache.ojb.broker.accesslayer.RsIterator.release(Unknown
> > > Source)
> > >at
> > >
>
org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown
> > > Source)
> > >at
> org.apache.ojb.broker.accesslayer.RsIterator.finalize(Unknown
> > > Source)
> > >at java.lang.ref.Finalizer.invokeFinalizeMethod(Native
Method)
> > >at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
> > >at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
> > >at
> java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
> > >
> > > This might happen many times during the process.  The process
doesn't
> > > stop running after one of these exceptions.
> >
> > yep, these exceptions are caught (and logged) by class RsIterator,
> > because call RsIterator.releaseDbResources ca

Re: ArrayIndexOutOfBoundsException

2006-06-22 Thread Jay Sissom

Unfortunately, I don't have a simple, repeatable test case right now.
This happens on a long running process and is related to the GC.

We took the code in CVS mentioned in your email and tried it, but it
didn't solve the problem.  We added some synchronizing to it and that
did solve it.

This problem might have started when we switched to JDK 1.5.  It
happens on a Mac and Linux so it isn't based on a specific
implementation.  I'm not sure about this, but it could be when this
started.

We'll send the patch we made to make the problem go away a little later.

Thanks
Jay


On 6/22/06, Armin Waibel <[EMAIL PROTECTED]> wrote:

Hi Jay,

Jay Sissom wrote:
> Hello, I am using OJB 1.0.4 and Spring 1.2.8.  A spring interceptor is
> handling transactions for me.  All my OJB code is written using the
> Spring PersistenceBrokerDaoSupport class.
>
> I have a long running process that does quite a bit of data
> manipulation.  It is a single threaded app that starts up Spring, does
> it's work, then ends.  It runs from the command line.
>
> All the database work happens in a single Spring managed transaction
> against a single Oracle database.
>
> If this process runs for a while, I will receive an exception in the
> log like this:
>

If it isn't a concurrency issue (and it seems not, because you said
it's a single threaded app) it seems to be a bug in OJB.


> 2006-06-21 18:59:27,619 [Finalizer] ERROR
> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Error when
> try to remove RsIterator resource listener
> java.lang.ArrayIndexOutOfBoundsException: 107
>at
> 
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(Unknown
>

This seems to indicate a concurrency problem. The
ArrayIndexOutOfBoundsException could only happen when at the same time
different threads remove listener objects. I think it could be that the
FinalizerThread conflicts with the application thread, because modern
gc's do no longer stop all app threads before gc run.

Anyway I can't reproduce your problem on my system. I run a test case
(against hsql and maxDB) which does many PB.getIteratorByQuery(q) calls
without iteration of all objects. This will prevent OJB from cleanup
RsIterator resources (because the iterator still has next objects). I
can see many info-log statements when RsIterator was finalized, but I
never get your concurrency issue. The GC runs within the
PB.getIteratorByQuery(q) calls but I don't know if app thread was
stopped between the GC runs.


> Source)
>at org.apache.ojb.broker.accesslayer.RsIterator.release(Unknown
> Source)
>at
> org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown
> Source)
>at org.apache.ojb.broker.accesslayer.RsIterator.finalize(Unknown
> Source)
>at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
>at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
>at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
>at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
>
> This might happen many times during the process.  The process doesn't
> stop running after one of these exceptions.

yep, these exceptions are caught (and logged) by class RsIterator,
because call RsIterator.releaseDbResources cause "only" a resource
cleanup issue.


> At the end of the run,
> when Spring should commit the transaction, it does a rollback with
> this message:
>
> 2006-06-21 19:09:19,786 [main] ERROR
> org.springframework.orm.ojb.PersistenceBrokerTransactionManager ::
> Commit exception overridden by rollback exception
> java.lang.NullPointerException
>at
> 
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(Unknown
>

This is strange. But maybe it's a subsequent error caused by the
concurrency issue above.
Currently we don't use synchronized methods in listener handling
(because these methods are very often called).

For OJB 1.0.5 I reworked this section some time ago (using
IdentityArrayList for listener instead of array). If you replace the
following sources in your 1.0.4 release source and recompile the OJB-jar
(call "ant jar" on command line in db-ojb directory) we can try to fix
this for the upcoming release.

http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/IdentityArrayList.java?view=log
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerAbstractImpl.java?view=log

Or if possible get latest OJB version from SVN OJB_1_0_RELEASE branch,
build OJB jar and run your test again.

 > It looks like the garbage collector is trying to collect an object
 > that is being used.  Has anyone seen this before?

Think this is the first time.

 > Any ideas how it
 > can be fixed?

Maybe we have to synchronize some methods in
PersistenceBrokerAbstractImpl - e.g. #removeListener

regards,
Armin

> Source)
>at
> 
org.apache.ojb.broker.core.PersistenceBrok

Re: ArrayIndexOutOfBoundsException

2006-06-22 Thread Armin Waibel

Hi Jay,

Jay Sissom wrote:

Hello, I am using OJB 1.0.4 and Spring 1.2.8.  A spring interceptor is
handling transactions for me.  All my OJB code is written using the
Spring PersistenceBrokerDaoSupport class.

I have a long running process that does quite a bit of data
manipulation.  It is a single threaded app that starts up Spring, does
it's work, then ends.  It runs from the command line.

All the database work happens in a single Spring managed transaction
against a single Oracle database.

If this process runs for a while, I will receive an exception in the
log like this:



If it isn't a concurrency issue (and it seems not, because you said
it's a single threaded app) it seems to be a bug in OJB.



2006-06-21 18:59:27,619 [Finalizer] ERROR
org.apache.ojb.broker.accesslayer.ReportQueryRsIterator :: Error when
try to remove RsIterator resource listener
java.lang.ArrayIndexOutOfBoundsException: 107
   at 
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(Unknown 



This seems to indicate a concurrency problem. The 
ArrayIndexOutOfBoundsException could only happen when at the same time 
different threads remove listener objects. I think it could be that the 
FinalizerThread conflicts with the application thread, because modern 
gc's do no longer stop all app threads before gc run.


Anyway I can't reproduce your problem on my system. I run a test case 
(against hsql and maxDB) which does many PB.getIteratorByQuery(q) calls 
without iteration of all objects. This will prevent OJB from cleanup 
RsIterator resources (because the iterator still has next objects). I 
can see many info-log statements when RsIterator was finalized, but I 
never get your concurrency issue. The GC runs within the 
PB.getIteratorByQuery(q) calls but I don't know if app thread was 
stopped between the GC runs.




Source)
   at org.apache.ojb.broker.accesslayer.RsIterator.release(Unknown 
Source)
   at 
org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown

Source)
   at org.apache.ojb.broker.accesslayer.RsIterator.finalize(Unknown 
Source)

   at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
   at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
   at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
   at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

This might happen many times during the process.  The process doesn't
stop running after one of these exceptions.  


yep, these exceptions are caught (and logged) by class RsIterator, 
because call RsIterator.releaseDbResources cause "only" a resource 
cleanup issue.




At the end of the run,
when Spring should commit the transaction, it does a rollback with
this message:

2006-06-21 19:09:19,786 [main] ERROR
org.springframework.orm.ojb.PersistenceBrokerTransactionManager ::
Commit exception overridden by rollback exception
java.lang.NullPointerException
   at 
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.notifiyStateListener(Unknown 



This is strange. But maybe it's a subsequent error caused by the 
concurrency issue above.
Currently we don't use synchronized methods in listener handling 
(because these methods are very often called).


For OJB 1.0.5 I reworked this section some time ago (using 
IdentityArrayList for listener instead of array). If you replace the 
following sources in your 1.0.4 release source and recompile the OJB-jar 
(call "ant jar" on command line in db-ojb directory) we can try to fix 
this for the upcoming release.


http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/IdentityArrayList.java?view=log
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerAbstractImpl.java?view=log

Or if possible get latest OJB version from SVN OJB_1_0_RELEASE branch, 
build OJB jar and run your test again.


> It looks like the garbage collector is trying to collect an object
> that is being used.  Has anyone seen this before?

Think this is the first time.

> Any ideas how it
> can be fixed?

Maybe we have to synchronize some methods in 
PersistenceBrokerAbstractImpl - e.g. #removeListener


regards,
Armin


Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.fireBrokerEvent(Unknown 


Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknown

Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown 


Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown 


Source)
   at 
org.springframework.orm.ojb.PersistenceBrokerTransactionManager.doCommit(PersistenceBrokerTransactionManager.java:251) 

   at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:500) 

   at 
org.springframework.transaction.support.A

Re: ArrayIndexOutOfBoundsException in PersistenceBrokerAbstractImpl

2006-02-10 Thread Armin Waibel

Hi Phil,

DiCorpo, Phillip wrote:

I'm using ODMG and OJB 1.0.4.  Any reason why I would be seeing the
following exception?  Looking at the code I could only see this possibly
happening if more than one thread is accessing the array of
temporateStateListeners.  Thanks in advance for the help,



I agree with you, this seems to be a concurrency problem. 
PersistenceBroker instances are not thread safe, each thread have to use 
its own instance.
If this isn't the cause of your problem, please describe more detailed 
what's happen before the exception occur.


regards,
Armin




--Phil

2006-02-09 03:14:48 StandardContext[/Example]Thread: 15 SEVERE
[org.apache.ojb.broker.accesslayer.RsIterator] Error when try to remove
RsIterator resource listener
Cause:
java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ArrayIndexOutOfBoundsException: 0
at
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.removeListener(
PersistenceBrokerAbstractImpl.java:205)
at
org.apache.ojb.broker.accesslayer.RsIterator.release(RsIterator.java:836
)
at
org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(RsIterat
or.java:817)
at
org.apache.ojb.broker.accesslayer.RsIterator.autoReleaseDbResources(RsIt
erator.java:862)
at
org.apache.ojb.broker.accesslayer.RsIterator.hasNext(RsIterator.java:236
)
at
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Ba
sePrefetcher.java:111)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Qu
eryReferenceBroker.java:381)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Que
ryReferenceBroker.java:176)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Que
ryReferenceBroker.java:263)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1476)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(DelegatingPersistenceBroker.java:373)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(DelegatingPersistenceBroker.java:373)
at
org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.loadData(Col
lectionProxyDefaultImpl.java:193)
at
org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.loadData(ListProxy
DefaultImpl.java:148)
at
org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.getData(Coll
ectionProxyDefaultImpl.java:513)
at
org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.iterator(Col
lectionProxyDefaultImpl.java:291)

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ArrayIndexOutOfBoundsException at 1:N relationship

2006-02-01 Thread Manukyan, Sergey

Hi Guido,

Please provide the repository fragment relevant to your classes,
specifically where you make reference,

Sergey




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 31, 2006 1:00 PM
To: ojb-user@db.apache.org
Subject: ArrayIndexOutOfBoundsException at 1:N relationship

Hi,

I have a problem with a java.lang.ArrayIndexOutOfBoundsException: 1

I have the following:

class A
{
Integer pkA
};

class B
{
Integer pkA // is PK
Integer pkB // is PK too
Integer otherField;
};

B has 2 primary key fields and A only one.
So the first field pkA of Class (and table ) B is the primary key of
Class (and table) A.
>From point of view of  A it is a 1:N relationship. I have a repository
with a collection descriptor at
A and a reference descriptor at B and both are working when I turn on
autoload.
I would like to query A and get all A where B.otherField=SomeValue.
This produces the ArrayIndexOutOfBoundsException. Can the problem be
that
B has no own
pk field so that B.pkA is part of the primary key of the table B and
part
of a reference descriptor
(and part of the collection descriptor of A) ?

best regards,

Guido

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**
** LEGAL DISCLAIMER **
**

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ArrayIndexOutOfBoundsException at 1:N relationship

2006-02-01 Thread Guido Beutler

Hi,

please forget all I wrote :)
I had a error at the definition of the pk of A. A second row was defined 
as primary key too.
I think that I ran in this problem during my tests. This maybe why the 
autoload was working
when I started. With the invalid pk definition the test case wouldn't 
succeed


best regards,

Guido

[EMAIL PROTECTED] wrote:


Hi,

I have a problem with a java.lang.ArrayIndexOutOfBoundsException: 1

I have the following:

class A
{ 
Integer pkA

};

class B
{
Integer pkA // is PK
Integer pkB // is PK too
Integer otherField;
};

B has 2 primary key fields and A only one.
So the first field pkA of Class (and table ) B is the primary key of 
Class (and table) A.

From point of view of  A it is a 1:N relationship. I have a repository

with a collection descriptor at
A and a reference descriptor at B and both are working when I turn on
autoload.
I would like to query A and get all A where B.otherField=SomeValue.
This produces the ArrayIndexOutOfBoundsException. Can the problem be that
B has no own
pk field so that B.pkA is part of the primary key of the table B and part
of a reference descriptor
(and part of the collection descriptor of A) ?

best regards,

Guido

 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Armin Waibel

Gru Samuel wrote:

Thanks a lot, i think you give me the way to find the mistake.


I hope so ;-)


And i found a pb in a descriptor.
I have a descriptor with two PKs, but in my database the associated table
has just 1 PK.


The primary key declaration in OJB's metadata is independent from the 
PK's in the database. Nearly... all database PK columns have to be PK 
fields in OJB to avoid PK issues, but you can declare PK fields in OJB 
without using PK columns in DB.
Only OJB's metadata declaration (PK, FK settings and indirection table 
columns) has to be consistent (e.g. if an object has composed PK, a 
referenced 1:n object need all PK's as FK's).


regards,
Armin



I ll modify it and will try to use the 1.0.3.

Samuel.


-Message d'origine-
De : Manukyan, Sergey [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 septembre 2005 14:26
À : OJB Users List
Objet : RE: ArrayIndexOutOfBoundsException Exception 




Hi Samuel,

Had similar problem and the answer was that I was trying to map more columns
in indirection table then existed in a class I was referring to, like

f.e. I had :

Class1(PK1)
Class2(PK2,PK3)

and

IndirectionTable1(PK1,PK2,PK3)

The the wrong thing I did was:

Class1.Relation1(using IndirectionTable1)({PK1},{PK1,PK2,PK3}) - WRONG! -
resulting in ArrayIndexOutOfBoundsException. As there are just two keys in
Class2 not three!!!

Class1.Relation1(using IndirectionTable1)({PK1},{PK2,PK3}) - CORRECT!

Hope it helps,

-Sergey




-Original Message-
From: Gru Samuel [mailto:[EMAIL PROTECTED]

Sent: Wednesday, September 14, 2005 3:11 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception


Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception



Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :






 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :


 String[] indFkCols = getFksToThisClass();
  String[] indItemFkCols = getFksToItemClass();
  FieldDescriptor[] pkFields =


getOwnerClassDescriptor().getPkFields();


  FieldDescriptor[] itemPkFields =


getItemClassDescriptor().getPkFields();


  String[] cols = new String[indFkCols.length +


indItemFkCols.length];


  int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];


Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

--

Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--

Les informations ou pièces jointes contenue

RE: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Manukyan, Sergey
Samuel:
I am glad it helped it took me a while to figure it out myself... 

To OJB developers:
Maybe it would be better to supply some kind of more meaningful error message 
like amount of columns in indirection table doesn't match amount of columns in 
a reference table?

-Sergey



-Original Message-
From: Gru Samuel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 14, 2005 10:17 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception 

Thanks a lot, i think you give me the way to find the mistake.
And i found a pb in a descriptor.
I have a descriptor with two PKs, but in my database the associated table
has just 1 PK.

I ll modify it and will try to use the 1.0.3.

Samuel.


-Message d'origine-
De : Manukyan, Sergey [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 septembre 2005 14:26
À : OJB Users List
Objet : RE: ArrayIndexOutOfBoundsException Exception 



Hi Samuel,

Had similar problem and the answer was that I was trying to map more columns
in indirection table then existed in a class I was referring to, like

f.e. I had :

Class1(PK1)
Class2(PK2,PK3)

and

IndirectionTable1(PK1,PK2,PK3)

The the wrong thing I did was:

Class1.Relation1(using IndirectionTable1)({PK1},{PK1,PK2,PK3}) - WRONG! -
resulting in ArrayIndexOutOfBoundsException. As there are just two keys in
Class2 not three!!!

Class1.Relation1(using IndirectionTable1)({PK1},{PK2,PK3}) - CORRECT!

Hope it helps,

-Sergey




-Original Message-
From: Gru Samuel [mailto:[EMAIL PROTECTED]

Sent: Wednesday, September 14, 2005 3:11 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception


Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception



Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :






 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :
>   String[] indFkCols = getFksToThisClass();
>String[] indItemFkCols = getFksToItemClass();
>FieldDescriptor[] pkFields =
getOwnerClassDescriptor().getPkFields();
>FieldDescriptor[] itemPkFields =
getItemClassDescriptor().getPkFields();
>String[] cols = new String[indFkCols.length +
indItemFkCols.length];
>int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];
Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

--

Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--

Les informations ou pièces jointes contenues dans ce 

RE: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Gru Samuel
Thanks a lot, i think you give me the way to find the mistake.
And i found a pb in a descriptor.
I have a descriptor with two PKs, but in my database the associated table
has just 1 PK.

I ll modify it and will try to use the 1.0.3.

Samuel.


-Message d'origine-
De : Manukyan, Sergey [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 septembre 2005 14:26
À : OJB Users List
Objet : RE: ArrayIndexOutOfBoundsException Exception 



Hi Samuel,

Had similar problem and the answer was that I was trying to map more columns
in indirection table then existed in a class I was referring to, like

f.e. I had :

Class1(PK1)
Class2(PK2,PK3)

and

IndirectionTable1(PK1,PK2,PK3)

The the wrong thing I did was:

Class1.Relation1(using IndirectionTable1)({PK1},{PK1,PK2,PK3}) - WRONG! -
resulting in ArrayIndexOutOfBoundsException. As there are just two keys in
Class2 not three!!!

Class1.Relation1(using IndirectionTable1)({PK1},{PK2,PK3}) - CORRECT!

Hope it helps,

-Sergey




-Original Message-
From: Gru Samuel [mailto:[EMAIL PROTECTED]

Sent: Wednesday, September 14, 2005 3:11 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception


Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception



Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :






 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :
>   String[] indFkCols = getFksToThisClass();
>String[] indItemFkCols = getFksToItemClass();
>FieldDescriptor[] pkFields =
getOwnerClassDescriptor().getPkFields();
>FieldDescriptor[] itemPkFields =
getItemClassDescriptor().getPkFields();
>String[] cols = new String[indFkCols.length +
indItemFkCols.length];
>int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];
Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

--

Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--

Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

--

Re: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Armin Waibel

Hi Samuel,

maybe there is an issue with your mapping metadata (you don't post the 
whole metadata related to your m:n relations, so I can't review it).


If you use a composed primary key (by specifying more than one PK field) 
in class-descriptor, the indirection table has to reflect the composed 
PK(if the "left" class has 3 PK fields, "right" class has 2 PK fields, 
the indirection table has to reflect all PK's in 3+2 columns).


An example using composed PK with m:n relation can be found in OJB 
test-suite, the mapping can be found in repository_reference.xml 
class-descriptor for org.apache.ojb.broker.M2NTest$MovieImpl

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/repository_junit_reference.xml?rev=1.17.2.5&view=markup

Could this be the issue?

regards,
Armin

Gru Samuel wrote:

Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception 



Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :


 
element-class-ref="fr.ouestfrance.xxx.FonctionParametreServeur"

auto-retrieve="true"
auto-update="true"
auto-delete="true"
orderby="nb_ordre" sort="ASC"
indirection-table="procedurefonction"
  >



 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :


 String[] indFkCols = getFksToThisClass();
  String[] indItemFkCols = getFksToItemClass();
  FieldDescriptor[] pkFields =


getOwnerClassDescriptor().getPkFields();


  FieldDescriptor[] itemPkFields =


getItemClassDescriptor().getPkFields();


  String[] cols = new String[indFkCols.length +


indItemFkCols.length];


  int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];


Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

-- 
Les informations ou pièces jointes contenues dans ce message sont

confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
Les informations ou pièces jointes contenues dans ce message sont

confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





RE: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Manukyan, Sergey

Hi Samuel,

Had similar problem and the answer was that I was trying to map more columns in 
indirection table then existed in a class I was referring to, like

f.e. I had :

Class1(PK1)
Class2(PK2,PK3)

and

IndirectionTable1(PK1,PK2,PK3)

The the wrong thing I did was:

Class1.Relation1(using IndirectionTable1)({PK1},{PK1,PK2,PK3}) - WRONG! - 
resulting in ArrayIndexOutOfBoundsException. As there are just two keys in 
Class2 not three!!!

Class1.Relation1(using IndirectionTable1)({PK1},{PK2,PK3}) - CORRECT!

Hope it helps,

-Sergey




-Original Message-
From: Gru Samuel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 14, 2005 3:11 AM
To: 'OJB Users List'
Subject: RE: ArrayIndexOutOfBoundsException Exception

Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception


Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :






 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :
>   String[] indFkCols = getFksToThisClass();
>String[] indItemFkCols = getFksToItemClass();
>FieldDescriptor[] pkFields =
getOwnerClassDescriptor().getPkFields();
>FieldDescriptor[] itemPkFields =
getItemClassDescriptor().getPkFields();
>String[] cols = new String[indFkCols.length +
indItemFkCols.length];
>int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];
Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

--
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**
** LEGAL DISCLAIMER **
**

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipie

RE: ArrayIndexOutOfBoundsException Exception

2005-09-14 Thread Gru Samuel
Hi,

Last month, i had no aswer, so i already send my pb. ;-)

Please help me.
Thanks

Samuel



-Message d'origine-
De : Gru Samuel [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 26 août 2005 10:45
À : Liste Ojb (E-mail)
Objet : ArrayIndexOutOfBoundsException Exception 


Hi,

We want to use the ojb 1.0.3 (actually, we have the 1.0.rc5 version)
When i use this version, i have an ArrayIndexOutOfBoundsException exception.

my descriptors are :






 





 
 


  




...


java.lang.ArrayIndexOutOfBoundsException: 2
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQuery(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildMtoNImplemen
torQueries(Unknown Source)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknow
n Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow
n Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
Unknown Source)


Can you explain me where the error is in my descriptor ?


When i read the src of the class, i see :
>   String[] indFkCols = getFksToThisClass();
>String[] indItemFkCols = getFksToItemClass();
>FieldDescriptor[] pkFields =
getOwnerClassDescriptor().getPkFields();
>FieldDescriptor[] itemPkFields =
getItemClassDescriptor().getPkFields();
>String[] cols = new String[indFkCols.length +
indItemFkCols.length];
>int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];
Do you think the last line is correct ?
Why it isnt  "int[] jdbcTypes = new int[pkFields .length + itemPkFields
.length];" ?

Thanks,

Samuel

-- 
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
Les informations ou pièces jointes contenues dans ce message sont
confidentielles. Seul le destinataire expressément visé peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La société Ouest-France décline en
outre, toute responsabilité de quelque nature que ce soit au titre de ce
message s'il a été altéré, déformé ou falsifié.

--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Martin Marinschek
I got rid of the factory and the extended class, and the stuff works now.
Thanks for your help,
-Martin
Martin Marinschek wrote:
Armin Waibel wrote:
Martin Marinschek wrote:
I am not using anonymous keys at all, afaik every object in my 
system has its id and exposes it also in the source-code.

ok, similar to my local test
Here is my class-descriptor for the class being serialized and 
loaded back; I realized that I am using the factory-properties to 
create a customized class ('CustomizedOfferLineImpl', this class has 
just an additional get-method to summarize some properties) - maybe 
this is what is causing the problems?

(e.g. OJB does not find a class-descriptor for 
'CustomizedOfferLineImpl' and does not check if 
'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using 
this one?)

hmm, never tried this. But if 'CustomizedOfferLineImpl' is not 
declared in metadata, you will at the latest get problems when 
storing these objects. Do you get any other error logging before the 
ArrayIndexOutOfBoundException occurs?

In my local test I do:
- store an Project class object with a collection of SubProject 
objects (1:n Project to SubProject)
- clear cache and query the created Project
- get the Project with proxied SubProject reference (not materialized)
- serialize/deserialize Project
- get the first SubProject object from Project (materialization done 
without problems)

Is this test similar to yours?
regards,
Armin

Yes, very much the same...
I believe that it might be the factory and extension class thing that 
is causing the problems, but I will retry in a different setting.

thanks,
-Martin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Martin Marinschek
Armin Waibel wrote:
Martin Marinschek wrote:
I am not using anonymous keys at all, afaik every object in my system 
has its id and exposes it also in the source-code.

ok, similar to my local test
Here is my class-descriptor for the class being serialized and loaded 
back; I realized that I am using the factory-properties to create a 
customized class ('CustomizedOfferLineImpl', this class has just an 
additional get-method to summarize some properties) - maybe this is 
what is causing the problems?

(e.g. OJB does not find a class-descriptor for 
'CustomizedOfferLineImpl' and does not check if 
'CustomizedOfferLineImpl' is of base class 'OfferLineImpl' and using 
this one?)

hmm, never tried this. But if 'CustomizedOfferLineImpl' is not 
declared in metadata, you will at the latest get problems when storing 
these objects. Do you get any other error logging before the 
ArrayIndexOutOfBoundException occurs?

In my local test I do:
- store an Project class object with a collection of SubProject 
objects (1:n Project to SubProject)
- clear cache and query the created Project
- get the Project with proxied SubProject reference (not materialized)
- serialize/deserialize Project
- get the first SubProject object from Project (materialization done 
without problems)

Is this test similar to yours?
regards,
Armin
Yes, very much the same...
I believe that it might be the factory and extension class thing that is 
causing the problems, but I will retry in a different setting.

thanks,
-Martin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Armin Waibel
Martin Marinschek wrote:
I am not using anonymous keys at all, afaik every object in my system 
has its id and exposes it also in the source-code.

ok, similar to my local test
Here is my class-descriptor for the class being serialized and loaded 
back; I realized that I am using the factory-properties to create a 
customized class ('CustomizedOfferLineImpl', this class has just an 
additional get-method to summarize some properties) - maybe this is what 
is causing the problems?

(e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' 
and does not check if 'CustomizedOfferLineImpl' is of base class 
'OfferLineImpl' and using this one?)

hmm, never tried this. But if 'CustomizedOfferLineImpl' is not declared 
in metadata, you will at the latest get problems when storing these 
objects. Do you get any other error logging before the 
ArrayIndexOutOfBoundException occurs?

In my local test I do:
- store an Project class object with a collection of SubProject objects 
(1:n Project to SubProject)
- clear cache and query the created Project
- get the Project with proxied SubProject reference (not materialized)
- serialize/deserialize Project
- get the first SubProject object from Project (materialization done 
without problems)

Is this test similar to yours?
regards,
Armin

-Martin
   

   
   name="id"
   column="ID"
   jdbc-type="BIGINT"
   nullable="false"
   primarykey="true"
   autoincrement="true"
   sequence-name="OFFSINGLE_SEQ"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" 

   />
   
   name="comment"
   column="OFFSINGLE_COMMENT"
   jdbc-type="VARCHAR"
   nullable="true"
   length="255"
   />
   
   name="modifiedAt"
   column="MODIFIED_AT"
   jdbc-type="DATE"
   nullable="false"
   length="0"
   
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" 

   />
   
   name="modifiedBy"
   column="MODIFIED_BY"
   jdbc-type="VARCHAR"
   nullable="false"
   length="255"
   />
   
   name="createdAt"
   column="CREATED_AT"
   jdbc-type="DATE"
   nullable="false"
   length="0"
   
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion" 

   />
   
   name="createdBy"
   column="CREATED_BY"
   jdbc-type="VARCHAR"
   nullable="false"
   length="255"
   />
   
   name="offerId"
   column="OFFALL_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" 

   />
   
   name="contentId"
   column="CONT_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" 

   />
   
   name="nameSpaceId"
   column="NSP_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion" 

   />
   
 
class-ref="at.oekb.roncalli.metadata.entity.OfferImpl"
 proxy="true">
   
   

   
 
class-ref="at.oekb.roncalli.metadata.entity.ContentImpl"
 proxy="true">
   
   

   
 
class-ref="at.oekb.roncalli.metadata.entity.NameSpaceImpl"
 proxy="true">
   
   

   
  
element-class-ref="at.oekb.roncalli.metadata.entity.OfferLineConditionImpl"
  proxy="true">
   
   

   
  
element-class-ref="at.oekb.roncalli.metadata.entity.DataTransferImpl"
  proxy="true">
   
   

   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Martin Marinschek
I am not using anonymous keys at all, afaik every object in my system 
has its id and exposes it also in the source-code.

Here is my class-descriptor for the class being serialized and loaded 
back; I realized that I am using the factory-properties to create a 
customized class ('CustomizedOfferLineImpl', this class has just an 
additional get-method to summarize some properties) - maybe this is what 
is causing the problems?

(e.g. OJB does not find a class-descriptor for 'CustomizedOfferLineImpl' 
and does not check if 'CustomizedOfferLineImpl' is of base class 
'OfferLineImpl' and using this one?)

-Martin
   

   
   name="id"
   column="ID"
   jdbc-type="BIGINT"
   nullable="false"
   primarykey="true"
   autoincrement="true"
   sequence-name="OFFSINGLE_SEQ"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion"
   />
   
   name="comment"
   column="OFFSINGLE_COMMENT"
   jdbc-type="VARCHAR"
   nullable="true"
   length="255"
   />
   
   name="modifiedAt"
   column="MODIFIED_AT"
   jdbc-type="DATE"
   nullable="false"
   length="0"
   
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"
   />
   
   name="modifiedBy"
   column="MODIFIED_BY"
   jdbc-type="VARCHAR"
   nullable="false"
   length="255"
   />
   
   name="createdAt"
   column="CREATED_AT"
   jdbc-type="DATE"
   nullable="false"
   length="0"
   
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"
   />
   
   name="createdBy"
   column="CREATED_BY"
   jdbc-type="VARCHAR"
   nullable="false"
   length="255"
   />
   
   name="offerId"
   column="OFFALL_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion"
   />
   
   name="contentId"
   column="CONT_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion"
   />
   
   name="nameSpaceId"
   column="NSP_ID"
   jdbc-type="BIGINT"
   nullable="false"
   length="20"
   precision="0"
   
conversion="at.oekb.mda.util.persistence.ojb.conversion.BigDecimal2LongConversion"
   />

   
 
class-ref="at.oekb.roncalli.metadata.entity.OfferImpl"
 proxy="true">
   
   

   
 
class-ref="at.oekb.roncalli.metadata.entity.ContentImpl"
 proxy="true">
   
   

   
 
class-ref="at.oekb.roncalli.metadata.entity.NameSpaceImpl"
 proxy="true">
   
   

   
  
element-class-ref="at.oekb.roncalli.metadata.entity.OfferLineConditionImpl"
  proxy="true">
   
   

   
  
element-class-ref="at.oekb.roncalli.metadata.entity.DataTransferImpl"
  proxy="true">
   
   

   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Armin Waibel
Hi Martin,
I try to reproduce your problem without success. Could you please post a 
test case or detail describe (some pseudo code) what your are doing?
By the way, do you use anonymous keys in collection objects?

regards,
Armin
Martin Marinschek wrote:
I found out that the problem occurs if the JavaServer Faces framework 
serializes an object and reloads it afterwards.

Is it forbidden to serialize and recreate OJB-created objects with 
proxies in it? Do I have to mark the lists created by OJB as transient?

But if they are transient, on recreation I will surely loose 
information...  Should I write a converter for myself, being able to 
materialize the proxy-objects before they are serialized and serializing 
only the materialized objects?

best regards,
Martin
Martin Marinschek wrote:
Using OJB (release 1.0) in a web application (JSF, more clearly 
stated), I get an 'ArrayIndexOutOfBoundsException' when using the 
collection-proxy-feature.

If I debug the situation, I find out that shortly before I call the 
'ListProxyDefaultImpl.get(0)' method,  the list claims that it has 2 
entries, but it nevertheless throws the above mentioned exception...

The problem is that this failure occurs not always, but only from time 
to time and I am not quite sure what to do about it.

Anybody of you has a suggestion or a workaround? Or is this a bug?
Best regards,
Martin
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

   at java.lang.reflect.Method.invoke(Method.java:324)
   at 
net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:481) 

   ... 74 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out 
of range: 0
   at java.util.Vector.get(Vector.java:709)
   at 
org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.get(ListProxyDefaultImpl.java:71) 

   at 
at.oekb.roncalli.customized.entity.CustomizedOfferLineImpl.getSummarizedCustomerCondition(CustomizedOfferLineImpl.java:36) 

   ... 79 more
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ArrayIndexOutOfBoundsException - OJB 1.0

2004-07-05 Thread Martin Marinschek
I found out that the problem occurs if the JavaServer Faces framework 
serializes an object and reloads it afterwards.

Is it forbidden to serialize and recreate OJB-created objects with 
proxies in it? Do I have to mark the lists created by OJB as transient?

But if they are transient, on recreation I will surely loose 
information...  Should I write a converter for myself, being able to 
materialize the proxy-objects before they are serialized and serializing 
only the materialized objects?

best regards,
Martin
Martin Marinschek wrote:
Using OJB (release 1.0) in a web application (JSF, more clearly 
stated), I get an 'ArrayIndexOutOfBoundsException' when using the 
collection-proxy-feature.

If I debug the situation, I find out that shortly before I call the 
'ListProxyDefaultImpl.get(0)' method,  the list claims that it has 2 
entries, but it nevertheless throws the above mentioned exception...

The problem is that this failure occurs not always, but only from time 
to time and I am not quite sure what to do about it.

Anybody of you has a suggestion or a workaround? Or is this a bug?
Best regards,
Martin
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

   at java.lang.reflect.Method.invoke(Method.java:324)
   at 
net.sourceforge.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:481) 

   ... 74 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out 
of range: 0
   at java.util.Vector.get(Vector.java:709)
   at 
org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.get(ListProxyDefaultImpl.java:71) 

   at 
at.oekb.roncalli.customized.entity.CustomizedOfferLineImpl.getSummarizedCustomerCondition(CustomizedOfferLineImpl.java:36) 

   ... 79 more
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]