[jboss-user] [Javassist] - Problem with GluonJ and javassist.gluonj.util.Loader
Dmitriy Zavodnikov
do-not-reply at jboss.com
Sat Apr 21 07:13:46 EDT 2012
Dmitriy Zavodnikov [https://community.jboss.org/people/dzavodnikov] created the discussion
"Problem with GluonJ and javassist.gluonj.util.Loader"
To view the discussion, visit: https://community.jboss.org/message/731467#731467
--------------------------------------------------------------
I have a problem with part of *GluonJ* library: javassist.gluonj.util.Loader
I have this code:
Loader loader = new Loader(Class.class.getClassLoader(), new String[0]);
Class<?> sanselan1 = loader.loadClass("org.apache.sanselan.Sanselan");
// Read image.
Method getBI = sanselan1.getMethod("getBufferedImage", new Class[]{ File.class } );
BufferedImage image = (BufferedImage) getBI.invoke(null, new Object[]{ imageIn });
And this code +work correctly+!
But this code don't works:
Method setBI = *sanselan1*.getMethod(
"writeImage",
new Class[]{ BufferedImage.class, File.class, ImageFormat.class, Map.class }
);
setBI.invoke(null, new Object[]{ image, imageOut, ImageFormat.IMAGE_FORMAT_PNG, null });
I get an error:
java.lang.NoSuchMethodException: org.apache.sanselan.Sanselan.writeImage(java.awt.image.BufferedImage, java.io.File, org.apache.sanselan.ImageFormat, java.util.Map)
But if I using standart class loader:
Class<?> *sanselan2* = Class.forName("org.apache.sanselan.Sanselan");
//...
Method setBI = *sanselan2*.getMethod(
"writeImage",
new Class[]{ BufferedImage.class, File.class, ImageFormat.class, Map.class }
);
setBI.invoke(null, new Object[]{ image, imageOut, ImageFormat.IMAGE_FORMAT_PNG, null });
Everithing works fine! It meanse, that org.apache.sanselan.Sanselan have method writeImage and I correctly called it.
But if I using javassist.gluonj.util.Loader I have an exception: NoSuchMethodException.
What is a problem?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731467#731467]
Start a new discussion in Javassist at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120421/e08a77fa/attachment.html
More information about the jboss-user
mailing list