You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Warner Onstine <wa...@gmail.com> on 2005/10/25 20:29:13 UTC

proxy question

Hi all,
This is my first project using OJB so forgive me if this is a simple
question, however I can't find anything specific in the docs for this.

Currently we have an object called Account which extends another object
called BusinessObjectBase. We want to use proxying for any place where the
Account class is referenced so we created an AccountProxy interface class
that Account implements and then set the proxy="dynamic" for the class
declaration.

When we run the program we get the following error message:
org.springframework.orm.ojb.OjbOperationException: OJB operation failed;
nested exception is org.apache.ojb.broker.PersistenceBrokerException: Error
invoking method toString
org.apache.ojb.broker.PersistenceBrokerException: Error invoking method
toString
at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(
IndirectionHandlerDefaultImpl.java:334)
at $Proxy31.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2131)
at java.lang.StringBuffer.append(StringBuffer.java:370)

There is a toString method, but this method is at the BusinessObjectBase
level (not the Account level). Not sure exactly where we should be
extracting the toString method, or what we need to do to fix this particular
issue.

We are using ojb-1.0.3 with Spring 1.1.5

Thanks in advance,
Warner

Re: proxy question

Posted by Thomas Dudziak <to...@gmail.com>.
On 10/27/05, Warner Onstine <wa...@gmail.com> wrote:

> Alright so it does appear to have been caused by some weird classpath
> issue. But now I'm running into another problem.
>
> org.apache.ojb.broker.PersistenceBrokerException:
> org.apache.ojb.broker.PersistenceBrokerException: Error invoking
> method toString
>         at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.materializeSubject(IndirectionHandlerDefaultImpl.java:384)
>         at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.getRealSubject(IndirectionHandlerDefaultImpl.java:348)
>         at org.apache.ojb.broker.core.proxy.VirtualProxy.getRealSubject(VirtualProxy.java:135)

You could debug these methods to see whether the call

Object realSubject = broker.getObjectByIdentity(id);

that is in materializeSubject actually retrieves an object or not
(thus you'd end up with a null value).

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
Alright so it does appear to have been caused by some weird classpath
issue. But now I'm running into another problem.

org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.PersistenceBrokerException: Error invoking
method toString
	at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.materializeSubject(IndirectionHandlerDefaultImpl.java:384)
	at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.getRealSubject(IndirectionHandlerDefaultImpl.java:348)
	at org.apache.ojb.broker.core.proxy.VirtualProxy.getRealSubject(VirtualProxy.java:135)
	at org.kuali.module.chart.bo.AccountProxy.realSubject(AccountProxy.java:75)
	at org.kuali.module.chart.bo.AccountProxy.getAccountNumber(AccountProxy.java:87)
	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 org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
	at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132)
	at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
	at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
	at org.kuali.core.web.struts.pojo.PojoPropertyUtilsBean.getProperty(PojoPropertyUtilsBean.java:53)
	at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
	at org.kuali.core.util.BeanPropertyComparator.compare(BeanPropertyComparator.java:142)
	at java.util.Arrays.mergeSort(Arrays.java:1278)
	at java.util.Arrays.mergeSort(Arrays.java:1289)
	at java.util.Arrays.mergeSort(Arrays.java:1289)
	at java.util.Arrays.mergeSort(Arrays.java:1289)
	at java.util.Arrays.mergeSort(Arrays.java:1289)
	at java.util.Arrays.mergeSort(Arrays.java:1289)
	at java.util.Arrays.sort(Arrays.java:1219)
	at java.util.Collections.sort(Collections.java:155)
	at org.kuali.core.lookup.KualiLookupableImpl.getSearchResults(KualiLookupableImpl.java:321)
	at org.kuali.core.web.struts.action.KualiLookupAction.search(KualiLookupAction.java:90)
	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 org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
	at org.kuali.core.web.struts.action.KualiAction.execute(KualiAction.java:69)
	at org.kuali.core.web.struts.action.KualiRequestProcessor.processActionPerform(KualiRequestProcessor.java:233)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.kuali.core.web.filter.KualiCasFilter.doFilter(KualiCasFilter.java:106)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)
Caused by: org.apache.ojb.broker.PersistenceBrokerException: Error
invoking method toString
	at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(IndirectionHandlerDefaultImpl.java:334)
	at $Proxy32.toString(Unknown Source)
	at java.lang.String.valueOf(String.java:2131)
	at java.lang.StringBuffer.append(StringBuffer.java:370)
	at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase.buildMessageString(PersistentFieldBase.java:155)
	at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew.setValueFor(PersistentFieldDirectAccessImplNew.java:225)
	at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew.set(PersistentFieldDirectAccessImplNew.java:158)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:399)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(PersistenceBrokerImpl.java:1509)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:312)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:312)
	at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.materializeSubject(IndirectionHandlerDefaultImpl.java:375)
	... 69 more
Caused by: java.lang.NullPointerException
	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 org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(IndirectionHandlerDefaultImpl.java:325)
	... 98 more

It looks like it's trying to call toString on a null object, but why
that object is null in the first place is a little baffling.

Thanks for all the help, really appreciate it.

-warner

On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:
> Not really sure, I just wiped out the classes directory and rebuilt
> completely. Then I opened the class file generated and found the
> appropriate method in the class file, so I know it's there (and it's
> the only class named AccountProxy).
>
> Just to satisfy my curiosity I set it up through a debugger and by the
> time it gets to the exception I can see all of the constuctor methods
> (as referent under declaredConstructors). One of the odd things though
> is that declaredConstructors is marked in red in Eclipse which tells
> me something is wrong, but I have no idea what it is.
>
> -warner
>
> On 10/26/05, Thomas Dudziak <to...@gmail.com> wrote:
> > On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:
> >
> > > Well, I was hoping that that would do the trick but no dice. I'm still
> > > getting the error that it cannot create a proxy using my proxy class.
> >
> > <snip>
> >
> > > Caused by: java.lang.NoSuchMethodException:
> > > org.kuali.module.chart.bo.AccountProxy.<init>(java.lang.reflect.InvocationHandler)
> > >         at java.lang.Class.getConstructor0(Class.java:1937)
> > >         at java.lang.Class.getDeclaredConstructor(Class.java:1301)
> > >         at org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:116)
> > >
> > > I have now implemented the following constructors (and the
> > > Serializable interface per the unit test):
> > >     public AccountProxy(){
> > >         super();
> > >     }
> > >
> > >     public AccountProxy(PBKey key, Identity uniqueId) {
> > >         super(key, uniqueId);
> > >     }
> > >
> > >     public AccountProxy(IndirectionHandler handler) {
> > >         super(handler);
> > >     }
> > >
> > > Any other ideas?
> >
> > Could it be that you have some classpath problem there ? The exception
> > (and the corresponding source code of VirtualProxy) state that a
> > constructor with a single argument of IndirectionHandler is searched
> > for in your class, but could not be found.
> >
> > Tom
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
Not really sure, I just wiped out the classes directory and rebuilt
completely. Then I opened the class file generated and found the
appropriate method in the class file, so I know it's there (and it's
the only class named AccountProxy).

Just to satisfy my curiosity I set it up through a debugger and by the
time it gets to the exception I can see all of the constuctor methods
(as referent under declaredConstructors). One of the odd things though
is that declaredConstructors is marked in red in Eclipse which tells
me something is wrong, but I have no idea what it is.

-warner

On 10/26/05, Thomas Dudziak <to...@gmail.com> wrote:
> On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:
>
> > Well, I was hoping that that would do the trick but no dice. I'm still
> > getting the error that it cannot create a proxy using my proxy class.
>
> <snip>
>
> > Caused by: java.lang.NoSuchMethodException:
> > org.kuali.module.chart.bo.AccountProxy.<init>(java.lang.reflect.InvocationHandler)
> >         at java.lang.Class.getConstructor0(Class.java:1937)
> >         at java.lang.Class.getDeclaredConstructor(Class.java:1301)
> >         at org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:116)
> >
> > I have now implemented the following constructors (and the
> > Serializable interface per the unit test):
> >     public AccountProxy(){
> >         super();
> >     }
> >
> >     public AccountProxy(PBKey key, Identity uniqueId) {
> >         super(key, uniqueId);
> >     }
> >
> >     public AccountProxy(IndirectionHandler handler) {
> >         super(handler);
> >     }
> >
> > Any other ideas?
>
> Could it be that you have some classpath problem there ? The exception
> (and the corresponding source code of VirtualProxy) state that a
> constructor with a single argument of IndirectionHandler is searched
> for in your class, but could not be found.
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Thomas Dudziak <to...@gmail.com>.
On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:

> Well, I was hoping that that would do the trick but no dice. I'm still
> getting the error that it cannot create a proxy using my proxy class.

<snip>

