jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Error Instantiating servlet class in tomcat log Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error Instantiating servlet class in tomcat log" Watch "Error Instantiating servlet class in tomcat log" New topic
Author

Error Instantiating servlet class in tomcat log

g venki
Greenhorn

Joined: Mar 08, 2010
Posts: 8
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

Joined: Jan 10, 2002
Posts: 60810
    
  65

Please read: ItDoesntWorkIsUseless

If you don't tell us what the error is, we can't help you!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
g venki
Greenhorn

Joined: Mar 08, 2010
Posts: 8
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

Joined: Mar 05, 2007
Posts: 483

Hi are you doing any jobs in the init() of the servlet ?


Thanks,
Sherif
g venki
Greenhorn

Joined: Mar 08, 2010
Posts: 8
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
Marshal

Joined: Mar 22, 2005
Posts: 41178
    
  45
That class has a constructor - servlets should never have a constructor, and absolutely, positively not one that takes parameters.


Ping & DNS - my free Android networking tools app
g venki
Greenhorn

Joined: Mar 08, 2010
Posts: 8
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
Marshal

Joined: Mar 22, 2005
Posts: 41178
    
  45
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.
 
 
subject: Error Instantiating servlet class in tomcat log
 
Similar Threads
Problem running simple Servlet on Tomcat
context getAttribute code doubt
Getting Error instantiating servlet class in tomcat log .... please help
SOAP2.3.1-Configuration and application Error
JSTL installation