Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
Hello everybody,

I have problems with unit testing.
All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't any
problems. Just create a new UnitTest with WicketTester and it worked pretty
fine. Today I changed the project infrastructure to Maven with surifire
plug-in. The problem is following: usual unit test will be executet without
failures but not the tests with wickettester. Surifire report showed me
following exception:

java.lang.
NoClassDefFoundError: javax/servlet/http/HttpSession
   at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
   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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
   at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
   at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
   at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
   at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
   at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
   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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
   at $Proxy0.invoke(Unknown Source)
   at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
   at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
   at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSession
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 30 more

The test itself is very simple: it checkt if the start page will be
rendered. Nothing more.

Any ideas?

Thank you!


Re: Problem with Wickettester and Maven

2011-02-01 Thread Pedro Santos
You need to add the test or provided scope servlet-api dependency in your
project pom

On Tue, Feb 1, 2011 at 11:11 AM, Dmitriy Neretin 
dmitriy.nere...@googlemail.com wrote:

 Hello everybody,

 I have problems with unit testing.
 All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't any
 problems. Just create a new UnitTest with WicketTester and it worked pretty
 fine. Today I changed the project infrastructure to Maven with surifire
 plug-in. The problem is following: usual unit test will be executet without
 failures but not the tests with wickettester. Surifire report showed me
 following exception:

 java.lang.
 NoClassDefFoundError: javax/servlet/http/HttpSession
   at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
   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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at

 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at

 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at

 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
   at

 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
   at

 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
   at

 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at

 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
   at

 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
   at

 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
   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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
   at $Proxy0.invoke(Unknown Source)
   at

 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
   at

 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
   at
 org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
 Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSession
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 30 more

 The test itself is very simple: it checkt if the start page will be
 rendered. Nothing more.

 Any ideas?

 Thank you!




-- 
Pedro Henrique Oliveira dos Santos


Re: Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
I don't really understand how to do that?

On 1 February 2011 14:46, Pedro Santos pedros...@gmail.com wrote:

 You need to add the test or provided scope servlet-api dependency in your
 project pom

 On Tue, Feb 1, 2011 at 11:11 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody,
 
  I have problems with unit testing.
  All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't
 any
  problems. Just create a new UnitTest with WicketTester and it worked
 pretty
  fine. Today I changed the project infrastructure to Maven with surifire
  plug-in. The problem is following: usual unit test will be executet
 without
  failures but not the tests with wickettester. Surifire report showed me
  following exception:
 
  java.lang.
  NoClassDefFoundError: javax/servlet/http/HttpSession
at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
 
 
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
 
 
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
 
 
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
  Caused by: java.lang.ClassNotFoundException:
 javax.servlet.http.HttpSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 30 more
 
  The test itself is very simple: it checkt if the start page will be
  rendered. Nothing more.
 
  Any ideas?
 
  Thank you!
 



 --
 Pedro Henrique Oliveira dos Santos



Re: Problem with Wickettester and Maven

2011-02-01 Thread Dmitriy Neretin
Oh sorry!!! It works now! Thank you!

I should add this to my pom:

dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.4/version
scopeprovided/scope
/dependency

On 1 February 2011 14:51, Dmitriy Neretin dmitriy.nere...@googlemail.comwrote:

 I don't really understand how to do that?


 On 1 February 2011 14:46, Pedro Santos pedros...@gmail.com wrote:

 You need to add the test or provided scope servlet-api dependency in your
 project pom

 On Tue, Feb 1, 2011 at 11:11 AM, Dmitriy Neretin 
 dmitriy.nere...@googlemail.com wrote:

  Hello everybody,
 
  I have problems with unit testing.
  All the time I have used NetBeans 6.9.1 with Glassfish and there wasn't
 any
  problems. Just create a new UnitTest with WicketTester and it worked
 pretty
  fine. Today I changed the project infrastructure to Maven with surifire
  plug-in. The problem is following: usual unit test will be executet
 without
  failures but not the tests with wickettester. Surifire report showed me
  following exception:
 
  java.lang.
  NoClassDefFoundError: javax/servlet/http/HttpSession
at de.pentasys.test.web.TestRenderPages.setUp(TestRenderPages.java:22)
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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
 
 
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
 
 
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
 
 
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
 
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at
 
 
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
 
 
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
  Caused by: java.lang.ClassNotFoundException:
 javax.servlet.http.HttpSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 30 more
 
  The test itself is very simple: it checkt if the start page will be
  rendered. Nothing more.
 
  Any ideas?
 
  Thank you!
 



 --
 Pedro Henrique Oliveira dos Santos