Issue 82332 - get rid of javaw after OO sdk work is complete
Summary: get rid of javaw after OO sdk work is complete
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows Vista
: P3 Trivial
Target Milestone: ---
Assignee: jsc
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-06 10:46 UTC by malokran
Modified: 2013-02-24 21:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
test case (4.33 KB, application/x-compressed)
2007-10-09 21:46 UTC, malokran
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description malokran 2007-10-06 10:46:38 UTC
With OO SDK I succeed to convert an html file (made with OO) to a pdf file.
It works perfectly.
The problem is that a javaw.exe task is started in memory (about 8 M), and I
cannot get rid of it when I do not need it any more.
I presume the javaw starts when I code xContext = ...bootstrap(), but there
seems to exist no OO sdk code to stop it.
Each time I call my new HtmlToPdf object with xContext... in its constructor, a
new javaws starts.
To avoid having plenty of javaws in memory, I am forced to find a way to create
HtmlToPdf only once, and then call its convert() method each time I need.
That is acceptable, but it would be nice to be able to get rid of this javaw, at
least at the end of the whole application, by coding something from the OO sdk api. 
(I searched several hours on the net to find a solution, and tried several
close() and dispose() on oDesktop, xMCF, xContext... in addition to xStorable)
Thanks. 
(I intend to use this on Linux at final stage)
Comment 1 jsc 2007-10-08 09:12:38 UTC
mmh that sounds strange. All the methods you have mentioned don't start a javaw
process. I can run a Java cleint program and do some document conversion ou tof
the box without any javaw process involved. Can you provide a demo example or
better or source code as attachment to this issue. I can then try to figure out
what going wrong. 
Or try to use our NetBeans plugin to create a Java UNO client program. And use
the the examples from the SDK to extend the generated example with your needed
conversion functionality.
Comment 2 malokran 2007-10-09 21:42:52 UTC
Thanks for your proposal.
Please find attached my test program (see comments in the source - I 
encountered another dificulty).
I think you are right : the javaw I want to get rid of is in fact my test 
program's jvm, not OO's. But why does it not disappear when the job is done ?
Comment 3 malokran 2007-10-09 21:46:02 UTC
Created attachment 48791 [details]
test case
Comment 4 jsc 2007-10-30 08:22:47 UTC
hi, i have marked the issue as invalid because it is no OO issue. I will take a
look into your example as soon as i have time for it. currently i am really busy
with and i can take some time.

You should try a System.exit to make sure that all UNO objects are gone. We
don't have influence on the garbage collector and for example the NB plugin
generate a System.exit call at the end as well.
Comment 5 malokran 2007-10-30 08:33:29 UTC
ok, I will investigate more on my side as you say and tell you if I succeed
Comment 6 malokran 2007-11-04 17:37:23 UTC
Well, I have put together the conditions to make the conversion from html to pdf
work, in my case. I read that one can ask OO to make this conversion locally or
remotly. I am just interested in local conversion, requested by a servlet in an
application server (WebSphere CE V2).

I had problems when I was copying juh, jurt, ridl, unoil jars inside WEB-INF/lib
of the war application. Then I realized that the same conversion, requested by a
main program in Eclipse, was working just because I referenced (without copying)
the jars in the genuine OO installation. So I modified the geronimo.bat of
WebSphere to add ;C:\Program Files\OpenOffice.org 2.3\program\classes to its
-Djava.ext.dirs. Doing so immediately cleared all the "bootstrap exception"
"$getFactory exception" ... so often isssued by the com.sun.star... api.

I noticed also that when the request is made from a servlet, there is no
additional javaw.exe created (which exactly suits me) whereas when the request
is made from a main, there is of course one jvm created, that does not disappear
at the end of the program, unless you code system.exit() as you suggested.
So I am happy with this.

Two more remarks:
- After it had worked some time making plenty of various tests, I suddenly
caugth an ErrorCodeException at Job.java:187. By chance I observed that if I
quit the OO quick launch in the windows tray, the conversion works again (the OO
icon comes back in the tray, and soffice.exe and soffice.bin re-appear in the
tasks). I hope this will not occur again !
- I read on the web about OO listening on port 8100, and I spent some time about
this, starting OO in listening mode. In fact, when you use the genuine OO jars
as I do, you dont have to bother with 8100. It works even if netstat shows no
8100 port. 
Comment 7 jsc 2007-11-05 07:43:21 UTC
when you use the office in server mode you should always exit the quick starter
and i would recommend to use a separate user directory.

The office don't listen automatically on a port but ii can be easy configured to
do so, see the DevGuide for example or in the SDK you can find a C++ example.
The mechanism is the same in Java. 

If you have general question related to the API etc. please ask on the
dev@api.openoffice.org mailing list.