You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Niranjan Rao <nh...@gmail.com> on 2011/07/03 07:09:33 UTC
Wicket/Spring/Junit/Maven - Don't understand what's going on.
Hi,
I am a new user of wicket and new member of this list.Actually this is
my first post to this mailing list.
I am trying to make Wicket/Spring/Junit/Maven combo work. To make life
more interesting, I have multi module project and one module (WebApp)
depends upon DAL module.
I followed the tutorial at
http://comsysto.wordpress.com/2010/06/04/test-driven-development-with-apache-wicket-and-spring-framework/ and it works - at least in eclipse. I have imported the project in eclipse using m2eclipse/import existing maven file. All the unit tests pass when executed in eclipse.
However when I try to test using maven command line, tests do fail. I
have no idea why - as same tests run in eclipse. To make sure, I have
created a new workspace, imported the projects again, and all tests
still pass in eclipse.
Failing point is clear, spring is not auto wiring the application as
mentioned in above post. As a result wicket tester fails with null
pointer exception.
As a last resort I added printlns for classpath. In eclipse, I do see
all the expected entries. Same test when executed in maven, just
prints /tmp/surefirebooter8162555418175145722.jar. Not sure if
maven/surefire is combining all jars in one jar and that's causing
problem.
Any help is greatly appreciated. I can include code also, but not sure
what's the protocol here.
Regards,
- Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Niranjan Rao <nh...@gmail.com>.
Unfortunately, can not help you much here. I followed the exact steps in
the tutorial and never got this error.
Regards,
- Niranjan
On Mon, 2011-07-04 at 13:51 -0300, Bruno Borges wrote:
> I'm working on this right now and I found this problem:
>
> java.lang.IllegalStateException: the application key does not seem to be set
> properly or this method is called before WicketServlet is set, which leads
> to the wrong behavior
> at
> org.apache.wicket.protocol.http.WebApplication.getApplicationKey(WebApplication.java:164)
> at org.apache.wicket.Application.internalInit(Application.java:1045)
> at
> org.apache.wicket.protocol.http.WebApplication.internalInit(WebApplication.java:549)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> at java.lang.reflect.Method.invoke(Method.java:611)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
> at
> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:685)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
> at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
> ...
>
> I followed the same tutorial as you and I'm working with Embedded Derby
> datasource. Is there any way to come around this issue or am I missing
> something?
>
>
> *Bruno Borges*
> www.brunoborges.com.br
> +55 21 76727099
>
>
>
> On Mon, Jul 4, 2011 at 2:26 AM, Niranjan Rao <nh...@gmail.com> wrote:
>
> > Sorry for the delay in the response folks and thanks for the help.
> >
> > My gut feeling is also same - differences of classpaths. That's why I
> > actually added println statements in the code to see what classpath code
> > is seeing.
> >
> > I am working on isolated test case that I can send to this DL. Should be
> > done by tomorrow.
> >
> > Regards,
> >
> > Niranjan
> >
> > On Sun, 2011-07-03 at 10:22 -0700, Igor Vaynberg wrote:
> > > yep. thats probably the cause. to elaborate a little more: eclipse
> > > does not separate between a test class path and normal class path,
> > > while maven does.
> > >
> > > -igor
> > >
> > > On Sun, Jul 3, 2011 at 3:01 AM, Harald Wellmann <ha...@gmx.de>
> > wrote:
> > > > Without a stacktrace or more details about your setup, I can only
> > guess...
> > > > Most likely it's not a Wicket problem.
> > > >
> > > > I'd say your applicationContext.xml is in the wrong place where Maven
> > can't
> > > > see it, and Eclipse just happens to see it because m2eclipse cannot map
> > > > Maven classpaths 1:1 to Eclipse.
> > > >
> > > > In the blog you cited, this line looks suspicious to me:
> > > >
> > > > @ContextConfiguration(locations =
> > > > {"classpath:WEB-INF/applicationContext.xml"})
> > > >
> > > > If you have a default Maven project structure, then WEB-INF is under
> > > > src/main/webapp, and this is not on the test classpath for Surefire.
> > > >
> > > > Regards,
> > > >
> > > > Harald
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Bruno Borges <br...@gmail.com>.
I'm working on this right now and I found this problem:
java.lang.IllegalStateException: the application key does not seem to be set
properly or this method is called before WicketServlet is set, which leads
to the wrong behavior
at
org.apache.wicket.protocol.http.WebApplication.getApplicationKey(WebApplication.java:164)
at org.apache.wicket.Application.internalInit(Application.java:1045)
at
org.apache.wicket.protocol.http.WebApplication.internalInit(WebApplication.java:549)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:685)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
...
I followed the same tutorial as you and I'm working with Embedded Derby
datasource. Is there any way to come around this issue or am I missing
something?
*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099
On Mon, Jul 4, 2011 at 2:26 AM, Niranjan Rao <nh...@gmail.com> wrote:
> Sorry for the delay in the response folks and thanks for the help.
>
> My gut feeling is also same - differences of classpaths. That's why I
> actually added println statements in the code to see what classpath code
> is seeing.
>
> I am working on isolated test case that I can send to this DL. Should be
> done by tomorrow.
>
> Regards,
>
> Niranjan
>
> On Sun, 2011-07-03 at 10:22 -0700, Igor Vaynberg wrote:
> > yep. thats probably the cause. to elaborate a little more: eclipse
> > does not separate between a test class path and normal class path,
> > while maven does.
> >
> > -igor
> >
> > On Sun, Jul 3, 2011 at 3:01 AM, Harald Wellmann <ha...@gmx.de>
> wrote:
> > > Without a stacktrace or more details about your setup, I can only
> guess...
> > > Most likely it's not a Wicket problem.
> > >
> > > I'd say your applicationContext.xml is in the wrong place where Maven
> can't
> > > see it, and Eclipse just happens to see it because m2eclipse cannot map
> > > Maven classpaths 1:1 to Eclipse.
> > >
> > > In the blog you cited, this line looks suspicious to me:
> > >
> > > @ContextConfiguration(locations =
> > > {"classpath:WEB-INF/applicationContext.xml"})
> > >
> > > If you have a default Maven project structure, then WEB-INF is under
> > > src/main/webapp, and this is not on the test classpath for Surefire.
> > >
> > > Regards,
> > >
> > > Harald
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Niranjan Rao <nh...@gmail.com>.
Sorry for the delay in the response folks and thanks for the help.
My gut feeling is also same - differences of classpaths. That's why I
actually added println statements in the code to see what classpath code
is seeing.
I am working on isolated test case that I can send to this DL. Should be
done by tomorrow.
Regards,
Niranjan
On Sun, 2011-07-03 at 10:22 -0700, Igor Vaynberg wrote:
> yep. thats probably the cause. to elaborate a little more: eclipse
> does not separate between a test class path and normal class path,
> while maven does.
>
> -igor
>
> On Sun, Jul 3, 2011 at 3:01 AM, Harald Wellmann <ha...@gmx.de> wrote:
> > Without a stacktrace or more details about your setup, I can only guess...
> > Most likely it's not a Wicket problem.
> >
> > I'd say your applicationContext.xml is in the wrong place where Maven can't
> > see it, and Eclipse just happens to see it because m2eclipse cannot map
> > Maven classpaths 1:1 to Eclipse.
> >
> > In the blog you cited, this line looks suspicious to me:
> >
> > @ContextConfiguration(locations =
> > {"classpath:WEB-INF/applicationContext.xml"})
> >
> > If you have a default Maven project structure, then WEB-INF is under
> > src/main/webapp, and this is not on the test classpath for Surefire.
> >
> > Regards,
> >
> > Harald
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Niranjan Rao <nh...@gmail.com>.
Hi folks,
As everyone mentioned earlier this is/was not wicket problem. Problem is
still not solved, but after lot of println statements, I have concluded
that there is something wrong in my spring setup or the way
maven/surefire sets up the classpath.
The required files do exists at given location which is in classpath
properly. However spring complains that it cannot load the files with
FileNotFoundException.
I have posted the question to spring support forums. I can post
resolution - if any, if anyone is interested.
Regards,
Niranjan
On Sun, 2011-07-03 at 10:22 -0700, Igor Vaynberg wrote:
> yep. thats probably the cause. to elaborate a little more: eclipse
> does not separate between a test class path and normal class path,
> while maven does.
>
> -igor
>
> On Sun, Jul 3, 2011 at 3:01 AM, Harald Wellmann <ha...@gmx.de> wrote:
> > Without a stacktrace or more details about your setup, I can only guess...
> > Most likely it's not a Wicket problem.
> >
> > I'd say your applicationContext.xml is in the wrong place where Maven can't
> > see it, and Eclipse just happens to see it because m2eclipse cannot map
> > Maven classpaths 1:1 to Eclipse.
> >
> > In the blog you cited, this line looks suspicious to me:
> >
> > @ContextConfiguration(locations =
> > {"classpath:WEB-INF/applicationContext.xml"})
> >
> > If you have a default Maven project structure, then WEB-INF is under
> > src/main/webapp, and this is not on the test classpath for Surefire.
> >
> > Regards,
> >
> > Harald
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Igor Vaynberg <ig...@gmail.com>.
yep. thats probably the cause. to elaborate a little more: eclipse
does not separate between a test class path and normal class path,
while maven does.
-igor
On Sun, Jul 3, 2011 at 3:01 AM, Harald Wellmann <ha...@gmx.de> wrote:
> Without a stacktrace or more details about your setup, I can only guess...
> Most likely it's not a Wicket problem.
>
> I'd say your applicationContext.xml is in the wrong place where Maven can't
> see it, and Eclipse just happens to see it because m2eclipse cannot map
> Maven classpaths 1:1 to Eclipse.
>
> In the blog you cited, this line looks suspicious to me:
>
> @ContextConfiguration(locations =
> {"classpath:WEB-INF/applicationContext.xml"})
>
> If you have a default Maven project structure, then WEB-INF is under
> src/main/webapp, and this is not on the test classpath for Surefire.
>
> Regards,
>
> Harald
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going on.
Posted by Harald Wellmann <ha...@gmx.de>.
Without a stacktrace or more details about your setup, I can only
guess... Most likely it's not a Wicket problem.
I'd say your applicationContext.xml is in the wrong place where Maven
can't see it, and Eclipse just happens to see it because m2eclipse
cannot map Maven classpaths 1:1 to Eclipse.
In the blog you cited, this line looks suspicious to me:
@ContextConfiguration(locations =
{"classpath:WEB-INF/applicationContext.xml"})
If you have a default Maven project structure, then WEB-INF is under
src/main/webapp, and this is not on the test classpath for Surefire.
Regards,
Harald
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket/Spring/Junit/Maven - Don't understand what's going
on.
Posted by Loc Nguyen <lo...@gmail.com>.
If you can attach a zip of the project someone can take a quick look. Or maybe provide your pom.xml and the stacktrace as a starting point?
-Loc
On Sat, Jul 2, 2011 at 10:09 PM, Niranjan Rao <nhrdls@gmail.com (mailto:nhrdls@gmail.com)> wrote:
> Hi,
>
> I am a new user of wicket and new member of this list.Actually this is
> my first post to this mailing list.
>
> I am trying to make Wicket/Spring/Junit/Maven combo work. To make life
> more interesting, I have multi module project and one module (WebApp)
> depends upon DAL module.
>
> I followed the tutorial at
> http://comsysto.wordpress.com/2010/06/04/test-driven-development-with-apache-wicket-and-spring-framework/ and it works - at least in eclipse. I have imported the project in eclipse using m2eclipse/import existing maven file. All the unit tests pass when executed in eclipse.
>
> However when I try to test using maven command line, tests do fail. I
> have no idea why - as same tests run in eclipse. To make sure, I have
> created a new workspace, imported the projects again, and all tests
> still pass in eclipse.
>
> Failing point is clear, spring is not auto wiring the application as
> mentioned in above post. As a result wicket tester fails with null
> pointer exception.
>
> As a last resort I added printlns for classpath. In eclipse, I do see
> all the expected entries. Same test when executed in maven, just
> prints /tmp/surefirebooter8162555418175145722.jar. Not sure if
> maven/surefire is combining all jars in one jar and that's causing
> problem.
>
> Any help is greatly appreciated. I can include code also, but not sure
> what's the protocol here.
>
> Regards,
>
> - Niranjan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org (mailto:users-unsubscribe@wicket.apache.org)
> For additional commands, e-mail: users-help@wicket.apache.org (mailto:users-help@wicket.apache.org)
>