I'm using PrimeFaces 3.2 on JBoss 7.1.1.
I am trying to display an image which is stored in a BLOB in a MySQL database in <ui:repeat>
. The image is stored in a byte[]
and then converted to a StreamedContent
as follows:
InputStream stream = new ByteArrayInputStream(ingredient.getImage());
ingredient.setJsfImage(new DefaultStreamedContent(stream, "image/jpg"));
Then I am trying to display it in a Facelet as follows:
<ui:repeat var="ingredient" value="#{formBean.ingredientResultSet}">
<p:panel id="resultsPanel" header="#{ingredient.location.shopName}">
<p:graphicImage value="#{ingredient.jsfImage}" alt="No picture set" />
...
However, when loading the page, I get the following error in JBoss:
SEVERE [org.primefaces.application.PrimeResourceHandler] (http--127.0.0.1-8080-12) Error in streaming dynamic resource.
How is this caused and how can I solve it?
ImageService
should look like? – Shore