AW: Another strange ClassCastException

From: Michael Schuldt (m..scensys.de)
Date: Tue Nov 18 2003 - 02:24:50 EST

  • Next message: wwlo..itao.com: "modeler failed to load datamap"

    Hi Andrus,

    after using the new cayenne.jar I'm now getting a "" error right at the same
    point:

    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0.x-dev November 17
    2003] Cannot modify the read-only flattened relationship reaktiviertVonAlt
            at
    org.objectstyle.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.j
    ava:345)
            at de.best4rest.boerse._TbAngebot.setReaktiviertVonAlt(_TbAngebot.java:592)
            at
    de.best4rest.boerse.ProduktEinstellenAction.perform(ProduktEinstellenAction.
    java:241)
            at
    org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
    va:1787)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
            at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:247)
            at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
            at de.best4rest.boerse.SendMailFilter.doFilter(SendMailFilter.java:81)
            at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
            at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
            at de.best4rest.boerse.WerbungFilter.doFilter(WerbungFilter.java:183)
            at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
            at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
            at de.best4rest.boerse.UtilFilter.doFilter(UtilFilter.java:513)
            at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
            at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
            at
    de.best4rest.boerse.LogRequestParameterFilter.doFilter(LogRequestParameterFi
    lter.java:74)
            at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
    FilterChain.java:213)
            at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
    ain.java:193)
            at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
    va:256)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
            at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
    va:191)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
            at
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
    .java:553)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
            at
    org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
    46)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
            at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2408)
            at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
    )
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
            at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
    java:171)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
            at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
    )
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:641)
            at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
    :174)
            at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext(StandardPipeline.java:643)
            at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
            at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
            at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
    ction(Http11Protocol.java:392)
            at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
            at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
    a:619)
            at java.lang.Thread.run(Thread.java:536)

    I've found a workaraound by using a ToMany-relationship instead of a ToOne.
    This will work but causes me much work in several other classes and JSPs.

    Michael

    -----Ursprungliche Nachricht-----
    Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Gesendet: Dienstag, 18. November 2003 00:51
    An: cayenne-use..bjectstyle.org
    Betreff: Re: Another strange ClassCastException

    Michael,

    This is fixed in CVS. Before 1.0.4 goes out I would appreciate if you
    could test the fix. Please download patched Cayenne from

    http://objectstyle.org/downloads/cayenne/patched/cayenne-src-1.0.x-
    dev.tar.gz

    And let me know if it causes any problems. Also, I added more strict
    checks for read-only flattened relationship modification, so if you see
    exceptions like "Cannot modify the read-only flattened relationship",
    this is likely the code that didn't work before anyway. Still I'd like
    to know if this happens.

    Andrus

    On Nov 17, 2003, at 11:33 AM, Andrus Adamchik wrote:

    >
    > On Nov 17, 2003, at 11:07 AM, Michael Schuldt wrote:
    >
    >> Caused by: java.lang.ClassCastException
    >> at
    >> org.objectstyle.cayenne.access.SnapshotManager.isToOneTargetModified(S
    >> napsho
    >> tManager.java:313
    >
    > Same thing as before, only in a different place. Will fix it soon (and
    > also try to locate other places where Cayenne does a DataObject cast
    > without checking for faults).
    >
    >> Maybe the structure of my objects is important for this so I'm
    >> enclosing the
    >> important part of the xml-file.
    >
    > Yes, it confirms my idea that the problem is caused by flattened
    > relationships:
    >
    > <obj-relationship name="reaktiviertAls" source="TbAngebot"
    > target="TbAngebot" toMany="false">
    > <db-relationship-ref source="tb_angebot"
    > target="angebot_reaktivieren_assoz" name="toReaktiviertAssozVon"/>
    > <db-relationship-ref source="angebot_reaktivieren_assoz"
    > target="tb_angebot" name="fromReaktiviertAssozAls"/>
    > </obj-relationship>
    >
    > Andrus
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Nov 18 2003 - 02:25:05 EST