Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Vector

 
surya gollamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I wrote a small program in servlets as follows.
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.util.*;
public class VectorTest extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException
{
try
{
System.out.println("HI");
Vector vector1 = new Vector();
String addvector1 = new String("HIHIHI");
vector1.add(addvector1);
System.out.println(addvector1);
}//end try
catch(Exception e)
{System.out.println("In code " + e);}
finally{}
}//end public void doPost
}
When I tried to invoke this servlet , I got the following message
The servlet named invoker at the requested URL
http://localhost:8080/servlet/VectorTest
reported this exception: java.util.Vector: method add(Ljava/lang/Object Z not found. Please report this to the administrator of the web server.
.....
....
Can anyone throw some light on this?


[This message has been edited by surya gollamudi (edited November 13, 2000).]
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What this means is actually that you compiled your code using Java 2 (or Java 1.1 with the collections API), and are trying to run it on a purely Java 1.1 virtual machine.
The solution is to make sure any API calls you use are available in java 1.1. In this case use the 1.1 Vector.addElement(Object) instead of the Java 2 Vector.add(Object).
 
surya gollamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank .But still I didn't understand one thing .
I am using jdk1.2.2 .Even then why I got this problem?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your server is using JDK1.2.2 as well? Which server software are you using; is it on the same machine as your development compiler? Does the batch file or script which starts the server specify a different VM?
 
surya gollamudi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JavaWebServer2.0 which is situated in the local machine and I started the webserver manually , going to JavaWebServer2.0\bin folder.
I tested this code in my friend's machine and found the same error.
[This message has been edited by surya gollamudi (edited November 13, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic