Solved

NoSuchMethodError

Posted on 1998-06-19
7
155 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
create a gui in perl 3 72
simple java question 3 44
VB Script to add site to Java Exception List 4 53
how to install java on RHEL image on EC2 4 7
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now