aspose file tools*
The moose likes Servlets and the fly likes How can I fix this REALLY URGENT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can I fix this REALLY URGENT" Watch "How can I fix this REALLY URGENT" New topic
Author

How can I fix this REALLY URGENT

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
Im attempting my first servlet, and Im using the combination Applet --> Servlet --> JDBC --> SQL.
Im using Tomcat 4.0.1 as my server and I have placed all files in the ROOT directory. Im getting the following error in my servlet class
java.lang.NoSuchMethodError
at t.Serve.performTask(Serve.java:75)
at t.Serve.doPost(Serve.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
I have traced the error to the code in bold i.e when Im attempting to connect to SQL
public void performTask(javax.servlet.http
{
try
{
ObjectInputStream in = newObjectInputStream (request.getInputStream());
String s = (String)in.readObject();
info.addPerInfo(s);
}
public void init()
{
info = new InfoGetter();
}
public InfoGetter()
{
String dsn = "jdbc:twtds:sqlserver://CAT/DOG";
try
{
Class.forName("com.thinweb.tds.Driver");
myCon = DriverManager.getConnection(dsn, ..
}
public void addPersInfo(String first)
{
try
{
PreparedStatement statement = myCon.prepareStatement(....
statement.setString(1,first);
statement.executeUpdate();

}
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
thought maybe i should include the entire error
thank u all for your time
java.lang.NoSuchMethodError
at t.Serve.performTask(Serve.java:75)
at t.Serve.doPost(Serve.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You boldfaced the line referring to the object "info", so I assume that's the offending line.
But you didn't show either the definition of "info" or the definition of the class that "info" belongs to.
Normally I'd expect that "info"s class didn't implement a "void addPerInfo( String s )" method OR that you had initialized "info" with some class other than the one that actual did implement that method.


Customer surveys are for companies who didn't pay proper attention to begin with.
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I created an instance of InfoGetter in my init()
method of my servlet. and in the performTask() method i use info which is an instance of InfoGetter and i then call addPerInfo. I did include a decription of InfoGetter at the bottom of my first post. And within post i have the method addPerInfo. And can u elaborate on "Normally I'd expect that "info"s class didn't implement a "void addPerInfo( String s )" method OR that you had initialized "info" with some class other than the one that actual did implement that method" If u have any further questions please ask I really need to solve this
Thank u all
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I solved my problem. I was making my sql connection in a class other than my servlet class
i.e. class InfoGetter. I got rid of that class and
placed my connection in my init() method of my Servlet class. And everything works fine now. For the life of me i cant figure out why
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I fix this REALLY URGENT