> Caused by: java.lang.NoSuchMethodException:
> org.kuali.module.chart.bo.AccountProxy.<init>(java.lang.reflect.InvocationHandler)
>         at java.lang.Class.getConstructor0(Class.java:1937)
>         at java.lang.Class.getDeclaredConstructor(Class.java:1301)
>         at org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:116)
>
> I have now implemented the following constructors (and the
> Serializable interface per the unit test):
>     public AccountProxy(){
>         super();
>     }
>
>     public AccountProxy(PBKey key, Identity uniqueId) {
>         super(key, uniqueId);
>     }
>
>     public AccountProxy(IndirectionHandler handler) {
>         super(handler);
>     }
>
> Any other ideas?

Could it be that you have some classpath problem there ? The exception
(and the corresponding source code of VirtualProxy) state that a
constructor with a single argument of IndirectionHandler is searched
for in your class, but could not be found.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
Well, I was hoping that that would do the trick but no dice. I'm still
getting the error that it cannot create a proxy using my proxy class.

org.springframework.orm.ojb.OjbOperationException: OJB operation
failed; nested exception is
org.apache.ojb.broker.PersistenceBrokerException: Unable to create
proxy using class:org.kuali.module.chart.bo.AccountProxy
org.apache.ojb.broker.PersistenceBrokerException: Unable to create
proxy using class:org.kuali.module.chart.bo.AccountProxy
	at org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:123)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:549)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1454)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1537)
	at org.apache.ojb.broker.core.QueryReferenceBroker.getReferencedObject(QueryReferenceBroker.java:559)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:393)
	at org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:447)
	at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:480)
	at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:275)
	at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1636)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
	at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
	at org.springframework.orm.ojb.PersistenceBrokerTemplate$2.doInPersistenceBroker(PersistenceBrokerTemplate.java:208)
	at org.springframework.orm.ojb.PersistenceBrokerTemplate.execute(PersistenceBrokerTemplate.java:167)
	at org.springframework.orm.ojb.PersistenceBrokerTemplate.getObjectByQuery(PersistenceBrokerTemplate.java:206)
	at org.kuali.core.dao.ojb.KualiUserDaoOjb.getUser(KualiUserDaoOjb.java:69)
	at org.kuali.core.service.impl.KualiUserServiceImpl.getUser(KualiUserServiceImpl.java:51)
	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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:284)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
	at $Proxy1.getUser(Unknown Source)
	at org.kuali.core.UserSession.<init>(UserSession.java:73)
	at org.kuali.tasks.scheduledtasks.DocumentStatusChangeCheckerService.run(DocumentStatusChangeCheckerService.java:55)
	at java.util.TimerThread.mainLoop(Timer.java:432)
	at java.util.TimerThread.run(Timer.java:382)
Caused by: java.lang.NoSuchMethodException:
org.kuali.module.chart.bo.AccountProxy.<init>(java.lang.reflect.InvocationHandler)
	at java.lang.Class.getConstructor0(Class.java:1937)
	at java.lang.Class.getDeclaredConstructor(Class.java:1301)
	at org.apache.ojb.broker.core.proxy.VirtualProxy.createProxy(VirtualProxy.java:116)

I have now implemented the following constructors (and the
Serializable interface per the unit test):
    public AccountProxy(){
        super();
    }

    public AccountProxy(PBKey key, Identity uniqueId) {
        super(key, uniqueId);
    }

    public AccountProxy(IndirectionHandler handler) {
        super(handler);
    }

Any other ideas?

-warner

On 10/26/05, Thomas Dudziak <to...@gmail.com> wrote:
>
> In the unit tests there is an example of such a proxy:
>
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/broker/ProductGroupProxy.java?rev=1.5.2.3&view=markup
>
> I haven't checked the docs, but if you say that there are no longer
> valid, please add an issue to OJB's JIRA so that we do not forget to
> update them for the next release.
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Thomas Dudziak <to...@gmail.com>.
On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:

> Ok, I'm working on implementing the custom proxy class and am having
> some issues. When I try and use my custom Proxy class I get the
> following:
>
> Unable to create proxy using class:org.kuali.module.chart.bo.AccountProxy
>
> AccountProxy extends the VirtualProxy class and implements my
> interface that I want. I also added in the following constructor:
> public AccountProxy(IndirectionHandler handler) {
>     super(handler);
> }
>
> After I initially got the error message. In the docs it references
> another constructor that accepts an Identity and PersistenceBroker,
> but this no longer seems to be the right way to do this, is this
> correct?

In the unit tests there is an example of such a proxy:

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/broker/ProductGroupProxy.java?rev=1.5.2.3&view=markup

I haven't checked the docs, but if you say that there are no longer
valid, please add an issue to OJB's JIRA so that we do not forget to
update them for the next release.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
Ok, I'm working on implementing the custom proxy class and am having
some issues. When I try and use my custom Proxy class I get the
following:

Unable to create proxy using class:org.kuali.module.chart.bo.AccountProxy

AccountProxy extends the VirtualProxy class and implements my
interface that I want. I also added in the following constructor:
public AccountProxy(IndirectionHandler handler) {
    super(handler);
}

After I initially got the error message. In the docs it references
another constructor that accepts an Identity and PersistenceBroker,
but this no longer seems to be the right way to do this, is this
correct?

-warner

On 10/25/05, Warner Onstine <wa...@gmail.com> wrote:
>
>
>
> On 10/25/05, Thomas Dudziak <to...@gmail.com> wrote:
> >  On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:
> >
> > > That's what was unclear. We initially thought that the class specified was
> > > the implementation, not the interface (the docs are not clear on this
> > > subject).
> > >
> > > So, here is our situation, we would like to implement proxies, but we want
> > > to do it in a non-invasive way. Should we create a custom proxy class that
> > > is used instead?
> >
> > First, you should be clear that proxies actually help you. IMO most of
> > the time they make sense for collections to avoid materializing
> > elements of the collection. But this is best handled via a collection
> > proxy.
> > I tend to use proxies only in collections and in references when they
> > are back-references (the other end of a collection). And I never
> > specify them for the class but rather in the reference/collection. For
> > these references, I introduce interfaces and implementations, which
> > both of them I map via OJB. This is slightly more complicated but
> > works like a charm.
>
>
>  Interesting. I'm not sure if this fits with our model, I'll have to investigate a bit on this approach.
>
>
> > Btw, you could also try to use CGLib-proxies which are some sort of
> > auto-generated proxies where no interfaces are needed at all. You
> > enable them in OJB.properties via the ProxyFactoryClass and the
> > IndirectionHandlerClass settings, and then use 'dynamic' in your
> > class-descriptor.
> > I'm not sure whether they are already in 1.0.3 though, if not then
> > you'd have to check out OJB from CVS or wait until the 1.0.4 RC that
> > is due in the next weeks.
>
>
>  Excellent, yeah cglib proxies are not in 1.0.3 (as the class we were having issues with is no longer in CVS ;-).
>
>  -warner
>
>
> > Tom
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
On 10/25/05, Thomas Dudziak <to...@gmail.com> wrote:
>
> On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:
>
> > That's what was unclear. We initially thought that the class specified
> was
> > the implementation, not the interface (the docs are not clear on this
> > subject).
> >
> > So, here is our situation, we would like to implement proxies, but we
> want
> > to do it in a non-invasive way. Should we create a custom proxy class
> that
> > is used instead?
>
> First, you should be clear that proxies actually help you. IMO most of
> the time they make sense for collections to avoid materializing
> elements of the collection. But this is best handled via a collection
> proxy.
> I tend to use proxies only in collections and in references when they
> are back-references (the other end of a collection). And I never
> specify them for the class but rather in the reference/collection. For
> these references, I introduce interfaces and implementations, which
> both of them I map via OJB. This is slightly more complicated but
> works like a charm.


Interesting. I'm not sure if this fits with our model, I'll have to
investigate a bit on this approach.

Btw, you could also try to use CGLib-proxies which are some sort of
> auto-generated proxies where no interfaces are needed at all. You
> enable them in OJB.properties via the ProxyFactoryClass and the
> IndirectionHandlerClass settings, and then use 'dynamic' in your
> class-descriptor.
> I'm not sure whether they are already in 1.0.3 though, if not then
> you'd have to check out OJB from CVS or wait until the 1.0.4 RC that
> is due in the next weeks.


Excellent, yeah cglib proxies are not in 1.0.3 (as the class we were having
issues with is no longer in CVS ;-).

-warner

Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: proxy question

Posted by Thomas Dudziak <to...@gmail.com>.
On 10/26/05, Warner Onstine <wa...@gmail.com> wrote:

> That's what was unclear. We initially thought that the class specified was
> the implementation, not the interface (the docs are not clear on this
> subject).
>
> So, here is our situation, we would like to implement proxies, but we want
> to do it in a non-invasive way. Should we create a custom proxy class that
> is used instead?

