nazymko / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

PowerMockRunner throws UnsatisfiedLinkError with ImageIO.write() #141

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1) Create a JUnit4.4 unit test using 1.2.5 and EasyMock 2.4
2) Create a new File object, and simply make a JPEG image like this:

BufferedImage testImage = new BufferedImage(width, height,
BufferedImage.TYPE_3BYTE_BGR);
ImageIO.write(testImage, "jpeg", startFile);        

What is the expected output? What do you see instead?
It's expected that the ImageIO will create a new JPG image. What happens,
is an exception is thrown:

Caused by: java.lang.UnsatisfiedLinkError:
com.sun.imageio.plugins.jpeg.JPEGImageWriter.initWriterIDs(Ljava/lang/Class;Ljav
a/lang/Class;Ljava/lang/Class;)V
    at com.sun.imageio.plugins.jpeg.JPEGImageWriter.initWriterIDs(Native Method)
    at
com.sun.imageio.plugins.jpeg.JPEGImageWriter.<clinit>(JPEGImageWriter.java:163)
    at
com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi.createWriterInstance(JPEGImageWr
iterSpi.java:96)
    at
javax.imageio.spi.ImageWriterSpi.createWriterInstance(ImageWriterSpi.java:327)
    at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:817)
    at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:801)
    at javax.imageio.ImageIO.write(ImageIO.java:1471)
    at javax.imageio.ImageIO.write(ImageIO.java:1521)
    at redfin.util.ImageUtilTest.createTempJpeg(ImageUtilTest.java:17)
    at
com.redfin.uploader.photoServiceWS.PhotoServiceImplTest$DataHandlerMyMock.<init>
(PhotoServiceImplTest.java:260)
    at
com.redfin.uploader.photoServiceWS.PhotoServiceImplTest.testUploadFailTwo(PhotoS
erviceImplTest.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
    at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$2.
runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:222)
    ... 19 more

What version of the product are you using? On what operating system?
Create a JUnit4.4 unit test using 1.2.5 and EasyMock 2.4 with Java 6 and on
Windows XP

Original issue reported on code.google.com by james.de...@gmail.com on 24 Aug 2009 at 9:48

GoogleCodeExporter commented 8 years ago
Thanks for reporting this. How does your test look like? What have you prepared 
for test?

Original comment by johan.ha...@gmail.com on 25 Aug 2009 at 6:41

GoogleCodeExporter commented 8 years ago
I get the same exact thing.  Trying to generate a receipt image that includes 
text and a barcode image, but get the UnsatisfiedLinkError for the JPEG writer.

Original comment by ask.mi...@gmail.com on 15 Aug 2012 at 4:31

GoogleCodeExporter commented 8 years ago
The API that triggers an issue is only supported on 32 bit JRE on Windows as 
explained here: 
http://stackoverflow.com/questions/5207145/jai-and-imageio-for-64-bit-windows. 
If you are running 64 bit windows JDK/JRE - you'll have to switch to 32 bit.

Original comment by ishai...@gmail.com on 13 Mar 2013 at 9:16

GoogleCodeExporter commented 8 years ago
Uh that seems like a bad "solution" don't you think?

Original comment by james.de...@gmail.com on 13 Mar 2013 at 9:17

GoogleCodeExporter commented 8 years ago
That doesn't really seem like a solution at all :)

Original comment by alg...@gmail.com on 13 Mar 2013 at 9:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Came across the same issue on below Java version. OS: Windows 7 64 bit.

java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)

Original comment by dakbhav...@gmail.com on 23 Aug 2015 at 8:00