hi again, I tried the methods you adviced but nothing changes.I think the problem is about the weblogic and oo communication since we deploy the servlet on tomcat server on the same machine and it works well. I wonder if someone used oo with weblogic server.Maybe we are missing something that must be done because we get this exception at the time of initialization of the open office.. Any ideas and help would be appreciated..
yasemin Stephan Bergmann wrote: > > This might be the issue described at > <http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=17855> and > turned down at > <http://www.openoffice.org/issues/show_bug.cgi?id=51323#desc4>: Once > doPost is done, the bridge will eventually be disposed when garbage > collection detects that there are no longer any live objects mapped > across it. If the Bootstrap.bootstrap of the next doPost comes at an > unfortunate time relative to garbage collection (whose timing will vary > with JVM details; which would explain why something that appears to work > fine in one scenario breaks in another), it will find an existing but > disposed bridge. > > Various ways around this come to mind: > > 1 Change your code to do only one Bootstrap.bootstrap call, sharing the > returned context across doPost calls. > > 2 With issue 51323 (see above) fixed and eventually integrated, it > might be better if Bootstrap.bootstrap used an unnamed (i.e., fresh on > every call) bridge instead of a named one (i.e., reusing a bridge for > the lifetime of the involved soffice process). The drawback would be > that applications that now call Bootstrap.bootstrap multiple times but > rely on having only one bridge to soffice at any given time would then > have potentially many different bridges to soffice simultaneously, which > could be a resource problem. > > 3 Simply retry Bootstrap.bootstrap when it failed with a > DisposedException. > > -Stephan > > yasemin wrote: >> We're working with soffice in a server. We use it for document creation >> and >> manipulation. >> >> Everything works fine under Tomcat Server however when we test the >> application on real environment server which is Windows 2003 Server 64 >> bit >> and Weblogic as application server we start getting the following >> exception: >> com.sun.star.lang.DisposedException: java_remote_bridge >> [EMAIL PROTECTED] is >> disposed >> at >> com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.checkDisposed(java_remote_bridge.java:720) >> at >> com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639) >> at >> com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendInternalRequest(java_remote_bridge.java:687) >> at >> com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.getInstance(java_remote_bridge.java:587) >> at >> com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:140) >> at >> com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:292) >> at >> tr.gov.ssm.servlet.RTFConverterServlet.doPost(RTFConverterServlet.java:84) >> at >> tr.gov.ssm.servlet.RTFConverterServlet.doGet(RTFConverterServlet.java:66) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >> at >> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077) >> at >> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465) >> at >> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348) >> at >> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047) >> at >> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) >> at >> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) >> at >> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902) >> at >> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773) >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224) >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183). >> This exception occurs on the line Bootstrap.bootstrap();after >> getting it, the sofffice >> services still running. >> >> Here is the Servlet code we have, >> >> package tr.gov.ssm.servlet; >> >> import java.io.File; >> import java.io.IOException; >> >> import javax.servlet.ServletException; >> import javax.servlet.http.HttpServletRequest; >> import javax.servlet.http.HttpServletResponse; >> >> import tr.gov.ssm.util.Constants; >> import tr.gov.ssm.util.ReadXML; >> import tr.gov.ssm.util.UploadDownload; >> >> import com.sun.star.beans.PropertyValue; >> import com.sun.star.comp.helper.Bootstrap; >> import com.sun.star.comp.helper.BootstrapException; >> import com.sun.star.container.XNameAccess; >> import com.sun.star.frame.XComponentLoader; >> import com.sun.star.frame.XStorable; >> import com.sun.star.lang.XComponent; >> import com.sun.star.lang.XMultiComponentFactory; >> import com.sun.star.text.XBookmarksSupplier; >> import com.sun.star.text.XTextContent; >> import com.sun.star.text.XTextRange; >> import com.sun.star.uno.Exception; >> import com.sun.star.uno.UnoRuntime; >> import com.sun.star.uno.XComponentContext; >> import com.sun.star.util.CloseVetoException; >> import com.sun.star.util.XCloseable; >> >> public class RTFConverterServlet extends javax.servlet.http.HttpServlet >> implements javax.servlet.Servlet, Constants { >> static final long serialVersionUID = 1L; >> >> PropertyValue OO_PROPERTY_HIDDEN; >> PropertyValue OO_INTERACTION_HANDLER; >> PropertyValue OO_MS_WORD_97; >> PropertyValue OO_RTF; >> >> public RTFConverterServlet() { >> super(); >> >> OO_PROPERTY_HIDDEN = new PropertyValue(); >> OO_PROPERTY_HIDDEN.Name = "Hidden"; >> OO_PROPERTY_HIDDEN.Value = Boolean.TRUE; >> >> OO_MS_WORD_97 = new PropertyValue(); >> OO_MS_WORD_97.Name = "FilterName"; >> OO_MS_WORD_97.Value = "MS Word 97"; >> >> OO_RTF = new PropertyValue(); >> OO_RTF.Name = "FilterName"; >> OO_RTF.Value = "Rich Text Format"; >> >> >> } >> >> protected void doGet(HttpServletRequest request, >> HttpServletResponse response) throws ServletException, >> IOException { >> >> doPost(request, response); >> >> } >> >> protected void doPost(HttpServletRequest request, >> HttpServletResponse response) throws ServletException, >> IOException { >> >> XComponentContext context = null; >> XMultiComponentFactory serviceManager = null; >> XComponentLoader loader = null; >> >> >> String fileName; >> String fileNameup; >> String fileNameXML; >> try { >> >> >> context = Bootstrap.bootstrap(); >> fileNameup = request.getParameter(EVRAK_PARAM) + ".rtf"; >> fileNameXML = request.getParameter(EVRAK_PARAM) + >> ".xml"; >> >> System.out.println("Connected to a running office..."); >> serviceManager = context.getServiceManager(); >> loader = (XComponentLoader) >> UnoRuntime.queryInterface(XComponentLoader.class, >> serviceManager.createInstanceWithContext( >> >> "com.sun.star.frame.Desktop", context)); >> >> fileName = "template.rtf"; >> >> >> >> XComponent component = >> loader.loadComponentFromURL("file:///c:/"+ >> fileName, DOWNLOAD_AS, 0,new PropertyValue[] { OO_PROPERTY_HIDDEN }); >> >> XBookmarksSupplier xBookmarksSupplier = >> (XBookmarksSupplier) >> UnoRuntime >> >> .queryInterface(XBookmarksSupplier.class, component); >> XNameAccess xNamedBookmarks = >> xBookmarksSupplier.getBookmarks(); >> >> String fields[] = xNamedBookmarks.getElementNames(); >> >> for (int i = 0; fields.length > i; i++) { >> String field = fields[i]; >> >> System.out.println(field); >> >> Object bookmark = >> xNamedBookmarks.getByName(field); >> >> XTextContent xBookmarkContent = (XTextContent) >> UnoRuntime >> >> .queryInterface(XTextContent.class, bookmark); >> >> XTextRange xBookmarkRange = >> xBookmarkContent.getAnchor(); >> >> String res = request.getParameter(field); >> >> System.out.println(res); >> >> if (res != null) { >> xBookmarkRange.setString(res); >> } >> >> } >> >> XStorable xStorable = (XStorable) >> UnoRuntime.queryInterface(XStorable.class, component); >> >> String filepath = UPLOAD_PATH + fileNameup; >> >> System.out.println(filepath); >> >> File filex = new File(filepath); >> >> xStorable.storeAsURL("file:///"+ >> filex.toString().replace('\\', >> '/'),new >> PropertyValue[] { OO_RTF }); >> >> XCloseable xCloseable = (XCloseable) >> UnoRuntime.queryInterface(XCloseable.class, component); >> >> try { >> >> if (xCloseable != null) { >> xCloseable.close(false); >> } >> else >> { >> com.sun.star.lang.XComponent xComp >> = >> (com.sun.star.lang.XComponent)UnoRuntime.queryInterface(com.sun.star.lang.XComponent.class,component >> ); >> xComp.dispose(); >> } >> >> System.out.println("document closed!"); >> >> } catch (CloseVetoException e) { >> System.out.println("CloseVetoException >> catched"); >> e.printStackTrace(); >> } >> >> ReadXML r = new ReadXML(XML_PATH + fileNameXML); >> r.readXml(); >> >> UploadDownload u = new UploadDownload(); >> >> u.upload(r.dp.getObjectID(), UPLOAD_PATH + fileNameup); >> filex.delete(); >> >> >> } catch (BootstrapException e) { >> System.out.println("BootstrapException catched"); >> e.printStackTrace(); >> >> } catch (Exception e) { >> System.out.println("Exception catched"); >> e.printStackTrace(); >> >> } >> >> } >> } >> >> We're willing to solve this problem and help to debug it. Any ideas and >> help >> would be appreciated >> >> ENVIRONMENT >> >> JVM = 1.4 bea JRockIt >> Weblogic = 8.1.6 >> OS = Window 2003 Server 64 bit >> >> Thanks in advance >> >> yasemin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/java_remote_bridge-com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge%406f2281-is-disposed-tf4849554.html#a13938467 Sent from the openoffice - api dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
