Hello user list,
I just wanted to aska quick question and know if I am going in the right
direction. I am developping a Wicket application (obviously) that can be
extended through module loaded in an OSGi framework.
At the first attempt, I got this when using an Image with ResourceReference
in Wicket 1.4.1 :
java.lang.NullPointerException
at
org.apache.wicket.SharedResources.resourceKey(SharedResources.java:335)
at org.apache.wicket.SharedResources.get(SharedResources.java:219)
at org.apache.wicket.ResourceReference.bind(ResourceReference.java:137)
at
org.apache.wicket.markup.html.image.resource.LocalizedImageResource.bind(LocalizedImageResource.java:180)
at
org.apache.wicket.markup.html.image.resource.LocalizedImageResource.setResourceReference(LocalizedImageResource.java:246)
at
org.apache.wicket.markup.html.image.Image.setImageResourceReference(Image.java:178)
at org.apache.wicket.markup.html.image.Image.<init>(Image.java:101)
at org.apache.wicket.markup.html.image.Image.<init>(Image.java:77)
>From what I can see, this is because the scope passed in Resourcereference
is transferred to a class name string and then it is taken back into a Class
Object using the default ClassLoader.
Because I am using an OSGi framework, the classloader is not quite natural
and it can't be used the eaxct same way. I have found a post (
http://markmail.org/message/zrauqq43hmbwjfvm) that is talking about this
problem exactly in the Mailing list.
However, I wanted to know how I can change the class resolver used by Wicket
as sugggested in the post. I have seen tha tthe session object is using a
class resolver or it can also be changed using the ApplicationSettings
implementation. What is the best approach as to give the possibility to get
ride of this problem?
Also, I wanted to know if it would not be a good thing for the framework to
throw another type of exception then a NullPointer. It is not quite obvious
what is going on in the framework when this is happening.
Does somebody got the same issue? Is the Classresolver the only possibility
for me?
Thanks in advance for the answer.
Marc-Andre