Re: Cayenne, Tapestry, Tomcat plumbling

From: Jin Lee (jinsle..mail.com)
Date: Fri Jan 14 2005 - 18:04:06 EST

  • Next message: Robert Zeigler: "[Fwd: Re: Cayenne, Tapestry, Tomcat plumbling]"

    Thank you everyone for your input! As you can see from my code, I'm
    still in the learning process... thanks for bearing with me.

    Erik, thank you for the tips. I went ahead and did everything you
    suggested. Same goes for Jason and Mike. I'm just confused because
    when I change the getPrimaryInvestigators method to return a
    StringPropertySelectionModel with simple test cases, everything runs
    fine (100% tapestry), but the moment I change the body of the
    getPrimaryInvestigators to return a DataObjectSelectionModel, I get
    that error.

    I will go ahead and ask on the tapestry list as well, thanks for the
    advice. Here is the complete stack trace for anyone who's interested:

    org.apache.tapestry.BindingException
    Unable to resolve expression 'primaryInvestigators' for
    assr.objects.NewASSR$Enhance_..f480e3[NewASSR].
    binding: ExpressionBinding[NewASSR primaryInvestigators]
    location: context:/WEB-INF/pages/NewASSR.page, line 29, column 66
     
    ognl.OgnlException
    primaryInvestigators
     
    java.lang.ClassCastException
    Stack Trace:

        * assr.ApplicationPage.getVisitDataContext(ApplicationPage.java:28)
        * assr.objects.NewASSR.getPrimaryInvestigators(NewASSR.java:51)
        * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        * sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        * sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        * java.lang.reflect.Method.invoke(Method.java:324)
        * ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:320)
        * ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:728)
        * ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:54)
        * ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
        * ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1443)
        * ognl.ASTProperty.getValueBody(ASTProperty.java:96)
        * ognl.SimpleNode.getValue(SimpleNode.java:192)
        * ognl.Ognl.getValue(Ognl.java:335)
        * ognl.Ognl.getValue(Ognl.java:310)
        * org.apache.tapestry.binding.ExpressionBinding.resolveProperty(ExpressionBinding.java:201)
        * org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:194)
        * org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:208)
        * org.apache.tapestry.param.AbstractParameterConnector.getBindingValue(AbstractParameterConnector.java:105)
        * org.apache.tapestry.param.ObjectParameterConnector.setParameter(ObjectParameterConnector.java:53)
        * org.apache.tapestry.param.ParameterManager.setParameters(ParameterManager.java:105)
        * org.apache.tapestry.AbstractComponent.prepareForRender(AbstractComponent.java:898)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:853)
        * org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
        * org.apache.tapestry.form.Form.renderComponent(Form.java:362)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
        * org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:45)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
        * org.apache.tapestry.html.Body.renderComponent(Body.java:269)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
        * org.apache.tapestry.html.Shell.renderComponent(Shell.java:124)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)
        * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        * org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:300)
        * org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:368)
        * org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:732)
        * org.apache.tapestry.engine.PageService.service(PageService.java:77)
        * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
        * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
        * org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158)
        * javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
        * javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
        * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
        * org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        * org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        * org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
        * org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
        * org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        * org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        * org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        * org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        * org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        * org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        * org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        * org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        * org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        * org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
        * org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
        * org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
        * org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
        * java.lang.Thread.run(Thread.java:534)

    and here is my getPrimaryInvestigators method::

        public IPropertySelectionModel getPrimaryInvestigators() {
            //uncomment below line and comment the rest, everything works fine
                //return new
    org.apache.tapestry.form.StringPropertySelectionModel(new String[]
    {"Hi", "its", "working!"});
            DataContext context = getVisitDataContext();
            SelectQuery q = new SelectQuery(TblPerson.class);
            List persons = context.performQuery(q);
                return new DataObjectSelectionModel(persons, "personFullName");
        }

    Thanks again everyone, you've all been a huge help.

    Jin Lee

    On Fri, 14 Jan 2005 16:15:02 -0500, Mike Kienenberger
    <mkienen..laska.net> wrote:
    > Jin Lee <jinsle..mail.com> wrote:
    > > To start off, I have cayenne.jar, tapestry.jar, and all the
    > > dependencies in tomcat_home/shared/lib. Is this okay, or should it be
    > > in the context's path?
    >
    > You're going to cause yourself all sorts of problems (classloading,
    > primarily, with a single app, versioning with multiple apps) if you do this.
    >
    > I recommend sticking this stuff into .../WEB-INF/lib.
    >
    >
    > > The problem lies in Tapestry's IPropertySelection. I have this method:
    > >
    > > public IPropertySelectionModel getPrimaryInvestigators() {
    > > Visit visit = (Visit) getPage().getVisit();
    > > DataContext context = visit.getDataContext();
    > > SelectQuery q = new SelectQuery(Person.class);
    > > List persons = context.performQuery(q);
    > > context.commitChanges();
    >
    > Why do you have a commitChanges() in a read-only method? Probably won't fix
    > anything, but I'd take it out since it's unnecessary (and will cause
    > hard-to-trace behavior if you modified the DataContext contents on an
    > earlier request).
    >
    >
    > > return new PersonModel(persons);
    > > }
    > >
    > > which return this error:
    > >
    > > Unable to resolve expression 'primaryInvestigators' for
    > > assr.objects.NewASSR$Enhance_4..d5534[NewASSR].
    >
    > I can't comment on the Tapestry side of things as I've only used WebObjects
    > and Struts.
    > I don't see anything obvious. The error above does not appear to be a
    > cayenne error, though. You might have better luck asking about it on the
    > the Tapestry list.
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 18:04:08 EST