You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Kumar_maniranjan <Ku...@infosys.com> on 2002/07/22 11:56:15 UTC

Error instantiating servlet!!!!

hi,
I m trying to write a servlet to test one EJB. This servlet contains
only default constructor, setUp, tearDown and test method. Everything else is 
properly set, I assume so, cactus.properties file and JVM properties, 
but I m facing this  "Error instantiating servlet' error. 

Please get back to me if u have any clue regarding this ASAP.

regards,
Maniranjan Kumar

PS : Below is console output of weblogic 6.1 sp2 and below that is log file content. 

CONSOLE
----------------

<Jul 22, 2001 1:59:40 PM IST> <Error> <HTTP> <[WebAppServletContext(6535361,Citi
webWar,/CitiwebWar)] Error instantiating servlet: "EmptyServletTestCase1"
java.lang.InstantiationException: ****************.**.****..EmptyServletT
estCase1
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:665)
        at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:643)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:588)
        at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
java:368)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2464)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Jul 22, 2001 1:59:40 PM IST> <Error> <HTTP> <[WebAppServletContext(6535361,Citi
webWar,/CitiwebWar)] Servlet failed with ServletException
javax.servlet.ServletException: Servlet class: '******.****.*****.*****
.EmptyServletTestCase1' couldn't be instantiated
        at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:676)
        at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:643)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:588)
        at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
java:368)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:242)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2464)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>



CACTUS LOG FILE
----------------------------
2001-07-22 13:59:40,020 DEBUG applicationlogging - Exiting EmptyServletTestCase1.java :: CONSTRUCTOR : 
2001-07-22 13:59:40,361 DEBUG ******.*****.**.**********.EmptyServletTestCase1 - >runGenericTest(...)
2001-07-22 13:59:40,361 DEBUG ******.*****.**.**********.EmptyServletTestCase1 - Test case = testGetPositionBySecurity
2001-07-22 13:59:40,371 DEBUG org.apache.cactus.client.AbstractHttpClient - >doTest(simulation URL = [null], automatic session = [true], cookies = [], headers = [], method = [POST], parameters = [[[ServletTestRedirector_TestClass] = [[******.*****.**.**********..EmptyServletTestCase1]]][[ServletTestRedirector_AutomaticSession] = [[true]]][[ServletTestRedirector_TestMethod] = [[testGetPositionBySecurity]]]])
2001-07-22 13:59:40,581 DEBUG org.apache.cactus.client.HttpClientHelper - >HttpClientHelper([http://localhost:7001/******War/EmptyServletTestCase1])
2001-07-22 13:59:40,581 DEBUG org.apache.cactus.client.HttpClientHelper - <HttpClientHelper
2001-07-22 13:59:40,591 DEBUG org.apache.cactus.client.HttpClientHelper - >connect(simulation URL = [null], automatic session = [true], cookies = [], headers = [], method = [POST], parameters = [[[ServletTestRedirector_TestClass] = [[com.cpb.InternalWS.ejb.positions.EmptyServletTestCase1]]][[ServletTestRedirector_Service] = [[CALL_TEST]]][[ServletTestRedirector_AutomaticSession] = [[true]]][[ServletTestRedirector_TestMethod] = [[testGetPositionBySecurity]]]])
2001-07-22 13:59:40,591 DEBUG org.apache.cactus.client.HttpClientHelper - >addCookies(...)
2001-07-22 13:59:40,591 DEBUG org.apache.cactus.client.HttpClientHelper - <addCookies
2001-07-22 13:59:40,601 DEBUG org.apache.cactus.client.HttpClientHelper - <connect
2001-07-22 13:59:40,601 DEBUG org.apache.cactus.client.AutoReadHttpURLConnection - >getInputStream()
2001-07-22 13:59:40,601 DEBUG org.apache.cactus.client.AutoReadHttpURLConnection - Original connection = sun.net.www.protocol.http.HttpURLConnection:http://localhost:7001/CitiwebWar/EmptyServletTestCase1
2001-07-22 13:59:40,631 DEBUG com.cpb.InternalWS.ejb.positions.EmptyServletTestCase1 - Exception in test
java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:7001/********War/EmptyServletTestCase1
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562)
	at org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoReadHttpURLConnection.java:127)
	at org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:136)
	at org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422)
	at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
	at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at com.togethersoft.testing.internal.testserver.plugin.junit.JUnitTestRunner.a([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.plugin.junit.JUnitTestRunner.a([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.plugin.junit.JUnitHttpTestRunner.run([DashoPro-V2-050200])
	at mtfwes.execute([DashoPro-V2-050200])
	at mtfwer.execute([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.TestServerServlet.executeCommand([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.TestServerServlet.GetMethod([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.jetty.TsHandler.handleRequest([DashoPro-V2-050200])
	at com.togethersoft.testing.internal.testserver.jetty.TsHandler.handle([DashoPro-V2-050200])
	at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1047)
	at org.mortbay.http.HandlerContext.handle(HandlerContext.java:1002)
	at org.mortbay.http.HttpServer.service(HttpServer.java:774)
	at org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
	at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
	at org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
	at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:148)
	at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
	at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:775)
	at java.lang.Thread.run(Thread.java:484)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Error instantiating servlet!!!!

Posted by Vincent Massol <vm...@octo.com>.
Hi,

It seems your EmptyServletTestCase1 class is a servlet whereas it should
not be. It is supposed to be a standard java class extending
ServletTestCase.

Please check http://jakarta.apache.org/cactus/howto_testcase.html

You should also check http://jakarta.apache.org/cactus/how_it_works.html
to understand how Cactus works (with WRT Redirectors, etc).

Cheers,
-Vincent

> -----Original Message-----
> From: Kumar_maniranjan [mailto:Kumar_maniranjan@infosys.com]
> Sent: 22 July 2002 10:56
> To: cactus-user@jakarta.apache.org
> Subject: Error instantiating servlet!!!!
> 
> hi,
> I m trying to write a servlet to test one EJB. This servlet contains
> only default constructor, setUp, tearDown and test method. Everything
else
> is
> properly set, I assume so, cactus.properties file and JVM properties,
> but I m facing this  "Error instantiating servlet' error.
> 
> Please get back to me if u have any clue regarding this ASAP.
> 
> regards,
> Maniranjan Kumar
> 
> PS : Below is console output of weblogic 6.1 sp2 and below that is log
> file content.
> 
> CONSOLE
> ----------------
> 
> <Jul 22, 2001 1:59:40 PM IST> <Error> <HTTP>
> <[WebAppServletContext(6535361,Citi
> webWar,/CitiwebWar)] Error instantiating servlet:
"EmptyServletTestCase1"
> java.lang.InstantiationException:
****************.**.****..EmptyServletT
> estCase1
>         at java.lang.Class.newInstance0(Native Method)
>         at java.lang.Class.newInstance(Class.java:237)
>         at
> weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
> pl.java:665)
>         at
> weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
> Impl.java:643)
>         at
> weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
> mpl.java:588)
>         at
> weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
> java:368)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:242)
>         at
> weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
>         at
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
> va:27)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:2464)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2039)
>         at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >
> <Jul 22, 2001 1:59:40 PM IST> <Error> <HTTP>
> <[WebAppServletContext(6535361,Citi
> webWar,/CitiwebWar)] Servlet failed with ServletException
> javax.servlet.ServletException: Servlet class:
'******.****.*****.*****
> .EmptyServletTestCase1' couldn't be instantiated
>         at
> weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
> pl.java:676)
>         at
> weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
> Impl.java:643)
>         at
> weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
> mpl.java:588)
>         at
> weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
> java:368)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:242)
>         at
> weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
>         at
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
> va:27)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:2464)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2039)
>         at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >
> 
> 
> 
> CACTUS LOG FILE
> ----------------------------
> 2001-07-22 13:59:40,020 DEBUG applicationlogging - Exiting
> EmptyServletTestCase1.java :: CONSTRUCTOR :
> 2001-07-22 13:59:40,361 DEBUG
> ******.*****.**.**********.EmptyServletTestCase1 -
>runGenericTest(...)
> 2001-07-22 13:59:40,361 DEBUG
> ******.*****.**.**********.EmptyServletTestCase1 - Test case =
> testGetPositionBySecurity
> 2001-07-22 13:59:40,371 DEBUG
org.apache.cactus.client.AbstractHttpClient
> - >doTest(simulation URL = [null], automatic session = [true], cookies
=
> [], headers = [], method = [POST], parameters =
> [[[ServletTestRedirector_TestClass] =
>
[[******.*****.**.**********..EmptyServletTestCase1]]][[ServletTestRedir
ec
> tor_AutomaticSession] = [[true]]][[ServletTestRedirector_TestMethod] =
> [[testGetPositionBySecurity]]]])
> 2001-07-22 13:59:40,581 DEBUG
org.apache.cactus.client.HttpClientHelper -
>
>HttpClientHelper([http://localhost:7001/******War/EmptyServletTestCase1
])
> 2001-07-22 13:59:40,581 DEBUG
org.apache.cactus.client.HttpClientHelper -
> <HttpClientHelper
> 2001-07-22 13:59:40,591 DEBUG
org.apache.cactus.client.HttpClientHelper -
> >connect(simulation URL = [null], automatic session = [true], cookies
=
> [], headers = [], method = [POST], parameters =
> [[[ServletTestRedirector_TestClass] =
>
[[com.cpb.InternalWS.ejb.positions.EmptyServletTestCase1]]][[ServletTest
Re
> director_Service] =
> [[CALL_TEST]]][[ServletTestRedirector_AutomaticSession] =
> [[true]]][[ServletTestRedirector_TestMethod] =
> [[testGetPositionBySecurity]]]])
> 2001-07-22 13:59:40,591 DEBUG
org.apache.cactus.client.HttpClientHelper -
> >addCookies(...)
> 2001-07-22 13:59:40,591 DEBUG
org.apache.cactus.client.HttpClientHelper -
> <addCookies
> 2001-07-22 13:59:40,601 DEBUG
org.apache.cactus.client.HttpClientHelper -
> <connect
> 2001-07-22 13:59:40,601 DEBUG
> org.apache.cactus.client.AutoReadHttpURLConnection - >getInputStream()
> 2001-07-22 13:59:40,601 DEBUG
> org.apache.cactus.client.AutoReadHttpURLConnection - Original
connection =
>
sun.net.www.protocol.http.HttpURLConnection:http://localhost:7001/Citiwe
bW
> ar/EmptyServletTestCase1
> 2001-07-22 13:59:40,631 DEBUG
> com.cpb.InternalWS.ejb.positions.EmptyServletTestCase1 - Exception in
test
> java.io.IOException: Server returned HTTP response code: 500 for URL:
> http://localhost:7001/********War/EmptyServletTestCase1
> 	at
>
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
ti
> on.java:562)
> 	at
>
org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoRe
ad
> HttpURLConnection.java:127)
> 	at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.ja
va
> :136)
> 	at
>
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:
42
> 2)
> 	at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
> 	at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:131)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:173)
> 	at junit.framework.TestSuite.run(TestSuite.java:168)
> 	at
>
com.togethersoft.testing.internal.testserver.plugin.junit.JUnitTestRunne
r.
> a([DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.plugin.junit.JUnitTestRunne
r.
> a([DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.plugin.junit.JUnitHttpTestR
un
> ner.run([DashoPro-V2-050200])
> 	at mtfwes.execute([DashoPro-V2-050200])
> 	at mtfwer.execute([DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.TestServerServlet.executeCo
mm
> and([DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.TestServerServlet.GetMethod
([
> DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.jetty.TsHandler.handleReque
st
> ([DashoPro-V2-050200])
> 	at
>
com.togethersoft.testing.internal.testserver.jetty.TsHandler.handle([Das
ho
> Pro-V2-050200])
> 	at
org.mortbay.http.HandlerContext.handle(HandlerContext.java:1047)
> 	at
org.mortbay.http.HandlerContext.handle(HandlerContext.java:1002)
> 	at org.mortbay.http.HttpServer.service(HttpServer.java:774)
> 	at
org.mortbay.http.HttpConnection.service(HttpConnection.java:745)
> 	at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:918)
> 	at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:760)
> 	at
>
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:148
)
> 	at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
> 	at
org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:775)
> 	at java.lang.Thread.run(Thread.java:484)
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>