Re: Error creating a Servlet Runner with my ContextListeners

Russell Gold <[email protected]> Sun, 10 Aug 2008 17:59:46 -0400
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
I am so sorry. I hadn't seen a message on this list in a month, and  
had stopped paying attention to it...

Is your class de.myv.platform.persistence.EntityManagerHolder in the  
classpath? It doesn't appear to be finding it.


On Jul 28, 2008, at 12:21 PM, Janusz Leidgens wrote:

> Hello
>
> Is there anoterher place then this mailing List to ask stupid  
> questions
> about setting up a HttpUnit TestCase? I haven't found one yet so I  
> send
> you this mail.
>
> I'm trying out the HttpUnit Framework to Test my Application. But
> already while creating the ServletRunner I get an Exception:
>
> java.lang.RuntimeException: Unable to load context listener
> de.myv.platform.persistence.EntityManagerHolder:
> java.lang.ExceptionInInitializerError
>    at
> com 
> .meterware 
> .servletunit.WebApplication.extractListeners(WebApplication.java:154)
>    at
> com.meterware.servletunit.WebApplication.<init>(WebApplication.java: 
> 136)
>    at
> com.meterware.servletunit.WebApplication.<init>(WebApplication.java: 
> 109)
>    at  
> com.meterware.servletunit.ServletRunner.<init>(ServletRunner.java:92)
>    at
> de 
> .myv.platform.view.TestServletTest.testGetForm(TestServletTest.java: 
> 25)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
> org 
> .junit 
> .internal 
> .runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
>    at
> org 
> .junit 
> .internal 
> .runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
>    at
> org 
> .junit 
> .internal 
> .runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java: 
> 34)
>    at
> org 
> .junit 
> .internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
>    at
> org 
> .junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
>    at
> org 
> .junit 
> .internal 
> .runners 
> .TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java: 
> 66)
>    at
> org 
> .junit 
> .internal 
> .runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
>    at
> org.junit.internal.runners.TestClassRunner 
> $1.runUnprotected(TestClassRunner.java:42)
>    at
> org 
> .junit 
> .internal 
> .runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java: 
> 34)
>    at
> org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java: 
> 52)
>    at
> org 
> .eclipse 
> .jdt 
> .internal 
> .junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>    at
> org 
> .eclipse 
> .jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>    at
> org 
> .eclipse 
> .jdt 
> .internal 
> .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>    at
> org 
> .eclipse 
> .jdt 
> .internal 
> .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>    at
> org 
> .eclipse 
> .jdt 
> .internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>    at
> org 
> .eclipse 
> .jdt 
> .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 
> 196)
>
> I set up the Listener in my Web.xml:
>
>    <listener>
>        <!--  Listener managing the EntityManager instance per  
> request  -->
>        <listener-class>
>            de.myv.platform.persistence.EntityManagerHolder
>        </listener-class>
>    </listener>
>
> The class EntityManagerHolder is contained in the BildPath of my
> Application. Here the Source of my test case:
>
>    @Test
>    public void testInitialize() throws Exception {
>        assertTrue(new File("WebContent/WEB-INF/web.xml").exists());
>        ServletRunner sr = new ServletRunner(new File(
>                "WebContent/WEB-INF/web.xml"));
>        ServletUnitClient client = sr.newClient();
>    }
>
> I hope you can help me,
>
> thanks Janusz Leidgens
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/