wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Lorenz <Stefan.Lor...@persis.de>
Subject AW: Problem with FormTester and EJB Injection
Date Mon, 24 Feb 2014 10:41:10 GMT
Hi,

here is a quickstart app with the failing unit test.
I know it's because of the Inject on the target page, but I don't know the right way to handle
it in the tests.

And this is the StrackTrace:

org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public
com.mycompany.TargetPage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument
''. An exception has been thrown during construction!
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:194)
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:76)
	at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:133)
	at org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:268)
	at org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:166)
	at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
	at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:269)
	at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2657)
	at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
	at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
	at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
	at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
	at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
	at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
	at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:654)
	at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:712)
	at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:593)
	at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:565)
	at org.apache.wicket.util.tester.BaseWicketTester.submitForm(BaseWicketTester.java:1959)
	at org.apache.wicket.util.tester.FormTester.submit(FormTester.java:706)
	at com.mycompany.TestHomePage.homepageSubmitSuccessfully(TestHomePage.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:171)
	... 44 more
Caused by: java.lang.NullPointerException
	at com.mycompany.TargetPage.<init>(TargetPage.java:18)
	... 49 more


-----Urspr√ľngliche Nachricht-----
Von: Martin Grigorov [mailto:mgrigorov@apache.org] 
Gesendet: Freitag, 21. Februar 2014 14:11
An: users@wicket.apache.org
Betreff: Re: Problem with FormTester and EJB Injection

We will need more information to be able to help.
Show us your code and the exception or even better - create a quickstart app

Martin Grigorov
Wicket Training and Consulting


On Fri, Feb 21, 2014 at 3:08 PM, Stefan Lorenz <Stefan.Lorenz@persis.de>wrote:

> I use wicket-cdi from 6.13.0
> and I get NullPointerExceptions in the Unit-Tests when the 
> FormTester.submit()'s setResponsePage opens a page where a bean gets 
> injected...
>
> -----Urspr√ľngliche Nachricht-----
> Von: Martin Grigorov [mailto:mgrigorov@apache.org]
> Gesendet: Freitag, 21. Februar 2014 13:49
> An: users@wicket.apache.org
> Betreff: Re: Problem with FormTester and EJB Injection
>
> Hi,
>
> What is the issue ?
> do you use wicket-cdi or wicketstuff-javaee for EJB injection ?
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Fri, Feb 21, 2014 at 2:40 PM, Stefan Lorenz 
> <Stefan.Lorenz@persis.de
> >wrote:
>
> > Hi,
> >
> > Is there a 
> > suggest<http://www.dict.cc/englisch-deutsch/suggest.html>ed
> > way to use the FormTester.submit() when the target page does inject 
> > a
> ejb?
> >
> > Regards,
> > Stefan
> >
>
Mime
View raw message