Odd VerifyError (Matlab, Eclipse, xerces)

From: Zoe Stephenson (zrs1_at_uk.ac.york.reversed)
Date: 06/29/04


Date: 29 Jun 2004 14:41:26 GMT

Hi,
  This one's been baffling me for a couple of days, I'm hoping there's
someone here who can point me in the right direction. I've been creating
some code using Eclipse that makes use of the xerces 1 XML system. I
have written a very simple application that parses an XML document and
then redisplays parts of it. This all works fine within Eclipse. However,
my application eventually needs to run within Matlab, so I tried it there
(I'm using Matlab's JRE within Eclipse to make sure there are as few
conflicts as possible). When run, I either get an unhelpful Matlab error
that the class can't be found, or if I indirect the call through another
class, I get a VerifyError. Here's a minimal example:

-

package uk.ac.york.cs.FAI.Example;

public class check {
  public check() {
  }
  public void run() {
    empty e=new empty();
    e.run(1);
  }
}

-

package uk.ac.york.cs.FAI.Example;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import org.apache.xerces.parsers.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class empty {
  public empty() {
  }
  
  public void run(int dummy) {
    DOMParser parser=new DOMParser();
    try {
      Reader fileReader=new FileReader(filename);
      InputSource file=new InputSource(fileReader);
      try {
        parser.parse(file); // NOTE THIS LINE
      }
      catch (Exception e) {
        System.out.println("Exception: " + e.toString());
      }
    }
    catch (FileNotFoundException e) {
      System.out.println("File not found");
    }
  }
  private static final String filename="/u2/zoe/work/Deliverables/2003/FMEATool/test.xml";
}

-

In Eclipse, this runs to completion, through a jPage containing:

check c=new check();
c.run();

(Note that I'm indirecting through another class so that I see a
sensible error message if anything goes wrong in Matlab).

In Matlab, the following happens:

>> import uk.ac.york.cs.FAI.Example.*;
>> app=check
 
app =
 
uk.ac.york.cs.FAI.Example.check@58d39f
 
>> app.run
??? Java exception occurred:
java.lang.VerifyError: (class: uk/ac/york/cs/FAI/Example/XMLcheck, method: run signature: (I)V) Incompatible object argument for function call
  at uk.ac.york.cs.FAI.Example.XMLmain.main(XMLmain.java:20)
  at uk.ac.york.cs.FAI.Example.check.run(check.java:21).

>>

Interestingly, if the call to parser.parse(file) outlined above is replaced
with any other method call on that object, e.g. parser.reset(), then the
VerifyError doesn't occur, even though the VerifyError seems as though
it objects to something unrelated to that call.

This is all rather confusing - can anyone shed some light on where to go
from here to get this code to work?

Versions:

jre 1.3.1
MATLAB Version 6.5.0.180913a (R13)
Eclipse Version: 2.1.2
xerces 1.4.4

-- 
 -- zoe


Relevant Pages

  • Re: Debugging java class called from Matlab
    ... Create an Eclipse project; to include the source code of your Java classes, remember the folder where you put the output classes when you defined your project. ... In Matlab, add the folder of the output classes from step 1 into Matlab's javaclasspath. ... instantiate or execute your Java code. ...
    (comp.soft-sys.matlab)
  • Compile Matlab Engine in Eclipse
    ... I'm having a little difficulty compiling the matlab engine the eclipse ... I'm using the mingw toolchain to compile my program on win xp. ... this is the only matlab function i'm try to run right notw and is in a ...
    (comp.soft-sys.matlab)
  • Re: Debugging java class called from Matlab
    ... I believe I> followed the instructions, but when I run the launcher in Eclipse, I get a> dialog saying: ... > This happens whether Matlab is started before the launcher or after. ... I am using Eclipse 3.3.2. ... Eclipse IDE for Java Developers 3.6.1. ...
    (comp.soft-sys.matlab)
  • Re: Debugging java class called from Matlab
    ... I wish to debug a Java class that I call from Matlab. ... which is Eclipse 3.2.2). ... define a debug configuration. ...
    (comp.soft-sys.matlab)