Difference between revisions of "Documentation/DevGuide/WritingUNO/Troubleshooting"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
 
Line 13: Line 13:
 
=== Check Registry Keys ===
 
=== Check Registry Keys ===
  
To check if the registry database is correctly set up, run ''regview'' against the three keys that make up a registration in the /UCR, /SERVICES and /IMPLEMENTATIONS branch of a registry database. The following examples show how to read the appropriate keys and how a proper configuration should look. In our example, service <code>ImageShrink</code>, and the key /UCR/org/openoffice/test/XImageShrink contain the type information specified in UNOIDL (the exact output from ''regview'' might differ between versions of {{PRODUCTNAME}}):
+
To check if the registry database is correctly set up, run ''regview'' against the three keys that make up a registration in the /UCR, /SERVICES and /IMPLEMENTATIONS branch of a registry database. The following examples show how to read the appropriate keys and how a proper configuration should look. In our example, service <code>ImageShrink</code>, and the key /UCR/org/openoffice/test/XImageShrink contain the type information specified in UNOIDL (the exact output from ''regview'' might differ between versions of {{AOo}}):
  
 
   # dump XImageShrink type information
 
   # dump XImageShrink type information
Line 94: Line 94:
 
If ''regview'' can not find the /SERVICES and /IMPLEMENTATIONS keys or they have the wrong content, the problem occurred when ''regcomp'' was run. This can be caused by wrong path names in the ''regcomp'' arguments.  
 
If ''regview'' can not find the /SERVICES and /IMPLEMENTATIONS keys or they have the wrong content, the problem occurred when ''regcomp'' was run. This can be caused by wrong path names in the ''regcomp'' arguments.  
  
Also, a wrong <code>SystemClasspath</code> setup in ''java(.ini|rc)'' (prior to {{PRODUCTNAME}} {{OOo2.x}}) could be the cause of ''regcomp'' error messages about missing classes. Check what the <code>SystemClasspath</code> entry in ''java(.ini|rc)'' specifies for the Java UNO runtime jars.
+
Also, a wrong <code>SystemClasspath</code> setup in ''java(.ini|rc)'' (prior to OpenOffice.org 2.x could be the cause of ''regcomp'' error messages about missing classes. Check what the <code>SystemClasspath</code> entry in ''java(.ini|rc)'' specifies for the Java UNO runtime jars.
  
 
Ensure that ''regcomp'' is being run from the current directory when registering Java components. In addition, ensure ''<OfficePath>/program'' is the current folder when ''regcomp'' is run. Verify that ''regcomp'' is in the current folder.
 
Ensure that ''regcomp'' is being run from the current directory when registering Java components. In addition, ensure ''<OfficePath>/program'' is the current folder when ''regcomp'' is run. Verify that ''regcomp'' is in the current folder.
Line 100: Line 100:
 
=== Check the Java VM settings ===
 
=== Check the Java VM settings ===
  
Whenever the VM service is instantiated by {{PRODUCTNAME}}, it uses the Java configuration settings in {{PRODUCTNAME}}. This happens during the registration of Java components, therefore make sure that Java is enabled. Choose '''Tools-Options''' in {{PRODUCTNAME}}, so that the dialog appears. Expand the {{PRODUCTNAME}} node and select '''Security'''. Select the '''Enable''' checkbox in the Java section and click '''OK'''.  
+
Whenever the VM service is instantiated by {{AOo}}, it uses the Java configuration settings in {{AOo}}. This happens during the registration of Java components, therefore make sure that Java is enabled. Choose '''Tools-Options''' in {{AOo}}, so that the dialog appears. Expand the OpenOffice node and select '''Security'''. Select the '''Enable''' checkbox in the Java section and click '''OK'''.  
  
 
=== Check the Manifest ===
 
=== Check the Manifest ===
Line 112: Line 112:
 
=== Adjust CLASSPATH for Additional Classes ===
 
=== Adjust CLASSPATH for Additional Classes ===
  
{{PRODUCTNAME}} maintains its own system classpath and a user classpath when it starts the Java VM for Java components. The jar file that contains the service implementation is not required in the system or user classpath. If a component depends on jar files or classes that are not part of the Java UNO runtime jars, then they must be put on the classpath. This can be achieved by editing the classpath in the options dialog ('''Tools – Options – {{PRODUCTNAME}} – Security''').
+
{{AOo}} maintains its own system classpath and a user classpath when it starts the Java VM for Java components. The jar file that contains the service implementation is not required in the system or user classpath. If a component depends on jar files or classes that are not part of the Java UNO runtime jars, then they must be put on the classpath. This can be achieved by editing the classpath in the options dialog ('''Tools – Options – OpenOffice – Security''').
  
 
=== Disable Debug Options ===
 
=== Disable Debug Options ===
  
If the debug options (-Xdebug, -Xrunjdwp) are in the ''java(.ini|rc)'' (prior to {{PRODUCTNAME}} {{OOo2.x}}) file, disable them by putting semicolons at the beginning of the respective lines. For {{PRODUCTNAME}} {{OOo2.x}} and later, make sure the debug options are removed in the Parameters dialog. This dialog can be found in the options dialog ('''Tools – Options – {{PRODUCTNAME}} – Java'''). The ''regcomp'' or tool or the Extension Manager may hang, because the JVM is waiting for a debugger to be attached.
+
If the debug options (-Xdebug, -Xrunjdwp) are in the ''java(.ini|rc)'' (prior to OpenOffice 2.x) file, disable them by putting semicolons at the beginning of the respective lines. For OpenOffice.org 2.x and later, make sure the debug options are removed in the Parameters dialog. This dialog can be found in the options dialog ('''Tools – Options – OpenOffice – Java'''). The ''regcomp'' or tool or the Extension Manager may hang, because the JVM is waiting for a debugger to be attached.
  
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Writing UNO Components]]
 
