[Solved] Java: reasons for DeploymentException available?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
javatux
Posts: 10
Joined: Mon Jul 12, 2010 12:33 pm

[Solved] Java: reasons for DeploymentException available?

Post by javatux »

I have created an OOo plugin with Ant which works for my colleague. But when I use it I get an

Code: Select all

ERROR: (com.sun.star.deployment.DeploymentException) { { Message = "Fehler beim Aktivieren von: OPMCalcListener.jar", Co
ntext = (com.sun.star.uno.XInterface) @3d189ec }, Cause = (any) { (com.sun.star.registry.CannotRegisterImplementationExc
eption) { { Message = "", Context = (com.sun.star.uno.XInterface) @0 } } } }
as error message (same system: Java 1.6.0_21, WinXP). Any idea what could went wrong on my system?

Is there an overview about the error message and possible reasons available?
Last edited by javatux on Fri Oct 22, 2010 9:28 pm, edited 2 times in total.
OpenOffice 3.2.1 with MacOS 10.6.4
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Java: reasons for DeploymentException available?

Post by hanya »

There are some situation raises the kind of exception, it seems difficult to make answer without more information or your extension package.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
javatux
Posts: 10
Joined: Mon Jul 12, 2010 12:33 pm

Re: Java: reasons for DeploymentException available?

Post by javatux »

I have a similar project which I stripped down to find the cause. I found that the manifest.xml may be the problem. Here the manifest.xml which does not work:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>
	<manifest:file-entry manifest:full-path="description.xml" 
		manifest:media-type="application/vnd.sun.star.package-bundle-description;locale=de-DE"/>
	<manifest:file-entry manifest:full-path="registry/data/org/openoffice/Office/ProtocolHandler.xcu" 
		manifest:media-type="application/vnd.sun.star.configuration-data"/>
	<manifest:file-entry manifest:full-path="registry/data/org/openoffice/Office/Addons.xcu" 
		manifest:media-type="application/vnd.sun.star.configuration-data"/>
	<manifest:file-entry manifest:full-path="OOHelloWorld.jar" 
		manifest:media-type="application/vnd.sun.star.uno-component;type=Java"/>
</manifest:manifest>
The problem is the last file entry with "OOHelloWorld.jar". Without this entry I can register the OOo plugin. But I have seen also other examples with such a line inside. And I have seen other projects where this line is inside but commented out. What is correct now?
OpenOffice 3.2.1 with MacOS 10.6.4
javatux
Posts: 10
Joined: Mon Jul 12, 2010 12:33 pm

Re: Java: reasons for DeploymentException available?

Post by javatux »

One more thing: when I change the last entry to

Code: Select all

	<manifest:file-entry manifest:full-path="OOHelloWorld.jar"
		manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=Java"/>
e.g. when I declare the jar file as uno-typelibrary instead of uno-component my example works too.

Should I always use uno-typelibrary to add it to the manifest.xml?
Attachments
OpenOfficeHelloWorld.zip
This is the example I used to explore the entries in manifest.xml
(10.27 KiB) Downloaded 373 times
OpenOffice 3.2.1 with MacOS 10.6.4
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Java: reasons for DeploymentException available?

Post by hanya »

In the MANIFEST.MF for your component's jar file, you have to specify Class-Path like the following if you put jar file into your package.

Code: Select all

Class-Path: ./log4j-1.2.16.jar
Additionally, your de.agentes.oo.helloworld.HelloAddon class does not have __writeRegistryServiceInfo and __getComponentFactory methods which are called through component registration.
And you do not need description.xml entry in the META-INF/manifest.xml file.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
javatux
Posts: 10
Joined: Mon Jul 12, 2010 12:33 pm

Re: Java: reasons for DeploymentException available?

Post by javatux »

thank you for your help and for studying my example. I guess the __writeRegistryServiceInfo and __getComponentFactory will be called via reflexion. I will try it and report again...

When will component registration happen? During call of 'unopkg add...' or after Openoffice is started?
OpenOffice 3.2.1 with MacOS 10.6.4
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Java: reasons for DeploymentException available?

Post by hanya »

javatux wrote:When will component registration happen? During call of 'unopkg add...' or after Openoffice is started?
Installation time.

The code generated by Eclipse or Netbeans plug-in provides their own central registration class which allows to register multiple component easily. But if you do not know registration process of UNO components written in Java, see following document and examples in DevGuide.

About component written in Java:
http://wiki.services.openoffice.org/wik ... nt_in_Java
Helper class used in the examples of DevGuide.
http://api.openoffice.org/docs/java/ref ... ctory.html

The following way to register UNO components planed after 3.4.
http://wiki.services.openoffice.org/wik ... gistration
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
javatux
Posts: 10
Joined: Mon Jul 12, 2010 12:33 pm

Re: Java: reasons for DeploymentException available?

Post by javatux »

Now I see a little bit clearer. The first error I made was the incomplete Class-Path entry in the MANIFEST.MF. Unfortunately you'll get not really a hint from 'unopkg add -v ...' if something is wrong with your classes or classpath.

And with the correct classpath I saw the execption from missing __writeRegistryServiceInfo and __getComponentFactory method. Now I also understand the difference between uno-typelibrary (this is for normal jars) and uno-component (for jars with classes which implements com.sun.star.lang.XServiceInfo).

Thank you for your help.
OpenOffice 3.2.1 with MacOS 10.6.4
Post Reply