xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kerschbaum Michael " <m.kerschb...@pke.at>
Subject AW: Document saved as JPEG - getting IncompatibleClassChangeError
Date Thu, 29 Jan 2009 08:22:29 GMT
Hello,

 
I'am using JDK 1.4.2 ? Perhaps thats the problem, but in the code is never such an exception
thrown. I sounds for me that something is wrong with you batik version, perhaps a jar file
is missing... 
This was found interface com.sun.image.codec.jpeg.JPEGImageEncoder

Expected was org.apache.batik.ext.awt.image.codec.jpeg.JPEGImageWriter... See if you have
this class in your classpath..

Mit freundlichen Grüßen Michael Kerschbaum

 


-----Ursprüngliche Nachricht-----
Von: Simon Mittermüller [mailto:simon.mittermueller@googlemail.com] 
Gesendet: Mittwoch, 28. Jänner 2009 17:59
An: batik-users@xmlgraphics.apache.org
Betreff: Re: Document saved as JPEG - getting IncompatibleClassChangeError

Hi,

No, does not work for me:

Exception in thread "AWT-EventQueue-0"  
java.lang.IncompatibleClassChangeError: Found interface com.sun.image.codec.jpeg.JPEGImageEncoder,
but class was expected
	at
org
.apache
.batik.ext.awt.image.codec.jpeg.JPEGImageWriter.writeImage(Unknown
Source)
	at
org.apache.batik.transcoder.image.JPEGTranscoder.writeImage(Unknown
Source)
	at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown
Source)
	at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
Source)
	at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
Source)
	at experimentalcode.simon.gui.PatternPlot.saveAsJPEG(PatternPlot.java: 
564)
	at experimentalcode.simon.gui.PatternControlPanel
$ImageSaveDialog.actionPerformed(PatternControlPanel.java:494)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java: 
2028)
	at javax.swing.AbstractButton
$Handler.actionPerformed(AbstractButton.java:2351)
	at
javax
.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java: 
387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java: 
242)
	at
javax
.swing
.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java: 
236)
	at java.awt.Component.processMouseEvent(Component.java:6126)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
	at java.awt.Component.processEvent(Component.java:5891)
	at java.awt.Container.processEvent(Container.java:2102)
	at java.awt.Component.dispatchEventImpl(Component.java:4497)
	at java.awt.Container.dispatchEventImpl(Container.java:2160)
	at java.awt.Component.dispatchEvent(Component.java:4327)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java: 
4366)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java: 
4030)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3960)
	at java.awt.Container.dispatchEventImpl(Container.java:2146)
	at java.awt.Window.dispatchEventImpl(Window.java:2440)
	at java.awt.Component.dispatchEvent(Component.java:4327)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at
java
.awt
.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java: 
300)
	at
java
.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java: 
210)
	at
java
.awt
.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java: 
200)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java: 
195)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java: 
187)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)



Exception occurs on
jtrans.transcode(input, output);


I've never seen an IncompatibleClassChangeError.


Is Batik and the Sun implemention different? (different versions?)

In the batik sources, I cant find
"com.sun.image.codec.jpeg.JPEGImageEncoder" class or interface.
The JPEGTranscoder is located in the package "org.apache.batik.transcoder.image".

What version of JPEGImageEncoder do I need?

Do I need the Java Image I/O?
Do I need to download it?

Is there another way for saving a DOM (SVGDocument) to a JPEG?

-----------
JDK 1.5 for Macosx
batik-1.7

thx.
Simon.

On 22. Jan 2009, at 14:14 , Kerschbaum Michael wrote:

> Hello,
>
> I'am just writting it into an byteArray?!
>  Works fine...
>
>
> ....
>
> byte[] jpegByteArr = null;
>
> public void makeJpeg() {
>   logger.debug("Entering makeJpeg!");
>   long duracel = System.currentTimeMillis();
>   try {
>    JPEGTranscoder jtrans = new JPEGTranscoder();
>    jtrans.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new 
> Float(1));
>    jtrans.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new 
> Float(150));
>    jtrans.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new 
> Float(150));
>
>    TranscoderInput input = new TranscoderInput(ag.getSVGDocument());
>    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
>    TranscoderOutput output = new TranscoderOutput(outStream);
>
>    jtrans.transcode(input, output);
>    jpegByteArr = outStream.toByteArray();
>    outStream.flush();
>    outStream.close();
>   } catch (Exception e) {
>    logger.error(e.getMessage());
>   }
>   logger.info("Duration creating JPEG: "
>     + (System.currentTimeMillis() - duracel) + " ms");  }
>
> .....
>
> Mit freundlichen Grüßen Michael Kerschbaum
>
>
> Von: Simon Mittermüller [mailto:simon.mittermueller@googlemail.com]
> Gesendet: Donnerstag, 22. Jänner 2009 12:10
> An: batik-users@xmlgraphics.apache.org
> Betreff: Document saved as JPEG - getting IncompatibleClassChangeError
>
> Hi,
>
> Saving as SVG or PNG works fine.
>
> But I am getting error when doing this:
> I use this piece of code to save a document as a JPEG:
>
> <code>
> public void saveAsJPEG(File file) throws IOException, 
> TranscoderException {
>
> JPEGTranscoder t = new JPEGTranscoder(); 
> t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
>
> TranscoderInput input = new TranscoderInput(document); OutputStream 
> ostream = new FileOutputStream(file); TranscoderOutput output = new 
> TranscoderOutput(ostream); 
> t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(100)); 
> t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(100)); 
> t.transcode(input, output); ostream.flush(); ostream.close(); } 
> </code>
>
> Exception in thread "AWT-EventQueue-0"  
> java.lang.IncompatibleClassChangeError: Found interface 
> com.sun.image.codec.jpeg.JPEGImageEncoder, but class was expected at 
> org .apache 
> .batik.ext.awt.image.codec.jpeg.JPEGImageWriter.writeImage(Unknown
> Source)
> at
> org.apache.batik.transcoder.image.JPEGTranscoder.writeImage(Unknown
> Source)
> at
> org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown
> Source)
> at
> org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
> Source)
> at
> org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
> Source)
> at
> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java: 
> 2028)
> ...
>
>
> Has anybody had similar problems?
> Where is "com.sun.image.codec.jpeg.JPEGImageEncoder" located? Inside 
> the batik.jar? Or is it a problem of my com.sun.image.codec.jpeg 
> package?
>
>
> batik jar: batik-1.7.jar
> I'am using JDK 1.5 on MacOsX 10.5.6.
> Developing with Eclipse 3.4
>
>
> Thx
>
> Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message