I found the easiest way to track down these problems was to improve the
error messages thrown on these sort of exceptions, in RowReaderDefaultImpl,
I changed:
---
throw new PersistenceBrokerException("Unable to build object instance
:"+cld.getClassOfObject(),ex);
---
to:
---
throw new PersistenceBrokerException(
"Unable to build object instance :"+cld.getClassOfObject() +
", check that it has a default constructor"
,ex);
(Because it's almost always due to no default constructor).
---
And in PersistentFieldDefaultImpl under the line:
---
catch(IllegalAccessException e)
{
throw new MetadataException("Error setting field:"+f.getName()+"
in object:"+obj.getClass().getName(),e);
}
---
I added:
---
catch( IllegalArgumentException e ){
throw new MetadataException("Illegal argument: " + obj.getClass()
+ "." + f.getName() + " is of type " +
f.getType() + " but the argument is of type " + value.getClass()
);
}
---
There's other places as well that could benefit from the same sort of
thing... mostly it's just a matter of running with the OJB source code and
stepping through with the debugger.
Cheers,
Gareth.
> -----Original Message-----
> From: Thomas Mahler [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 19 September 2002 8:22 a.m.
> To: OJB Users List
> Subject: Re: IllegalArgumentException with simple 1:n mapping
>
>
> Hi,
>
> IMHO all these bug messages are user errors. There is no
> known problem
> in the PersistenField ACcessor classes.
>
> java.lang.IllegalArgumentException in this area clearly point
> to a type
> mismatch between java attributes and declaration in the
> repository.xml.
>
> cheers,
> Thomas
>
> Michael wrote:
> > I'm using OJB 0.9.5 with PostgreSQL 7.2. I'm trying to map
> a simple 1:n
> > relation, and I've followed the "Advanced O/R Mapping"
> example as well
> > as the example a fellow user shared with me in the mailing
> list. I get
> > the follow exception:
> >
> > java.lang.IllegalArgumentException
> > at
> >
> sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFiel
> dAccessorI
> > mpl.java:63)
> >
> > I searched the archives and I find 5 different posts with the same
> > problem and no solutions. I now suspect this is a bug with
> OJB. Can
> > someone please look into this for us?
> >
> > For more information, here are the 5 posts in the archives
> with the same
> > unsolved problem:
> >
> >
> http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb-user
@jakarta.a
> pache.org&msgId=440196
>
> http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
> pache.org&msgNo=1703
>
> http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
> pache.org&msgNo=196
>
> http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
> pache.org&msgId=425172
>
> http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]
> pache.org&msgId=442684
>
> Thanks
> Michael
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>