Hi,

Looking at the stack trace, I am quite puzzled. Given what you have
provided so far, it is very hard for me to tell whether Castor is/is not
including the roles property as part of the marshalling. All I know is
that at your front-end, something is trying to obtain a handle to role
entities through Hibernate, and when doing so, throws an exception that
it fails to do so (as apparently the collection (defined as lazy-loaded)
cannot be initialited successfully).

Can you show us what the output Castor's Marshaller generated looks like
? 

Werner

> -----Original Message-----
> From: Ralf Joachim [mailto:[EMAIL PROTECTED] 
> Sent: Samstag, 12. November 2005 12:45
> To: [email protected]
> Subject: Re: [castor-user] Unable to prevent Castor from 
> accessing Object field using transient="true"
> 
> Hi Sandeep,
> 
> have you tried to remove the mapping for rules.
> 
> Regards
> Ralf
> 
> 
> Sandeep Khanna schrieb:
> 
> >Hi All,
> >
> >I have created a Castor mapping file for marshalling (creating XML 
> >text) for an Object called ClientDcl.
> >
> >ClientDcl has a field '_roles' of type Set. Through debugging I have 
> >found that trying to expand the _roles node in Eclipse debugger 
> >variabled view gives me a Hibernate exception. So very 
> obviously even 
> >Castor gets that when it tries to walk down the ClientDcl object and 
> >it's field _roles.
> >
> >To prevent the above and letting Castor marshall the object 
> to XML, I 
> >tried to set the _roles field as 'transient' as following:
> >/************************ castor-mapping.xml 
> *************************/
> >     <class name="com.adminserver.dcl.ClientDcl" 
> identity="_clientGuid"
> >access="shared"
> >          auto-complete="true">
> >          <field name="roles" type="com.adminserver.dcl.RoleDcl"
> >get-method="getRoles"
> >               set-method="setRoles" collection="set" 
> transient="true">
> >               <bind-xml name="Roles" node="element"/>
> >          </field>
> ></class>
> >/************************************************************
> *********/
> >
> >But, when I try to marshall the ClientDcl using the 
> following code, I 
> >still get the Hibernate exception and no marshalled XML!!
> >
> >/********************* Code to Marshal to XML 
> >*************************/ Marshaller marshaller = new 
> Marshaller( new PrintWriter( System.out) );
> >            Mapping castorMapping = new Mapping();
> >            InputSource inputSource = new InputSource( 
> >getClass().getResourceAsStream( "/castor-mapping.xml" ) );
> >            if( null != inputSource ){
> >               castorMapping.loadMapping( inputSource );
> >               marshaller.setMapping( castorMapping );
> >               Marshaller.marshal( result, new PrintWriter( 
> System.out) 
> >);
> >            }
> >/************************************************************
> **********
> >/
> >
> >/*************************** Exception 
> >********************************/
> >13:01:12,607 ERROR [LazyInitializationException] failed to lazily 
> >initialize a collection (com.adminserver.dcl.ClientDcl.roles) - no 
> >session or session was closed
> >org.hibernate.LazyInitializationException: failed to lazily 
> initialize 
> >a collection (com.adminserver.dcl.ClientDcl.roles) - no session or 
> >session was closed at
> >org.hibernate.collection.AbstractPersistentCollection.initial
> ize(AbstractPersistentCollection.java:180)
> >     at
> >org.hibernate.collection.AbstractPersistentCollection.read(Ab
> stractPersistentCollection.java:48)
> >     at
> >org.hibernate.collection.PersistentSet.toString(PersistentSet
> .java:222)
> >     at
> >com.adminserver.uip.ClientSearchActionUip.execute(ClientSearc
> hActionUip.java:102)
> >     at
> >org.apache.struts.action.RequestProcessor.processActionPerfor
> m(RequestProcessor.java:421)
> >     at
> >org.apache.struts.action.RequestProcessor.process(RequestProc
> essor.java:226)
> >     at
> >org.apache.struts.action.ActionServlet.process(ActionServlet.
> java:1164)
> >     at 
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >     at
> >org.apache.catalina.core.ApplicationFilterChain.internalDoFil
> ter(ApplicationFilterChain.java:237)
> >     at
> >org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
> icationFilterChain.java:157)
> >     at
> >org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(Reply
> HeaderFilter.java:75)
> >     at
> >org.apache.catalina.core.ApplicationFilterChain.internalDoFil
> ter(ApplicationFilterChain.java:186)
> >     at
> >org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
> icationFilterChain.java:157)
> >     at
> >org.apache.catalina.core.StandardWrapperValve.invoke(Standard
> WrapperValve.java:214)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:104)
> >     at
> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> line.java:520)
> >     at
> >org.apache.catalina.core.StandardContextValve.invokeInternal(
> StandardContextValve.java:198)
> >     at
> >org.apache.catalina.core.StandardContextValve.invoke(Standard
> ContextValve.java:152)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:104)
> >     at
> >org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(Cus
> tomPrincipalValve.java:66)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:102)
> >     at
> >org.jboss.web.tomcat.security.SecurityAssociationValve.invoke
> (SecurityAssociationValve.java:150)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:102)
> >     at
> >org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccCon
> textValve.java:54)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:102)
> >     at
> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> line.java:520)
> >     at
> >org.apache.catalina.core.StandardHostValve.invoke(StandardHos
> tValve.java:137)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:104)
> >     at
> >org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepor
> tValve.java:118)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:102)
> >     at
> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> line.java:520)
> >     at
> >org.apache.catalina.core.StandardEngineValve.invoke(StandardE
> ngineValve.java:109)
> >     at
> >org.apache.catalina.core.StandardValveContext.invokeNext(Stan
> dardValveContext.java:104)
> >     at
> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> line.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(Http11Proces
> sor.java:799)
> >     at org.apache.coyote.http11.Http11Protocol
> >$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> >     at
> >org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpo
> int.java:577)
> >     at org.apache.tomcat.util.threads.ThreadPool
> >$ControlRunnable.run(ThreadPool.java:683)
> >     at java.lang.Thread.run(Thread.java:534)
> >/************************************************************
> *********/
> >
> >Any idea what's going wrong?
> >
> >Thanks in advance,
> >Sandeep Khanna
> >
> >
> >
> >-------------------------------------------------
> >If you wish to unsubscribe from this list, please send an 
> empty message 
> >to the following address:
> >
> >[EMAIL PROTECTED]
> >-------------------------------------------------
> >  
> >
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please send an 
> empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 
> 

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to