• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Error Instantiating servlet class in tomcat log

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone!

I am geting an error of instantiating servlet class in tomcat log.
I am using tomcat 6.0.24.
My servlet is on serial port communication.

I have added a comm.jar (for serial port communication) in "c:\pgm files\apache software foundation\tomcat 6.0\lib "

I had set my classpath to "c:\pgm files\apache software foundation\tomcat 6.0\lib\*.jar"

I added a lib folder in my WEB-INF/lib path and copied the comm.jar to there as well.... I even tried extracting files to my WEB-INF/classes ... but still i am getting the error .

Someone please respond.... waiting for your reply. Thanku!
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read: ItDoesntWorkIsUseless

If you don't tell us what the error is, we can't help you!
 
g venki
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Thanks for your reply!
My error report in tomcat log is:



Exception:

javax.servlet.ServletException: Error instantiating servlet class SerialWrite

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)

root cause:

java.lang.InstantiationException: SerialWrite
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
 
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi are you doing any jobs in the init() of the servlet ?
 
g venki
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sherif Shehab wrote:Hi are you doing any jobs in the init() of the servlet ?



Hi there.No i am not doing any thing in my init()




It has no compile errors... I have even executed the code sucessfully in JAVA and i am successful in sending an sms to a number...

But i want to do redirection from my JSP to the Java Pgm. So i have created the above servlet and the error above is displayed. Somebody please help me in resolving it.

Thank U.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That class has a constructor - servlets should never have a constructor, and absolutely, positively not one that takes parameters.
 
g venki
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:That class has a constructor - servlets should never have a constructor, and absolutely, positively not one that takes parameters.



Hi.

But i am not creating any object for the class, hence the constructor will not be invoked. Anyways i will try once again by deleting it. Thanks for your valuabl reply.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But i am not creating any object for the class, hence the constructor will not be invoked.


YOUR code does not call any constructors (which is as it should be), but the servlet container sure does. How could the servlet container invoke non-static methods if it didn't construct an object first? But what the servlet container expects is no-argument constructor; not anything with parameters.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic