« Return to Thread: unit test compiles but throws NoClassDefFound exception

Re: unit test compiles but throws NoClassDefFound exception

by beel :: Rate this Message:

Reply to Author | View in Thread

Thanks!
I edited pom.xml and added

                <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>servlet-api</artifactId>
                        <version>2.4</version>
                        <scope>test</scope>
                </dependency>

Now i'm on to a new error; FileNotFoundException: hibernate.cfg.xml. It must be a classpath issue again.

Kalle Korhonen-2 wrote:
You are missing servlet-api from your test classpath.

Kalle


On Sun, Mar 15, 2009 at 8:36 AM, warner <wwarner@gmail.com> wrote:

>
> Hi,
>
> I'm just starting with trails. Using
> http://docs.codehaus.org/display/TRAILS/Testing as a guide, I'm trying to
> test the mappings and eventually load my database with data from files.
>
>        public void testCreate() {
>                DomainObj o = new DomainObj();
>                o.setName("some name");
>                o = persistenceService.save(o);
> //              assertEquals(o.getName(), "some name");
> //              assertNotNull(o.getId());
>        }
>
> The method compiles but throws an exception at persistenceService.save(o).
>
>  java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
>
> The website Trails has generated runs fine, so I'm missing something
> simple.
>
> Thanks,
>
>  -Bill
> --
> View this message in context:
> http://www.nabble.com/unit-test-compiles-but-throws-NoClassDefFound-exception-tp22524377p22524377.html
> Sent from the Trails - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

 « Return to Thread: unit test compiles but throws NoClassDefFound exception