First, you should be clear that proxies actually help you. IMO most of
the time they make sense for collections to avoid materializing
elements of the collection. But this is best handled via a collection
proxy.
I tend to use proxies only in collections and in references when they
are back-references (the other end of a collection). And I never
specify them for the class but rather in the reference/collection. For
these references, I introduce interfaces and implementations, which
both of them I map via OJB. This is slightly more complicated but
works like a charm.

Btw, you could also try to use CGLib-proxies which are some sort of
auto-generated proxies where no interfaces are needed at all. You
enable them in OJB.properties via the ProxyFactoryClass and the
IndirectionHandlerClass settings, and then use 'dynamic' in your
class-descriptor.
I'm not sure whether they are already in 1.0.3 though, if not then
you'd have to check out OJB from CVS or wait until the 1.0.4 RC that
is due in the next weeks.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: proxy question

Posted by Warner Onstine <wa...@gmail.com>.
That's what was unclear. We initially thought that the class specified was
the implementation, not the interface (the docs are not clear on this
subject).

So, here is our situation, we would like to implement proxies, but we want
to do it in a non-invasive way. Should we create a custom proxy class that
is used instead?

-warner

On 10/25/05, Thomas Dudziak <to...@gmail.com> wrote:
>
> On 10/25/05, Warner Onstine <wa...@gmail.com> wrote:
> > Hi all,
> > This is my first project using OJB so forgive me if this is a simple
> > question, however I can't find anything specific in the docs for this.
> >
> > Currently we have an object called Account which extends another object
> > called BusinessObjectBase. We want to use proxying for any place where
> the
> > Account class is referenced so we created an AccountProxy interface
> class
> > that Account implements and then set the proxy="dynamic" for the class
> > declaration.
> >
> > When we run the program we get the following error message:
> > org.springframework.orm.ojb.OjbOperationException: OJB operation failed;
> > nested exception is org.apache.ojb.broker.PersistenceBrokerException:
> Error
> > invoking method toString
> > org.apache.ojb.broker.PersistenceBrokerException: Error invoking method
> > toString
> > at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke
> (
> > IndirectionHandlerDefaultImpl.java:334)
> > at $Proxy31.toString(Unknown Source)
> > at java.lang.String.valueOf(String.java:2131)
> > at java.lang.StringBuffer.append(StringBuffer.java:370)
> >
> > There is a toString method, but this method is at the BusinessObjectBase
> > level (not the Account level). Not sure exactly where we should be
> > extracting the toString method, or what we need to do to fix this
> particular
> > issue.
> >
> > We are using ojb-1.0.3 with Spring 1.1.5
>
> If you have a specific proxy interface, then you should specify it
> instead of the 'dynamic' value (which is reserved for when the type
> that the class-descriptor references, is an interface itself, or if
> you use CGLib-proxies). See here for details:
>
>
> http://db.apache.org/ojb/docu/guides/basic-technique.html#Using+Proxy+Classes
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: proxy question

Posted by Thomas Dudziak <to...@gmail.com>.
On 10/25/05, Warner Onstine <wa...@gmail.com> wrote:
> Hi all,
> This is my first project using OJB so forgive me if this is a simple
> question, however I can't find anything specific in the docs for this.
>
> Currently we have an object called Account which extends another object
> called BusinessObjectBase. We want to use proxying for any place where the
> Account class is referenced so we created an AccountProxy interface class
> that Account implements and then set the proxy="dynamic" for the class
> declaration.
>
> When we run the program we get the following error message:
> org.springframework.orm.ojb.OjbOperationException: OJB operation failed;
> nested exception is org.apache.ojb.broker.PersistenceBrokerException: Error
> invoking method toString
> org.apache.ojb.broker.PersistenceBrokerException: Error invoking method
> toString
> at org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(
> IndirectionHandlerDefaultImpl.java:334)
> at $Proxy31.toString(Unknown Source)
> at java.lang.String.valueOf(String.java:2131)
> at java.lang.StringBuffer.append(StringBuffer.java:370)
>
> There is a toString method, but this method is at the BusinessObjectBase
> level (not the Account level). Not sure exactly where we should be
> extracting the toString method, or what we need to do to fix this particular
> issue.
>
> We are using ojb-1.0.3 with Spring 1.1.5

If you have a specific proxy interface, then you should specify it
instead of the 'dynamic' value (which is reserved for when the type
that the class-descriptor references, is an interface itself, or if
you use CGLib-proxies). See here for details:

http://db.apache.org/ojb/docu/guides/basic-technique.html#Using+Proxy+Classes

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org