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.

Comments:

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?

Posted by Alan Garfield on September 21, 2009 at 04: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

Posted by Adam Bien on September 21, 2009 at 01:12 PM 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!

Posted by Adriaaaaan on September 28, 2009 at 12:53 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments
License