Re: Cayenne, Tapestry, Tomcat plumbling

From: Eric Schneider (eri..entralparksoftware.com)
Date: Sat Jan 15 2005 - 11:09:58 EST

  • Next message: JR Ruggentaler: "Generate unique account number"

    Jin,

    It still looks like you're trying to set a string on the value binding
    in the PropertySelection.

    Make sure you have an instance variable of type TblPerson on your
    page...like:

    public TblPerson selectedPrimaryInvestigator;

    In your .html:

    <span jwcid=..ropertySelection" model="ognl:primaryInvestigators"
    value="ognl: selectedPrimaryInvestigator"/>

    If that doesn't do it, then I'm not sure what the problem is. :-\

    Cheers,
    e.

    On Jan 14, 2005, at 6:04 PM, Jin Lee wrote:

    > 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.ja
    > va:39)
    > *
    > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
    > rImpl.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(Expressio
    > nBinding.java:201)
    > *
    > org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBindi
    > ng.java:194)
    > *
    > org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.j
    > ava:208)
    > *
    > org.apache.tapestry.param.AbstractParameterConnector.getBindingValue(Ab
    > stractParameterConnector.java:105)
    > *
    > org.apache.tapestry.param.ObjectParameterConnector.setParameter(ObjectP
    > arameterConnector.java:53)
    > *
    > org.apache.tapestry.param.ParameterManager.setParameters(ParameterManag
    > er.java:105)
    > *
    > org.apache.tapestry.AbstractComponent.prepareForRender(AbstractComponen
    > t.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.ja
    > va: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.jav
    > a: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(Applic
    > ationFilterChain.java:237)
    > *
    > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
    > terChain.java:157)
    > *
    > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
    > ve.java:214)
    > *
    > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
    > ontext.java:104)
    > *
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 520)
    > *
    > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo
    > ntextValve.java:198)
    > *
    > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
    > ve.java:152)
    > *
    > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
    > ontext.java:104)
    > *
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 520)
    > *
    > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
    > a:137)
    > *
    > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
    > ontext.java:104)
    > *
    > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
    > a:117)
    > *
    > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
    > ontext.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(StandardValveC
    > ontext.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.process
    > Connection(Http11Protocol.java:702)
    > *
    > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
    > 571)
    > *
    > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo
    > l.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 : Sat Jan 15 2005 - 11:08:45 EST