Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING: JSF1091: No mime type could be found for file dynamiccontent

I get the following warning under eclipse :

WARNING: JSF1091: No mime type could be found for file dynamiccontent. To resolve this, add a mime-type mapping to the applications web.xml

This error is caused when I post a picture

below primefaces composant :

<p:graphicImage  value="#{bean.image}"/>

Java Bean :

private StreamedContent image;

// Getter
public StreamedContent getImage() {
    try {
        JFreeChart jfreechart = ChartFactory.createPieChart3D("",
                        createDataset(), true, true, false);

        PiePlot3D plot = (PiePlot3D) jfreechart.getPlot();

        File chartFile = new File("dynamichart");
        ChartUtilities.saveChartAsPNG(chartFile, jfreechart, 375, 300);
        chartImage = new DefaultStreamedContent(new FileInputStream(
                        chartFile), "image/png");
        return chartImage;
    } catch (Exception e) {
        e.printStackTrace();
        return new DefaultStreamedContent();
    }
}

// generate data for image
public static PieDataset createDataset() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("A",10);
    dataset.setValue("B", 11);
    dataset.setValue("C", 80);
    dataset.setValue("D", 12);
    return dataset;
}
like image 862
Karim Oukara Avatar asked Feb 20 '13 15:02

Karim Oukara


3 Answers

I just want to share my experience with a similar problem, I use maven, netbeans and payara. Once I had this warning:

WARNING No mime type could be found for file fontawesome-webfont.woff is logged

The solution to remove this warning was adding the following code to the web.xml:

<mime-mapping>
    <extension>woff</extension>
    <mime-type>application/font-woff</mime-type>
</mime-mapping>

Note: I had the same warning with different files, those files had different extensions (woff, eot, woff2 and ttf). The solution to this was to replace woff in <extension> with one of the extensions previously mentioned.

I hope that my answer will help someone someday.

PS : I found the solution in this page.

like image 174
ziMtyth Avatar answered Oct 08 '22 04:10

ziMtyth


Try adding the following to your web.xml file

<mime-mapping>
    <extension>jsp <!--{or the extension of file}--></extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>
like image 6
Rajan Avatar answered Nov 04 '22 05:11

Rajan


I found one solution.

by using the latest version of primefaces (3.5).

<dependency>  
    <groupId>org.primefaces</groupId>  
    <artifactId>primefaces</artifactId>  
    <version>3.5</version>  
</dependency> 

but there will unpleasant changes in IHM

like image 5
Karim Oukara Avatar answered Nov 04 '22 05:11

Karim Oukara