java.io.StreamCorruptedException: invalid stream header: EFBFBDEF

Finally after 3 day of headache I solved my trouble. I’m using maven like tool of project managment and I’m working on a modular project with this structure

|-- parent
   |-- model
    --pom.xml
   |-- services
    --pom.xml
   |-- web-app
    --pom.xml

The porblem was that the file that I try to load like Input stream was in the src/main/resources in the services module, but in the web-app’s pom.xml I enable the resource filtering, and since that web-app module depends of service the filtering was extended at the services module.

In filtering section of the maven web site Filtering I found:

Warning: Do not filter files with binary content like images! This will most likely result in corrupt output. If you have both text files and binary files as resources, you need to declare two mutually exclusive resource sets. The first resource set defines the files to be filtered and the other resource set defines the files to copy unaltered as illustrated below:

Then I removed the following code from my web-app module and everything works

<resources>
     <resource>
         <directory>src/main/resources</directory>
         <filtering>true</filtering>
    </resource>
</resources>

Leave a Comment