[[Category:Documentation/Developer's Guide/Writing UNO Components]]

Latest revision as of 14:02, 24 December 2020



If the component encounters problems, review the following checklist to check if the component is configured correctly.

Check Registry Keys

To check if the registry database is correctly set up, run regview against the three keys that make up a registration in the /UCR, /SERVICES and /IMPLEMENTATIONS branch of a registry database. The following examples show how to read the appropriate keys and how a proper configuration should look. In our example, service ImageShrink, and the key /UCR/org/openoffice/test/XImageShrink contain the type information specified in UNOIDL (the exact output from regview might differ between versions of Apache OpenOffice):

 # dump XImageShrink type information
 
 $ regview thumbs.rdb /UCR/org/openoffice/test/XImageShrink 
 
 Registry "file:///X:/office60eng/program/thumbs.rdb":
 
 /UCR/org/openoffice/test/XImageShrink
  Value: Type = RG_VALUETYPE_BINARY
         Size = 364
         Data = minor version: 0
                major version: 1
                type: 'interface'
                uik: { 0x00000000-0x0000-0x0000-0x00000000-0x00000000 }
                name: 'org/openoffice/test/XImageShrink'
                super name: 'com/sun/star/uno/XInterface'
                Doku: ""
                IDL source file: "X:\SO\sdk\examples\java\Thumbs\org\openoffice\test\XImageShrink.idl"
                number of fields: 3
                field #0:
                  name='SourceDirectory'
                  type='string'
                  access=READWRITE
                   Doku: ""
                  IDL source file: ""
                field #1:
                  name='DestinationDirectory'
                  type='string'
                  access=READWRITE
                   Doku: ""
                  IDL source file: ""
                field #2:
                  name='Dimension'
                  type='com/sun/star/awt/Size'
                  access=READWRITE
                   Doku: ""
                  IDL source file: ""
                  number of methods: 0
                  number of references: 0

The /SERVICES/org.openoffice.test.ImageShrink key must point to the implementation name org.openoffice.comp.test.ImageShrink that was chosen for this service:

 # dump service name registration
 
 $ regview thumbs.rdb /SERVICES/org.openoffice.test.ImageShrink 
 
 Registry "file:///X:/office60eng/program/thumbs.rdb":
 
 /SERVICES/org.openoffice.test.ImageShrink
  Value: Type = RG_VALUETYPE_STRINGLIST
         Size = 45
         Len  = 1
         Data = 0 = "org.openoffice.comp.test.ImageShrink"

Finally, the /IMPLEMENTATIONS/org.openoffice.comp.test.ImageShrink key must contain the loader and the location of the component jar:

 # dump implementation name registration
 
 $ regview thumbs.rdb /IMPLEMENTATIONS/org.openoffice.comp.test.ImageShrink 
 
 Registry "file:///X:/office60eng/program/thumbs.rdb":
 
 /IMPLEMENTATIONS/org.openoffice.comp.test.ImageShrink
  / UNO
    / ACTIVATOR
      Value: Type = RG_VALUETYPE_STRING
             Size = 26
             Data = "com.sun.star.loader.Java2"
 
    / SERVICES
      / org.openoffice.test.ImageShrink
    / LOCATION
      Value: Type = RG_VALUETYPE_STRING
             Size = 50
             Data = "file:///X:/office60eng/program/classes/thumbs.jar"

If the UCR key is missing, the problem is with regmerge. The most probable cause are missing .urd files. Be careful when writing the makefile. If .urd files are missing when regmerge is launched by the makefile, regmerge continues and creates a barebone .rdb file, sometimes without any type info.

If regview can not find the /SERVICES and /IMPLEMENTATIONS keys or they have the wrong content, the problem occurred when regcomp was run. This can be caused by wrong path names in the regcomp arguments.

Also, a wrong SystemClasspath setup in java(.ini|rc) (prior to OpenOffice.org 2.x could be the cause of regcomp error messages about missing classes. Check what the SystemClasspath entry in java(.ini|rc) specifies for the Java UNO runtime jars.

Ensure that regcomp is being run from the current directory when registering Java components. In addition, ensure <OfficePath>/program is the current folder when regcomp is run. Verify that regcomp is in the current folder.

Check the Java VM settings

Whenever the VM service is instantiated by Apache OpenOffice, it uses the Java configuration settings in Apache OpenOffice. This happens during the registration of Java components, therefore make sure that Java is enabled. Choose Tools-Options in Apache OpenOffice, so that the dialog appears. Expand the OpenOffice node and select Security. Select the Enable checkbox in the Java section and click OK.

Check the Manifest

Make sure the manifest file contains the correct entry for the registration class name. The file must contain the following line:

 RegistrationClassName: <full name of package and class>

Please make sure that the manifest file ends up with a new line. The registration class name must be the one that implements the __writeRegistryServiceInfo() and __getServiceFactory() methods. The RegistrationClassName to be entered in the manifest for our example is org.openoffice.comp.test.ImageShrink.

Adjust CLASSPATH for Additional Classes

Apache OpenOffice maintains its own system classpath and a user classpath when it starts the Java VM for Java components. The jar file that contains the service implementation is not required in the system or user classpath. If a component depends on jar files or classes that are not part of the Java UNO runtime jars, then they must be put on the classpath. This can be achieved by editing the classpath in the options dialog (Tools – Options – OpenOffice – Security).

Disable Debug Options

If the debug options (-Xdebug, -Xrunjdwp) are in the java(.ini|rc) (prior to OpenOffice 2.x) file, disable them by putting semicolons at the beginning of the respective lines. For OpenOffice.org 2.x and later, make sure the debug options are removed in the Parameters dialog. This dialog can be found in the options dialog (Tools – Options – OpenOffice – Java). The regcomp or tool or the Extension Manager may hang, because the JVM is waiting for a debugger to be attached.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages