Hi

There is an applet example in the bean module. The test was made to be
run in the build environment with calling dmake. The html page contains an applet parameter which needs to contain the location of OOo. The applet uses then its own classloader to load the needed jars.

Joachim

Juergen Schmidt - Sun Germany - ham02 - Hamburg schrieb:
Hi Marco,

i think that is not the perfect solution and i assume that it works per luck. The OfficeBean is indeed somewhat unmaintained at the moment and probably not everything is perfect.

First thing is that you don't have to unpack the office jars and you don't have to jar them with your applet code in one jar. The same would work with a correct Class-Path entry in the manifest to reference the need jar files. Ideally the officebean.ajr should be enough and the bean should reference all other jars. Anyway i am not 100% sure and have to check it.

The idea behind the bean is that it finds the office via the classpath and starts it automatically if necessary and connects via a named pipe. That is the reason why the jars shouldn't be copied from the office installation and should be referenced via the classpath. I must confess that i can't remember how it works in the context of an applet.

The generation of the pipe name looks indeed wrong. The idea is <username>_Office The underscore should be changed to %5f (and probably not %b7), then the URL is encoded. The encoding changed spaces " " to "+" that will be changed to "%20" and to use the pipe name without "%" the "%" is converted to "_". Don't ask me why it is done this way. Anyway it should work with the bug because you normally don't deal with the pipe name directly. So i would say the documentation is correct here.

Juergen



Marco Castillo wrote:
Dear list:
Ok, never mind, I manage to fix this problem using the hammer. For other people that might have the same problems, don't believe to the OOoBean documentation, is completely wrong, you have to add ALL the jars with your application, and not only distributing the jars, but also by inserting the classes into your final jar distribution file.
    I do the following:
- unpack the following libraries:
 officebean.jar
 unoil.jar
 unoloader.jar
 ridl.jar
 jur.jar
 juh.jar
- Pack them all into a single directory, always keeping the package hierarchy.
- Create an ant task to copy the previous files into my final applet jar.
Also, one must watch the META-INF file for every jar, because some interesting directives are placed. This is how I found that the unoloader.jar library was a must, because it was placed in the ClassPath directive for one of the libraries. Also, there is a directive that I set in the final distribution jar, as I said, you must see all the META-INF files in order to copy all the directives that may be (Note that the ClassPath is not necessary). ... and voilá!! everything works nice!! I can create an applet that loads from a Java Web Container (Tomcat 6) and embeds OO into a web browser. Of course, the OO must been correctly initialized. This is other part of the documentation that is wrong. When you create a pipe, you must add a _25B7Office suffix to the user name that is logged in into the machine. The documentation states that you must create a pipe named <user_name>_Office. We found this looking at the LocalOfficeConnection.java file. As I mentioned earlier, I hope that this would help somebody in my same desperate situation. I think that the OOoBean is a very cool piece of software created for OO, but it seems that the support for this is not very active. Who is the developer of this? How can we help to maintain it? Do you guys need some help in here?
Regards
Marco


----- Original Message ----
From: Marco Castillo <[EMAIL PROTECTED]>
To: dev@api.openoffice.org
Sent: Tuesday, April 22, 2008 12:39:18 PM
Subject: [api-dev] Problems using the OOBean. Please HELP!!

Dear List:
I've been using the OOBean to embed OO into a browser. All works if I run my applet directly from the disk of the machine and if I run it directly from the develpoment environment (I'm using Eclipse). I'm using Windows XP and when In a directory a run a .html file with the applet directive that runs my applet, all works without a problem. The problem comes when I deployed the applet in a Web Container like Tomcat. When I deployed the applet in the web container, I got the following error when starting:
com.sun.star.comp.beans.NoConnectionException
 at com.sun.star.comp.beans.OOoBean.loadFromURL(OOoBean.java:704)
 at com.sun.star.comp.beans.OOoBean.loadFromByteArray(OOoBean.java:795)
at net.vdkit.tc.TextControlApplet.componentShown(TextControlApplet.java:324)
 at java.awt.Component.processComponentEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)
The applet shows, but OO is not embedded within.

As you can see, the error comes from the line 704 from the OOoBean.java source, in the loadFromURL method.
In this file, the line 704 is the following:
702     aCallWatchThread.cancel();
703     if ( xServiceFactory == null )
704 throw new NoConnectionException(); It seems that the xServiceFactory object is null, but in some lines before, it is verified that this object is not null.

I started OO using the following command:
"C:\Program Files\OpenOffice.org 2.3\program\soffice.exe" -bean -accept=pipe,name=Marquitos_25B7Office;urp;StarOffice.NamingService
In the path of the system, the following paths are set:
C:\Program Files\OpenOffice.org 2.3\program
C:\Program Files\OpenOffice.org 2.3\program\classes
The user name that is logged into the system is Marquitos. The _25B7 is a suffix that was suggested by the LocalOfficeConnection object, it is not exactly as the documentation states.
In the applet, the manifest file looks like the following:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_14-b03 (Sun Microsystems Inc.)
Built-By: VDKIT Copyright (c) 2008
Main-Class: net.vdkit.tc.TextControlApplet.class
Class-Path: /TcTest/tc/jTDS3.jar /TcTest/tc/jconn3.jar /TcTest/tc/officebean.jar /TcTest/tc/unoil.jar /TcTest/tc/unoloader.jar /TcTest/tc/ridl.jar /TcTest/tc/jur.jar /TcTest/tc/juh.jar the path /TcTest/tc is because all the jars, including the applet are in a tc folder within an application called TcTest. the jars that are bundled with the tc.jar (the jar where the applet is embedded) are:
officebean.jar
unoil.jar
unoloader.jar
ridl.jar
jur.jar
juh.jar
these jars are not bundled within the tc.jar but are in the same directory, so it can be called when the tc.jar needs them. If I remove these jars, I receive some NoDefClassFound exception. Do I have to do something else? Do I'm missing something? Please I need help, I'm stuck with this for about 3 weeks now. Somebody has done something similar in the past?
Thanks in advance for your kind reply.
Marco


____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to