it is peculiar that no one else has seen such an error... if you can provide us with a way to reproduce this we would be happy to look into it.
-igor On Mon, Feb 15, 2010 at 5:19 AM, Andreas Strafner <[email protected]> wrote: > Hello everyone, > > in our application (with wicket 1.4.5) we 're using a static > ResourceReferences and pass it into several Wicket Images > (setImageResourceReference) that are displayed in multiple rows of several > DataViews. At the first glanze everything works fine, but during > performancetests we ran occasionally into NullpointerExceptions in the bind > method of the Resource Reference. A deeper look into the wicket source > showed us, that the field "resource" of the ResourceReference has to be > 'null' (see ResourceReference line 141). As the field is checked for not > being 'null' just the line above this seems to be a multithreading issue. > > Actually we thought that ResourceReferences could be shared as statics > through the application. Is this assumption wrong? > Is there a standard mechanism to be used then instead? > > Thanks for your help, > > andy > > _____________Details: > > A deeper Look into wicket brought us to the following point: > The Image class is using a LocalizedImageResource. On calling > setImageResourceReference the LocalizedImageResource.bind Method is called. > In there, the resourceReference.bind is called and afterwards (as the > resource is a PackageReource) resource.setLocale. Set Locale is invalidating > the field 'resource' by setting it to 'null' and could be the root cause of > the NullpointerException thrown. > > ______________The ResourceReference Definition: > class ImageAnchor { > public static final IMAGE = new ResourceReference(ImageAnchor.class, > "image.gif"); > } > > _______________The Exception thrown: > Root cause: class java.lang.NullPointerException > java.lang.NullPointerException > at org.apache.wicket.ResourceReference.bind(ResourceReference.java:141) > 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.resource.LocalizedImageResource.setResourceReference(LocalizedImageResource.java:220) > at > org.apache.wicket.markup.html.image.Image.setImageResourceReference(Image.java:166) > [..] > at > org.apache.wicket.markup.repeater.RefreshingView$1.newItem(RefreshingView.java:114) > at > org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(DefaultItemReuseStrategy.java:71) > at > org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(DefaultItemReuseStrategy.java:68) > at > org.apache.wicket.markup.repeater.RefreshingView.addItems(RefreshingView.java:186) > at > org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:98) > at > org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131) > at > org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:116) > > _________ ResourceReference.java:138-141: > > if ((resource != null) && (resource instanceof PackageResource)) > { > // see newResource() as well. > locale = ((PackageResource)resource).getLocale(); > > [..] > > } > > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
