Subj : Unable to access method of class To : netscape.public.mozilla.jseng From : visitus 04 Date : Tue Dec 14 2004 04:48 pm --0-333880187-1103071699=:23842 Content-Type: text/plain; charset=us-ascii I am using Rhino to access methods and objects of java classes. I am trying to access a method of class as follows: function test1(p1, p2, p3){ e = new xyzException(); try{ printStr("Calling API "); abcUtil.abcImport(p1, p2, p3); } catch (e) { printStr("RESULT=FAILURE"); printStr(e.toString()); printStr(e.getMessage()); <--- this line throws error shown below } } However, I get an error js: "C:\rhino\impExp.js", line 116: uncaught JavaScript exception: TypeError: undefined is not a function. (C:\rhino\impExp.js; line 116) I am accessing an exception that extends java.lang.Exception. Here is how the exception class looks like: java.lang.Object java.lang.Throwable java.lang.Exception com.remedy.arsys.api.xyzException In the implemention of xyzException, the methods are defined as: public class xyzException extends java.lang.Exception { public String getMessage() { return this.toString(); } public String toString() { String msg = ""; if (null == getLastStatus()) msg = null; else { for (int i = 0; i < getLastStatus().length; i++) msg += getLastStatus()[i].toString(); } return msg; } } --------------------------------- Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! --0-333880187-1103071699=:23842 Content-Type: text/html; charset=us-ascii
I am using Rhino to access methods and objects of java classes. I am trying to access a method of class as follows:
 
function test1(p1, p2, p3){
         e = new xyzException();
        try{
                  printStr("Calling API ");
                  abcUtil.abcImport(p1, p2, p3);
        } catch (e) {
  &nb sp;               printStr("RESULT=FAILURE");
                  printStr(e.toString());
                  printStr(e.getMessage()); <--- this line throws error shown below
        }
          
}
However, I get an error
js: "C:\rhino\impExp.js", line 116:
 uncaught JavaScript exception: TypeError: undefined is not a function. (C:\rhino\impExp.js; line 116)
 
I am accessing an exception that extends java.lang.Exception.
Here is how the exception class looks like:
java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.remedy.arsys.api.xyzException
In the implemention of xyzException, the methods are defined as:
 
public  class xyzException extends java.lang.Exception  {
 
public String getMessage() {
  return this.toString();
 }
 
public String toString() {
     String msg = "";
 
  if (null == getLastStatus())
   msg = null;
  else {
   for (int i = 0; i < getLastStatus().length; i++)
       msg += getLastStatus()[i].toString();
  }
 
  return msg;
 }

}
 


Do you Yahoo!?
All your favorites on one personal page – Try My Yahoo! --0-333880187-1103071699=:23842-- .