J2VMS: Exploiting OpenVMS from Java
User's Guide & Release Notes


Previous Contents


Chapter 3
Troubleshooting

The following section covers common issues that are encountered by usesrs of J2VMS.

3.1 java.lang.UnsatisfiedLinkError

This error indicates a failure in the Java method java.lang.System.loadLibrary. This method is used for loading native libraries in Java. It is not the method used by vs.SystemCall to load libraries. See Section 3.2 for more information on that topic.

If the error looks similar to:


java.lang.UnsatisfiedLinkError: no J2VMS$SHR in java.library.path 
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1578) 
        at java.lang.Runtime.loadLibrary0(Runtime.java:788) 
        at java.lang.System.loadLibrary(System.java:834) 
        at vs.VmsStruct.<clinit>(VmsStruct.java:81) 
        at parse.main(parse.java:13) 

This is normally an indication that the J2VMS startup procedure, SYS$STARTUP:J2VMS$STARTUP.COM, has not been run. When Java loads native libraries using java.lang.System.loadLibrary it does not search in SYS$LIBRARY like LIB$FIND_IMAGE_SYMBOL. It uses logical names only.

3.2 java.lang.NoClassDefFoundError

This error most commonly indicates a mistake in the classpath. There may be a mispelt filename, or a Java archive missing entirely. However, it can also indicate a failure in vs.SystemCall when loading a routine from a shareable image. The best action to take is to check that the shareable image is either in SYS$SHARE or has an appropriately defined logical.

3.3 Cannot Resolve Symbol

The Java program compiled under a previous version of J2VMS. However, since upgrading to version V1.3 or higher the Java compiler reports errors similar to the following:


parse.java:5: cannot resolve symbol 
symbol  : class NAML 
location: package starlet 
                  ^ 
parse.java:14: cannot resolve symbol 
symbol  : variable NAML 
location: class parse 

It is likely this is caused by changes in the STARLET library provided by J2VMS. Version V1.3 and higher includes changes to the STARLET library generator so that is is more closely inline with those provided with native languages. To correct this, simply adjust the name of the class to the one that includes the definition. In the case above, the definitions for the NAML block are included in the class vs.starlet.NAM.

Previous Contents Contents