Hi Kumar, I think I have already answered. See attached email.
Cheers, -Vincent > -----Original Message----- > From: Kumar_maniranjan [mailto:[EMAIL PROTECTED]] > Sent: 23 July 2002 10:59 > To: [EMAIL PROTECTED] > 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. > > I m just right clicking on it and running it in the test server. > > regards, > Maniranjan Kumar > > PS : Below is console output of weblogic 6.1 sp2 and below that is log > file content. And my servlet. > > Servlet > ---------- > package com.cpb.InternalWS.ejb.positions; > > import org.apache.cactus.*; > import junit.framework.*; > import javax.naming.Context; > import javax.naming.InitialContext; > import javax.rmi.PortableRemoteObject; > import com.cpb.InternalWS.dvo.positions.PositionBySecurityVO; > import com.cpb.InternalWS.dvo.positions.PositionBySecurityRO; > import com.cpb.InternalWS.dvo.positions.ResultVO; > import com.cpb.util.WebLog4j; > import com.cpb.util.WebConstants; > import java.util.List; > > public class EmptyServletTestCase1 extends ServletTestCase > { > private InvstPositionDetailsSession invstPositionDetailsSession; > private PositionBySecurityRO positionBySecurityRO; > private PositionBySecurityVO positionBySecurityVO; > private ResultVO resultVO; > private String searchText = null; > private List resultList = null; > > public EmptyServletTestCase1(String name) > { > super(name); > VitiWebLog4j.debuglog("Entering EmptyServletTestCase1.java :: > CONSTRUCTOR : ", WebConstants.LOGTYPE_DEBUG); > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > CONSTRUCTOR : ", WebConstants.LOGTYPE_DEBUG); > } > > > public static void main(String[] theArgs) > { > WebLog4j.debuglog("Entering EmptyServletTestCase1.java :: main : ", > WebConstants.LOGTYPE_DEBUG); > junit.swingui.TestRunner.main(new String[] > {EmptyServletTestCase1.class.getName()}); > WebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: main : ", > WebConstants.LOGTYPE_DEBUG); > } > > > public static Test suite() > { > VitiWebLog4j.debuglog("Entering EmptyServletTestCase1.java :: > suite : ", VitiWebConstants.LOGTYPE_DEBUG); > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > suite : ", VitiWebConstants.LOGTYPE_DEBUG); > return new TestSuite(EmptyServletTestCase1.class); > } > > protected void setUp() > { > VitiWebLog4j.debuglog("Entering EmptyServletTestCase1.java :: > setUp() : ", VitiWebConstants.LOGTYPE_DEBUG); > try > { > Context ctx = new InitialContext(); > InvstPositionDetailsSessionHome home = > (InvstPositionDetailsSessionHome) > > PortableRemoteObject.narrow(ctx.lookup("InvstPositionsDetailsJndiNam > e"), > InvstPositionDetailsSessionHome.class); > this.invstPositionDetailsSession = home.create(); > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > setUp() : ", VitiWebConstants.LOGTYPE_DEBUG); > } > catch(Exception e) > { > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > setUp() : Exception Occured In Getting EJB Handler : ", > VitiWebConstants.LOGTYPE_DEBUG); > } > } > > protected void tearDown() > { > VitiWebLog4j.debuglog("Entering EmptyServletTestCase1.java :: > tearDown() : ", VitiWebConstants.LOGTYPE_DEBUG); > invstPositionDetailsSession = null; > searchText=null; > resultList=null; > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > tearDown() : ", VitiWebConstants.LOGTYPE_DEBUG); > } > > > public void testGetPositionBySecurity() throws Exception > { > VitiWebLog4j.debuglog("Entering EmptyServletTestCase1.java :: > testGetPositionBySecurity : ", VitiWebConstants.LOGTYPE_DEBUG); > > positionBySecurityVO = > invstPositionDetailsSession.getPositionBySecurity(positionBySecurityRO); > > if(positionBySecurityVO != null) > { > searchText = positionBySecurityVO.getSearchText(); > resultList = positionBySecurityVO.getResultList(); > } > > VitiWebLog4j.debuglog("In TestInvstPositionDAO.java :: Before > assertEquals", VitiWebConstants.LOGTYPE_DEBUG); > assertEquals("INFY", searchText); > assertEquals(1,resultList.size()); > > assertEquals("211000115",((ResultVO)resultList.get(0)).getCusip()); > > VitiWebLog4j.debuglog("Exiting EmptyServletTestCase1.java :: > testGetPositionBySecurity : ", VitiWebConstants.LOGTYPE_DEBUG); > > } > > } > > > CONSOLE > ---------------- > > <Jul 22, 2001 1:59:40 PM IST> <Error> <HTTP> > <[WebAppServletContext(6535361,Viti > webWar,/VitiwebWar)] 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,Viti > webWar,/VitiwebWar)] 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/Vitiwe 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-dev- > [EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:cactus-dev- > [EMAIL PROTECTED]>
--- Begin Message --- Title: RE: Error instantiating servlet!!!!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-----
--- End Message ---
> From: Kumar_maniranjan [mailto:[EMAIL PROTECTED]]
> Sent: 22 July 2002 10:56
> To: [EMAIL PROTECTED]
> 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]]][[ServletTestRedirec
> 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]]][[ServletTestRe
> 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/CitiwebW
> 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(HttpURLConnecti
> on.java:562)
> at
> org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoRead
> HttpURLConnection.java:127)
> at
> org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java
> :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.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.JUnitHttpTestRun
> ner.run([DashoPro-V2-050200])
> at mtfwes.execute([DashoPro-V2-050200])
> at mtfwer.execute([DashoPro-V2-050200])
> at
> com.togethersoft.testing.internal.testserver.TestServerServlet.executeComm
> and([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([Dasho
> 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-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:cactus-user-
> [EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
