Here it is :

org.apache.wicket.WicketRuntimeException: Can't instantiate page using 
constructor 'public 
bookstoreweb.test.BookPage(org.apache.wicket.request.mapper.parameter.PageParameters)'
 and argument 'c=[color]
        at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:193)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:98)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:44)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:137)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:278)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:166)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:93)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:237)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:165)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:814)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 ~[wicket-request-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:253) 
[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
 [wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:281)
 [wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
 [wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:245) 
[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1179) 
[catalina.jar:7.0.25]
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
[catalina.jar:7.0.25]
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
[catalina.jar:7.0.25]
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) 
[catalina.jar:7.0.25]
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 [catalina.jar:7.0.25]
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 
[catalina.jar:7.0.25]
        at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
 [tomcat-coyote.jar:7.0.25]
        at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
 [tomcat-coyote.jar:7.0.25]
        at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
 [tomcat-coyote.jar:7.0.25]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
[na:1.7.0_04-ea]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
[na:1.7.0_04-ea]
        at java.lang.Thread.run(Thread.java:722) [na:1.7.0_04-ea]
Caused by: java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method) ~[na:1.7.0_04-ea]
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 ~[na:1.7.0_04-ea]
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 ~[na:1.7.0_04-ea]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525) 
~[na:1.7.0_04-ea]
        at 
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:170)
 ~[wicket-core-6.0-SNAPSHOT.jar:6.0-SNAPSHOT]
        ... 38 common frames omitted
Caused by: java.lang.NullPointerException: null
        at bookstoremodel.cdi.BigBenClock.getBigBenTime(BigBenClock.java:20) 
~[bookstoremodel-4.0.jar:na]
        at bookstoreweb.test.BookPage.<init>(BookPage.java:85) 
~[BookPage.class:na]


Francois


Le 28 juil. 2012 à 10:30, Igor Vaynberg a écrit :

> a stack trace would be helpful...
> 
> -igor
> 
> On Sat, Jul 28, 2012 at 11:26 AM, Francois Meillet
> <francois.meil...@gmail.com> wrote:
>> Hi All,
>> 
>> The problem is :  I got a NullPointerException after using @Inject
>> environment : wicket 1.6 snapshot - cdi (weld) - inject - 
>> NullPointerException - tomcat 7 / jboss AS 7
>> 
>> module 1 : bookstoreservice  (with a beans.xml file)
>> module 2 : bookstoreweb  (with a beans.xml file)
>> 
>> in the bookstoreservice module I have these 2 classes:
>> 
>> @ApplicationScoped
>> public class Clock {
>>    public DateTime getTime() {
>>        return new DateTime().now();
>>    }
>> }
>> 
>> @ApplicationScoped
>> public class BigBenClock {
>> 
>>    @Inject
>>    Clock clock;
>> 
>>    public BigBenClock() {
>>    }
>> 
>>    public DateTime getBigBenTime() {
>>        return clock.getTime().plusHours(2);
>>    }
>> }
>> 
>> 
>> 
>> First use : All works fine
>> 
>> In a webpage, I have
>> 
>>    @Inject
>>    Clock clock;
>> 
>>    @Inject
>>    BigBenClock bigBenClock;
>> 
>>    add(new Label("time", new PropertyModel(this, "clock.time")));
>>    add(new Label("bigBenTime", new PropertyModel(this, 
>> "bigBenClock.bigBenTime")));
>> 
>> All works fine, thanks to Igor's example 
>> https://www.42lines.net/2011/11/15/integrating-cdi-into-wicket/
>> 
>> 
>> Second use : NullPointerException
>> 
>> If I use the injection in the bookstoreservice module with no injection in 
>> the webpage like this
>> 
>> 
>>    @Inject
>>    Clock clock;
>> 
>>    add(new Label("time", new PropertyModel(this, "clock.time")));
>> 
>>    BigBenClock bigBenClock = new BigBenClock();
>>    DateTime bigBenTime = bigBenClock.getBigBenTime();
>> 
>> I get a NullPointerException.  The BigBenClock's clok is null.
>> Same result in Tomcat 7 and Jboss AS7.
>> 
>> 
>> This is how I start the Wicket application
>> 
>> getComponentInstantiationListeners().add(new JavaEEComponentInjector(this, 
>> new ModuleJndiNamingStrategy()));
>> BeanManager beanManager = (BeanManager)getServletContext().getAttribute(  
>> Listener.BEAN_MANAGER_ATTRIBUTE_NAME);
>> new 
>> CdiConfiguration(beanManager).setPropagation(ConversationPropagation.NONE).configure(this);
>> 
>> 
>> Any advice ?
>> 
>> Thanks
>> 
>> François
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to