Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Usage of ApplicationResource
Hello,
I wrote a simple application, it should only display an image.
I my Application I uses the following code
label.setIcon( new ClassResource( "find.png", this ) );
My find.png is located in the the package as the Application class.
After running the application no Image will be displayed, in the logs I found
INFO: Requested resource [VAADIN/APP/1/find.png] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Whats wrong ?
After I added
@Override
public String getRelativeLocation( final ApplicationResource resource) {
try {
Field field = Application.class.getDeclaredField("resourceKeyMap");
field.setAccessible(true);
Map<Application,String> map = (Map<Application, String>) field.get( this );
String key = map.get(resource);
if( key != null ) {
return "app://APP/" + 1 + "/x";
}
} catch (Exception e) {
e.printStackTrace();
}
return super.getRelativeLocation(resource);
}
I my Application everythings works as expected.
I'm not sure whats wrong, do I used the api wrong ?
Best regards,
André
EDIT --- Ignore my previous comments, I was mixing up concepts.
Upon closer investigation, it seems that the issue is somehow related to how your application is deployed, though I can't tell exactly what is going on there...