Adam Bien's Weblog

Sunday Sep 20, 2009

Wicket 1.4, Too many path parts... Exception, Reason And Workaround

The following exception:


java.lang.IllegalArgumentException: Too many path parts, please provide sufficient number of path parameter names
     at org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.decodeParameters(MixedParamUrlCodingStrategy.java:181)
     at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:80)
     at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.targetForRequest(WebRequestCodingStrategy.java:484)
     ...

occurs after mounting a page with the MixedParamUrlCodingStrategy (the "RESTFul way"). This exception happens in pages with relative links (e.g. ./img/picture.jpg). The MixedParamUrlCodingStrategy seems to prepend the "resource" context before each relative URL what results in this exception.

Workaround: the use of absolute URLs, or other UrlCodingStrategies.


[my tweets]  Rss My book: Real World Java EE - Rethinking Best Practices

Kommentare:

Hey Adam, hope you are well.

Have you managed to get Wicket 1.4 working with EJB? The wicket-javaee project doesn't seem to support 1.4 and also has a bug with the classloader in Glassfish. I'd be interested to see how you're doing it. Spring?

Gesendet von Alan Garfield am September 21, 2009 at 02:05 AM CEST #

I'm using wicket-javaee with 1.4rc - but will migrate to 1.4 soon. The injection works perfectly. It is running on Glassfish v2.1 and I'm using EJB 3 for the logic.

Btw. instead of injection, lookup would work perfectly as well. I would use a BeanLocator with a single, static method as well.

Btw. Spring would work perfectly as well - but I'm enjoying the Convention Over Configuration :-)

thanks!,

adam

Gesendet von Adam Bien am September 21, 2009 at 11:12 AM CEST #

@Alan
Its simple to use with glassfish, include wicket-ioc + wicket javaee libraries.

Then use this in your init() method in your application class.
addComponentInstantiationListener(new JavaEEComponentInjector(this));

then be sure to add the bean name to the annotation
@EJB(name="MyEjb")
ServiceLocal myService;

Works great for me!

Gesendet von Adriaaaaan am September 28, 2009 at 10:53 AM CEST #

Senden Sie einen Kommentar:
  • HTML Syntax: Ausgeschaltet
Interviews/About
My Recent Book
Java One 2009
CommunityOne East N.Y.C
JavaONE 2008 Interview
Search
...the last 150 posts
...the last 10 comments
greenfire.dev.java.net
Links
my.netbeans.org
Visitors
License