一般是什么引起的呢,为何在jre1.6中访问就不行,但是jre1.42、jre1.5下面就是正常的,是用jgraph开发的网络拓扑图查看Exception in thread "AWT-EventQueue-4" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at sun.awt.Win32GraphicsConfig.createAcceleratedImage(Unknown Source)
at sun.awt.windows.WComponentPeer.createImage(Unknown Source)
at java.awt.Component.createImage(Unknown Source)
at com.micromuse.wave.applets.maplet.Maplet.paint(Maplet.java:845)
at com.micromuse.wave.applets.maplet.Maplet.update(Maplet.java:901)
at sun.awt.RepaintArea.updateComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

解决方案 »

  1.   

    参数值不在取值范围内,width和height不能小于等于0
      

  2.   

    public class IllegalArgumentException extends RuntimeException抛出的异常表明向方法传递了一个不合法或不正确的参数。 所以很显然,你的Width (0) 和 height (0)是不合法的,参数必须>0。
      

  3.   

    是啊,怎么解决呢
     int w = img.getWidth(this) == 0 ? 500 : img.getWidth(this);
            int h = img.getHeight(this) == 0 ? 300 : img.getHeight(this);
            BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    有人是这么解决的。
      

  4.   

    同样的错误,但是我的原因是在struts.xml中使用了el表达式引起的