Yes, marshallDocument() is documented as closing the output stream/writer (indirectly - it says it's the same as calling a sequence ending with endDocument(), and endDocument() says it closes the output. To avoid this, you can just marshal your object directly (by casting the object to IMarshallable, then using the marshal() method of that interface).
- Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Varghese wrote: > Once the marshallDocument method is invoked with sysout as the output > stream, sysouts after that stops working. > > mctx.marshalDocument(objA, "UTF-8", null, System.out); > System.out.println("objA marshall complete"); > mctx.marshalDocument(objB, "UTF-8", null, System.out); > System.out.println("objB marshall complete"); > > Its because the jibx is doing the equivalent of System.out.close() > somewhere in the code. > > On a little analysis: > org.jibx.runtime.impl.MarshallingContext.endDocument() calls the > m_writer.close(), > which invokes the UTF8StreamWriter.close() . > > If the close method in StreamWriterBase is modified as follows then the > stream are only closed if it is not the sysout stream. > > public void close() throws IOException { > flush(); > if (m_stream != null && m_stream != System.out) { > m_stream.close(); > m_stream = null; > } > } > > I have not tested this fix, just enumerating on one of the possible > solutions. > I have sent the same mail to the dev user group by mistake > > regards > Varghese > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users