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

27,036

Solution 1

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

Solution 2

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>

Solution 3

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.

Solution 4

I had the JSF1091 warning for http://example.org  and javascript:; as well, with Icefaces instead of Primefaces.

Changing

<ice:outputLink onclick="..." value="javascript:;">...</ice:outputLink>

to

<ice:outputLink onclick="..." value="/some/url">...</ice:outputLink>

silenced the warning about javascript:;.

Changing

<ice:outputLink value="http://example.org"/>

to

<a href="http://example.org"/>

fixed it for the URL.

Solution 5

Although I post this answer after a while probably it will be useful for other developers who face this problem.

To avoid that annoying warning from above add the following code into your web.xml :

<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>

For more details please check:

http://blog.eisele.net/2011/01/weblogic-10340-oepe-maven-primefaces.html

Share:
27,036
Karim Oukara
Author by

Karim Oukara

computer engineer Java/Jee Angularjs

Updated on April 13, 2020

Comments

  • Karim Oukara
    Karim Oukara about 4 years

    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;
    }
    
  • Kukeltje
    Kukeltje over 6 years
    This is when you use Spring AND an embedded container, so you are most likely running SpringBoot?
  • Jay Ehsaniara
    Jay Ehsaniara over 6 years
    yeah exactly, this is also a solution if you are using SpringBoot. an alternative for those who are not using web.xml. basically you are adding your maps on MimeMappings.
  • Brian
    Brian about 4 years
    While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply.