Solved

NoSuchMethodError

Posted on 1998-06-19
7
157 Views
Last Modified: 2010-03-30
When I run my server program on the server machine, there is a NoSuchMethodError.
When I run the same server program on an other machine, the error does not happened.
What is the reason ?

Thanks a lot for your interest in this question.
What can I do ?
This server program is a thread it is running with the MS VJ++ jdk.
0
Comment
Question by:thibal
  • 4
  • 3
7 Comments
 

Author Comment

by:thibal
ID: 1223395
Edited text of question
0
 

Author Comment

by:thibal
ID: 1223396
Edited text of question
0
 
LVL 5

Accepted Solution

by:
fontaine earned 50 total points
ID: 1223397
I post as an answer what seems the most realistic cause of this problem, being given the
information provided. Reject if this does not help you.

You are probably using some JDK 1.1 methods and the other machine does only
understand Java code from the prior API version, 1.0. To know what version of the JDK you
are using, you can type java -version, or something similar if you are not working with
SUN's JDK. Also, I think that Microsoft has introduced some methods that are not part
of the standard Java API. If you are using them, a "pure Java" VM will throw a
"NoSuchMethodError" when trying to execute them. You should read the doc. of the
method that has thrown the exception, there sould be something that tells you since
what version of Java the method is available.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:fontaine
ID: 1223398
To fix the problem, you will have either the upgrade the VM of the other machine or to replace
the method by something equivalent but that only uses classes and methods from the
API version supported by the other machine.
0
 

Author Comment

by:thibal
ID: 1223399
Fontaine,
Your answer is probably a good one because I find this server program in "Java in a nutshell".
I've got the VisualJ++ 1.0.
But I am surprised because my code is compiled without any error or warning...
0
 

Author Comment

by:thibal
ID: 1223400
I don't know what method can provocate this exception.
Have you an idea?
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1223401
I see that I have mixed up the two machines: if it does not run on the server machine, it is
the VM of the server machine that is outdated compared to the code of your book. The
best analogy for your problem is the writing of applets. If you write an applet using methods
that are specific to JDK 1.1, all will compile fine if you work with a JDK 1.1 environment. If
you then try the applet in a non-JDK 1.1 browser, it will throw a NoSuchMethodError when
trying to access these methods. All methods that are part of the JDK 1.1 API can led
to this exception if the program is run on an old VM.

Example of method specific to the 1.1 API:

public byte[] getBytes(String enc); of java.lang.String

Normally, you should have in the error message the name of the method or at least a line
where the exception has occured. If you don't see these information, you should take a look
at the doc. of the VM: there is probably a flag to set before running the app.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ForLoop Example 3 53
Maven Project: Hibernate Dependencies Conflict 10 40
Convert from a json string array to a Java object 3 53
printf performancy 11 71
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question