0
I would like to know how to solve this problem, to acquire more knowledge I am doing a small application.
<html>
<head>
</head>
<body>
<h1>Wicket + Spring integration example</h1>
<label wicket:id="msg"></label>
</body>
</html>
Java:
package br.com.ordem.servico.servicosautomotivos;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;
public class SimplePage extends WebPage{
@SpringBean
private HelloService helloService;
public SimplePage(PageParameters parameters) {
Label label = new Label("msg", new Model<String>(helloService.getHelloWorldMsg()));
this.add(label);
}
}
package br.com.ordem.servico.servicosautomotivos;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
public class WicketApplication extends WebApplication{
@Override
public Class<? extends Page> getHomePage() {
return SimplePage.class;
}
}
Unexpected Runtimeexception
Wicketmessage: Can’t instantiate page using constructor public br.com.order.servico.servicosautomotivos.Simplepage(org.apache.wicket.Pageparameters) and argument
Root cause:
java.lang.Nullpointerexception at br.com.ordem.servico.servicosautomotivos.SimplePage.(Simplepage.java:16) at sun.reflect.Nativeconstructoraccessorimpl.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.wicket.session.Defaultpagefactory.createPage(Defaultpagefactory.java:188) at org.apache.wicket.session.Defaultpagefactory.newPage(Defaultpagefactory.java:65) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.newPage(Bookmarkablepagerequesttarget.java:298) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.getPage(Bookmarkablepagerequesttarget.java:320) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.processEvents(Bookmarkablepagerequesttarget.java:234) at org.apache.wicket.request.Abstractrequestcycleprocessor.processEvents(Abstractrequestcycleprocessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(Requestcycle.java:1250) at org.apache.wicket.RequestCycle.step(Requestcycle.java:1329) at org.apache.wicket.RequestCycle.Steps(Requestcycle.java:1436) at org.apache.wicket.RequestCycle.request(Requestcycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(Wicketfilter.java:486) at org.apache.wicket.protocol.http.WicketFilter.doFilter(Wicketfilter.java:319) at org.eclipse.Jetty.servlet.Servlethandler$Cachedchain.doFilter(Servlethandler.java:1668) at org.eclipse.Jetty.servlet.Servlethandler.doHandle(Servlethandler.java:581) at org.eclipse.Jetty.server.Handler.ScopedHandler.Handle(Scopedhandler.java:143) at org.eclipse.Jetty.security.Securityhandler.Handle(Securityhandler.java:548) at org.eclipse.Jetty.server.Session.SessionHandler.doHandle(Sessionhandler.java:226) at org.eclipse.Jetty.server.Handler.ContextHandler.doHandle(Contexthandler.java:1158) at org.eclipse.Jetty.servlet.Servlethandler.doScope(Servlethandler.java:511) at org.eclipse.Jetty.server.Session.SessionHandler.doScope(Sessionhandler.java:185) at org.eclipse.Jetty.server.Handler.ContextHandler.doScope(Contexthandler.java:1090) at org.eclipse.Jetty.server.Handler.ScopedHandler.Handle(Scopedhandler.java:141) at org.eclipse.Jetty.server.Handler.ContextHandlerCollection.Handle(Contexthandlercollection.java:213) at org.eclipse.Jetty.server.Handler.HandlerCollection.Handle(Handlercollection.java:109) at org.eclipse.Jetty.server.Handler.HandlerWrapper.Handle(Handlerwrapper.java:119) at org.eclipse.Jetty.server.Server.Handle(Server.java:517) at org.eclipse.Jetty.server.Httpchannel.Handle(Httpchannel.java:308) at org.eclipse.Jetty.server.Httpconnection.onFillable(Httpconnection.java:242) at org.eclipse.Jetty.io.Abstractconnection$Readcallback.succeeded(Abstractconnection.java:273) at org.eclipse.Jetty.io.Fillinterest.fillable(Fillinterest.java:95) at org.eclipse.Jetty.io.Selectchannelendpoint$2.run(Selectchannelendpoint.java:75) at org.eclipse.Jetty.util.thread.strategy.Executeproduceconsume.produceAndRun(Executeproduceconsume.java:213) at org.eclipse.Jetty.util.thread.strategy.Executeproduceconsume.run(Executeproduceconsume.java:147) at org.eclipse.Jetty.util.thread.QuedThreadPool.runJob(Queuedthreadpool.java:654) at org.eclipse.Jetty.util.thread.Queuedthreadpool$3.run(Queuedthreadpool.java:572) at java.lang.Thread.run(Unknown Source)
Complete stack:
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public br.com.ordem.servico.servicosautomotivos.SimplePage(org.apache.wicket.PageParameters) and argument at org.apache.wicket.session.Defaultpagefactory.createPage(Defaultpagefactory.java:212) at org.apache.wicket.session.Defaultpagefactory.newPage(Defaultpagefactory.java:65) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.newPage(Bookmarkablepagerequesttarget.java:298) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.getPage(Bookmarkablepagerequesttarget.java:320) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.processEvents(Bookmarkablepagerequesttarget.java:234) at org.apache.wicket.request.Abstractrequestcycleprocessor.processEvents(Abstractrequestcycleprocessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(Requestcycle.java:1250) at org.apache.wicket.RequestCycle.step(Requestcycle.java:1329) at org.apache.wicket.RequestCycle.Steps(Requestcycle.java:1436) at org.apache.wicket.RequestCycle.request(Requestcycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(Wicketfilter.java:486)
java.lang.reflect.Invocationtargetexception at sun.reflect.Nativeconstructoraccessorimpl.newInstance0(Native Method) at sun.reflect.Nativeconstructoraccessorimpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.wicket.session.Defaultpagefactory.createPage(Defaultpagefactory.java:188) at org.apache.wicket.session.Defaultpagefactory.newPage(Defaultpagefactory.java:65) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.newPage(Bookmarkablepagerequesttarget.java:298) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.getPage(Bookmarkablepagerequesttarget.java:320) at org.apache.wicket.request.target.component.Bookmarkablepagerequesttarget.processEvents(Bookmarkablepagerequesttarget.java:234) at org.apache.wicket.request.Abstractrequestcycleprocessor.processEvents(Abstractrequestcycleprocessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(Requestcycle.java:1250) at org.apache.wicket.RequestCycle.step(Requestcycle.java:1329) at org.apache.wicket.RequestCycle.Steps(Requestcycle.java:1436) at org.apache.wicket.RequestCycle.request(Requestcycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(Wicketfilter.java:486)
display page view
Copy the generated and posted error log and text and not image format please.
– Guilherme Nascimento