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
--
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#a13875454
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]