wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: 404 error when calling getResourceSettings().getResourceFinders()
Date Tue, 11 Jun 2013 11:24:25 GMT
Hi,

It is not very clear what you have and what you expect, so I will explain
how WebApplicationPath works. If it doesn't do what you need then you will
have to create your own IResourceFinder.

The signature is
org.apache.wicket.core.util.file.WebApplicationPath#find(Class, String).
The first argument is the Page class, e.g. class
org.apache.wicket.examples.homepage.HomePage.
The second argument is the full path to the resource including the locale,
style and variation,
e.g. org/apache/wicket/examples/homepage/HomePage_en_US.html.

The constructor is
org.apache.wicket.core.util.file.WebApplicationPath#WebApplicationPath(ServletContext,
String path)
The second argument is the path inside the web root. In your case this is
"markup".

So you can put all your markup in
src/main/webapp/markup/com/myproject/MyPage.html.

If you need  something like src/main/webapp/markup/MyPage.html (no package
name!) then you will have to use your own IResourceFinder which will be
similar to WebApplicationPath but you have to manipulate the value of the
second argument to #find() method.



On Tue, Jun 11, 2013 at 11:05 AM, Joseph Mokenela <
matooanemokenela@gmail.com> wrote:

> I managed to debug, but it looks like the application is only looking for
> html files in the root. for example if my java file is in
> *com.foo.Home.java
> *, and the markup folder is named *markup *inside* webapp *root, it will
> expect the folder inside *markup/Home.html, *and then throw
> a*MarkupNotFoundException
> *since the file is not in the root. Not inside
> *markup/com/foo/Home.html*as I would have expected. Is there any way
> around this issue, or I have
> missed something?
>
> Regards
> Joseph
>
>
> On Mon, Jun 10, 2013 at 4:42 PM, Joseph Mokenela <
> matooanemokenela@gmail.com
> > wrote:
>
> > Thanks a lot Martin,
> >
> > I had an earlier version of wicket-extensions indeed. That solved it,
> >
> > Thanks again.
> >
> > Let me debug and I will feedback on the original error.
> >
> > Regards,
> >
> >
> >
> > On Mon, Jun 10, 2013 at 4:33 PM, Joseph Mokenela <
> > matooanemokenela@gmail.com> wrote:
> >
> >> The line at com.mmjmicrosystems.radarmarketing.Start.main(Start.java:66)
> >>
> >> is simply the call to server.start();
> >>
> >> on the jetty server instance.
> >>
> >>
> >> On Mon, Jun 10, 2013 at 4:26 PM, Joseph Mokenela <
> >> matooanemokenela@gmail.com> wrote:
> >>
> >>> Thanks for the quick response Martin,
> >>>
> >>> I have tried to debug the application but without success, I am using
> >>> jetty server and i keep getting the following stacktrace on jetty. I am
> >>> using Wicket 6.8.0
> >>>
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=IBehaviorListener, method=public
> abstract
> >>> void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=IFormSubmitListener, method=public
> abstract
> >>> void
> >>>
> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=ILinkListener, method=public abstract
> void
> >>> org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=IOnChangeListener, method=public
> abstract
> >>> void
> >>>
> org.apache.wicket.markup.html.form.IOnChangeListener.onSelectionChanged()]
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=IRedirectListener, method=public
> abstract
> >>> void org.apache.wicket.IRedirectListener.onRedirect()]
> >>> INFO  - RequestListenerInterface   - registered listener interface
> >>> [RequestListenerInterface name=IResourceListener, method=public
> abstract
> >>> void org.apache.wicket.IResourceListener.onResourceRequested()]
> >>> INFO  - Application                - [wicket.radar-marketing] init:
> >>> Wicket extensions initializer
> >>> WARN  - AbstractLifeCycle          - FAILED wicket.radar-marketing:
> >>> java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> at
> >>>
> org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar$ComponentInitializer.init(UploadProgressBar.java:55)
> >>>  at org.apache.wicket.extensions.Initializer.init(Initializer.java:36)
> >>> at org.apache.wicket.Application.initInitializers(Application.java:612)
> >>>  at
> >>>
> org.apache.wicket.Application.initializeComponents(Application.java:521)
> >>> at org.apache.wicket.Application.initApplication(Application.java:817)
> >>>  at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424)
> >>> at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351)
> >>>  at
> >>> org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
> >>> at
> >>>
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> >>>  at
> >>>
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
> >>> at
> >>>
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> >>>  at
> >>> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
> >>> at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> >>>  at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>> at com.mmjmicrosystems.radarmarketing.Start.main(Start.java:66)
> >>>  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:601)
> >>>  at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> >>> WARN  - AbstractLifeCycle          - FAILED
> >>>
> o.e.j.w.WebAppContext{/radarmarketing,file:/N:/Projects/Java%20Enterprise/radar-marketing/src/main/webapp/},src/main/webapp:
> >>> java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> at
> >>>
> org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar$ComponentInitializer.init(UploadProgressBar.java:55)
> >>>  at org.apache.wicket.extensions.Initializer.init(Initializer.java:36)
> >>> at org.apache.wicket.Application.initInitializers(Application.java:612)
> >>>  at
> >>>
> org.apache.wicket.Application.initializeComponents(Application.java:521)
> >>> at org.apache.wicket.Application.initApplication(Application.java:817)
> >>>  at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424)
> >>> at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351)
> >>>  at
> >>> org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
> >>> at
> >>>
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> >>>  at
> >>>
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
> >>> at
> >>>
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> >>>  at
> >>> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
> >>> at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> >>>  at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>> at com.mmjmicrosystems.radarmarketing.Start.main(Start.java:66)
> >>>  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:601)
> >>>  at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> >>> WARN  - AbstractLifeCycle          - FAILED
> >>> org.eclipse.jetty.server.Server@12bb08f: java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>> at
> >>>
> org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar$ComponentInitializer.init(UploadProgressBar.java:55)
> >>>  at org.apache.wicket.extensions.Initializer.init(Initializer.java:36)
> >>> at org.apache.wicket.Application.initInitializers(Application.java:612)
> >>>  at
> >>>
> org.apache.wicket.Application.initializeComponents(Application.java:521)
> >>> at org.apache.wicket.Application.initApplication(Application.java:817)
> >>>  at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424)
> >>> at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351)
> >>>  at
> >>> org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
> >>> at
> >>>
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> >>>  at
> >>>
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
> >>> at
> >>>
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> >>>  at
> >>> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at
> >>>
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
> >>> at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> >>>  at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>> at com.mmjmicrosystems.radarmarketing.Start.main(Start.java:66)
> >>>  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:601)
> >>>  at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> >>> Exception in thread "main" java.lang.NoSuchMethodError:
> >>>
> org.apache.wicket.SharedResources.add(Ljava/lang/String;Lorg/apache/wicket/Resource;)V
> >>>  at
> >>>
> org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar$ComponentInitializer.init(UploadProgressBar.java:55)
> >>> at org.apache.wicket.extensions.Initializer.init(Initializer.java:36)
> >>>  at
> org.apache.wicket.Application.initInitializers(Application.java:612)
> >>> at
> >>>
> org.apache.wicket.Application.initializeComponents(Application.java:521)
> >>>  at org.apache.wicket.Application.initApplication(Application.java:817)
> >>> at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424)
> >>>  at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351)
> >>> at
> org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
> >>>  at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>> at
> >>>
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748)
> >>>  at
> >>>
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
> >>> at
> >>>
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1222)
> >>>  at
> >>>
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
> >>> at
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:455)
> >>>  at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>> at
> >>>
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
> >>>  at org.eclipse.jetty.server.Server.doStart(Server.java:260)
> >>> at
> >>>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
> >>>  at com.mmjmicrosystems.radarmarketing.Start.main(Start.java:66)
> >>> 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:601)
> >>> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> >>>
> >>> Process finished with exit code 1
> >>>
> >>>
> >>> On Mon, Jun 10, 2013 at 10:31 AM, Martin Grigorov <
> mgrigorov@apache.org>wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I think your setup should be enough.
> >>>> You can put a breakpoint in
> >>>> org.apache.wicket.core.util.file.WebApplicationPath#find() method and
> >>>> see
> >>>> what happens.
> >>>>
> >>>>
> >>>> On Mon, Jun 10, 2013 at 11:23 AM, Joseph Mokenela <
> >>>> matooanemokenela@gmail.com> wrote:
> >>>>
> >>>> > Hi,
> >>>> >
> >>>> > I need help with Wicket.
> >>>> >
> >>>> >
> >>>> > I am working on an application of which I am using Wicket framework
> >>>> for my
> >>>> > front end.
> >>>> >
> >>>> > I have a folder named "*markup*" inside the root of webapp which
i
> >>>> want to
> >>>> > put all the markup files in, the problem is that, when I call the
> >>>> following
> >>>> > line,
> >>>> >
> >>>> > *getResourceSettings().getResourceFinders().add(new
> >>>> > WebApplicationPath(getServletContext(), "markup"))*
> >>>> >
> >>>> > *I get the 404 error, resource not found*,  even if the folder
is
> >>>> there on
> >>>> > the file system
> >>>> >
> >>>> >
> >>>> > Is there any extra setting I need to do?
> >>>> >
> >>>> > Any help will be appreciated.
> >>>> >
> >>>> >
> >>>> > Regards,
> >>>> >
> >>>> > --
> >>>> > *Joseph Mokenela*
> >>>> >
> >>>> >
> >>>> > *Write your code as if the person who maintains it is a homicidal
> >>>> maniac
> >>>> > who knows where you live.*
> >>>> >
> >>>> > P please don't print this e-mail unless you really need to.
> >>>> >
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> *Joseph Mokenela*
> >>> *Java Developer
> >>> Discovery Vitality*
> >>> *Email: matooane@dev.java.net*
> >>>
> >>> *Write your code as if the person who maintains it is a homicidal
> >>> maniac who knows where you live.*
> >>>
> >>> P please don't print this e-mail unless you really need to.
> >>>
> >>
> >>
> >>
> >> --
> >> *Joseph Mokenela*
> >> *Java Developer
> >> Discovery Vitality*
> >> *Email: matooane@dev.java.net*
> >>
> >> *Write your code as if the person who maintains it is a homicidal maniac
> >> who knows where you live.*
> >>
> >> P please don't print this e-mail unless you really need to.
> >>
> >
> >
> >
> > --
> > *Joseph Mokenela*
> > *Java Developer
> > Discovery Vitality*
> > *Email: matooane@dev.java.net*
> >
> > *Write your code as if the person who maintains it is a homicidal maniac
> > who knows where you live.*
> >
> > P please don't print this e-mail unless you really need to.
> >
>
>
>
> --
> *Joseph Mokenela*
> *Java Developer
> Discovery Vitality*
> *Email: matooane@dev.java.net*
>
> *Write your code as if the person who maintains it is a homicidal maniac
> who knows where you live.*
>
> P please don't print this e-mail unless you really need to.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message