Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Instantiating servlet class in tomcat log

 
g venki
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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)
 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42967
73
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic