[Home]TomcatNoSuchMethodError

HomePage | RecentChanges | Preferences

Problem

A webapp running on HP-UX, as far as I know, under Java 1.5, can't find the String.replace(String) method.

The error:

java.lang.NoSuchMethodError: java.lang.String.contains(Ljava/lang/String;)Z
        at edu.asu.vpia.benweb.dao.ResolutionImpl.getSortField(ResolutionImpl.java:47)

Line 47 of that class is:

     if( statusDesc.contains("HQ") ) {
(or, it was... I changed to using indexOf to work around the error.)

So I tried a simple test program to confirm that HP's Java 1.5 really does have that method:

$ java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-_24_nov_2004_16_29)
Java HotSpot(TM) Server VM (build 1.5.0 FCS (JS B64) jinteg:11.24.04-15:51 PA2.0 (aCC_AP), mixed mode)
$ cat Test.java
public class Test {

   public static void main(String args[]) throws Exception {

      String text = "ABC";
      String search = "A";

      System.out.println( text.contains( search ) );

   }
}
$ javac Test.java
$ java Test
true

$

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited June 2, 2005 5:28 pm by wsmoak.vpia.asu.edu (diff)
Search: