1

I am seeing the following error while trying to load an svg document in to JSVG panel.

Exception occurred in target VM: (class: org/apache/batik/bridge/BridgeContext, method: dispose signature: ()V) Incompatible object argument for function call 
java.lang.VerifyError: (class: org/apache/batik/bridge/BridgeContext, method: dispose signature: ()V) Incompatible object argument for function call
    at org.apache.batik.swing.svg.JSVGComponent.createBridgeContext(Unknown Source)
    at org.apache.batik.swing.svg.JSVGComponent.installSVGDocument(Unknown Source)
    at org.apache.batik.swing.JSVGCanvas.installSVGDocument(Unknown Source)
    at org.apache.batik.swing.svg.JSVGComponent$2.run(Unknown Source)
    at org.apache.batik.swing.svg.JSVGComponent.stopThenRun(Unknown Source)
    at org.apache.batik.swing.svg.JSVGComponent.setSVGDocument(Unknown Source)
    at org.netbeans.modules.plantumlnb.SVGImagePreviewPanel.renderSVGFile(SVGImagePreviewPanel.java:48)
    at org.netbeans.modules.plantumlnb.RenderImageThread$1.run(RenderImageThread.java:56)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Here is the relevant code.

canvas.setSVGDocument(createSVGDocument(new StringReader(imageContent)));

I am not sure what I am doing wrong here. Any help is appreciated.

ShaggyInjun
  • 2,880
  • 2
  • 31
  • 52
  • Judging from that stack trace, we don't actually need to see `createSVGDocument()`. `setSVGDocument()` is more likely to be relevant. (it looks like `setSVGDocument` is calling `stopThenRun`, which is calling `run`, etc) – Dennis Meng Aug 23 '13 at 01:13
  • Thanks for the reply. But is your suggestion to edit and remove that call from the SO post ? – ShaggyInjun Aug 23 '13 at 01:18
  • Yeah, replace it with `setSVGDocument`'s code. Looking at the stack trace, it looks like you're definitely making it to that function (so it's probably not `createSVGDocument`). – Dennis Meng Aug 23 '13 at 01:24
  • (Start from the 6th indented line and read up to see what I mean) – Dennis Meng Aug 23 '13 at 01:25
  • See this question about Verify error. http://stackoverflow.com/questions/100107/reasons-of-getting-a-java-lang-verifyerror I would see what the last method in the stack trace is doing (JSVGComponent.createBridgeContext), see what library it calls. The make sure you are compiling and running against the same version of that library/jar. – Keith Aug 26 '13 at 03:53
  • Which version of batik are you using, and is it the same in your runtime environment as your build/compile environment? The method in question seems to call nothing but other batik classes (at least for batik trunk). – Keith Aug 26 '13 at 04:02
  • I am using 1.6-1 through maven repos. I think my build/compile jars are being packaged by maven unless I am missing something. I have to check that this is the case. On the other hand the Application for which I am developing a plugin could have a different version of Batik included, I wil have to check this too, but I have no clue how I will do this at runtime. – ShaggyInjun Aug 26 '13 at 21:09

1 Answers1

3

I think the incompatibility lies not between your application and batik but between batik and one of its required libraries which is either not present or exists in a different version. Typical candidates are the xml utility libraries which might come into your environment together with other software using it, e.g. xml-apis.jar. Another possibility to get into trouble is to use a Java version which is too old as the included DOM API classes change from version to version.

Holger
  • 285,553
  • 42
  • 434
  • 765
  • Your answer lead me to what I was looking. Seems like Netbeans ships its own version of `xerces` and this was conflicting with what I had included. Thanks for the help. – ShaggyInjun Sep 02 '13 at 23:22