• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I fix this REALLY URGENT

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Saloon Keeper
Posts: 27707
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic