Wicket: ModalWindow and ClassNotFound: CompressedResourceReference

1.3k views Asked by At

Everytime I try to implement a modalwindow I get:

java.lang.ClassNotFoundException: org.apache.wicket.request.resource.CompressedResourceReference

None of my libraries has this element. My dependency are:

    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-core</artifactId>
        <version>1.5.3</version>
    </dependency>

    <!-- DatePicker -->
    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-datetime</artifactId>
        <version>1.5.2</version>
    </dependency>


<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>1.5.3</version>
 </dependency>

€ Thats how I implemented my modalwindow:

 import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.util.time.Duration;



public class ModalPanel1 extends WebPage
{
 public ModalPanel1(String id)
{
final ModalWindow modalWindow = new ModalWindow("modal");

modalWindow.setTitle("Popup");
modalWindow.setInitialWidth(400);
modalWindow.setInitialHeight(400);
modalWindow.setResizable(true);
modalWindow.setContent(new AbstractModalClosePanel(modalWindow)
{
  public void onClick(AjaxRequestTarget target)
  {
    modalWindow.close(target);
  }
});
add(modalWindow);

add(new AjaxLink<Void>("open")
{
  @Override
  public void onClick(AjaxRequestTarget target)
  {
    modalWindow.show(target);
  }
});

add(new AbstractAjaxTimerBehavior(Duration.seconds(2))
{
  @Override
  protected void onTimer(AjaxRequestTarget target)
  {
    modalWindow.show(target);
    stop();
  }
});
 }
 }

and

 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.panel.Panel;


 public abstract class AbstractModalClosePanel extends Panel
 {
   public AbstractModalClosePanel(ModalWindow modalWindow)
   {
super(modalWindow.getContentId());



 }

There are no old imports.

Complete Stack Trace

Complete stack:org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.onespark.wicket.components.tasks.Tasks()'. Might be it doesn't exist, may be it is not visible (public). at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:196) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103) at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165) at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:177) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103) at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165) at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)java.lang.NoClassDefFoundError: org/apache/wicket/request/resource/CompressedResourceReference at com.onespark.wicket.components.tasks.ModalPanel1.(ModalPanel1.java:16) at com.onespark.wicket.components.tasks.Tasks.(Tasks.java:14) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:177) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103) at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165) at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)

1

There are 1 answers

1
Don Roby On

CompressedResourceReference was dropped in Wicket 1.5 along with other compression stuff.

If you have a reference to this in your own code, you should just use a normal ResourceReference or other non-compressed version.

In earlier versions, it was used in ModalWindow, but it's not at least in 1.5.3, so

<dependency>
    <groupId>org.apache.wicket</groupId>
    <artifactId>wicket-extensions</artifactId>
    <version>1.5.3</version>
</dependency>

should have worked.

I would try that again, and make sure you've got a clean update so there isn't a reference to old ModalWindow code hanging around.

There may well still have been references in a release candidate, as I think it was still in wicket-core in some release candidates.

You might also want to look at more of the stack trace to narrow down where the reference to this class is.