coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.08k stars 780 forks source link

ERROR in groovy script #176

Closed yf718 closed 2 years ago

yf718 commented 2 years ago

Expected behavior

Please describe what you are expecting the library to perform.

groovy version: 2.4.15, here is code:

def String compressPicAndToBase64(String url) throws IOException { ByteArrayOutputStream os = null; try{ os = new ByteArrayOutputStream(); Thumbnails.of(new URL(url)).scale(1f).outputQuality(0.1).toOutputStream(os); return Base64.getEncoder().encodeToString(os.toByteArray()); }finally { if(os != null) { os.close(); } }

} def url = "https://seopic.699pic.com/photo/50070/6405.jpg_wh1200.jpg" println compressPicAndToBase64(url)

Actual behavior

Please describe the actual behavior you are experiencing, including stack trace and other information which would help diagnose the issue.

Caught: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.w3c.dom.Node.getChildNodes()Lorg/w3c/dom/NodeList;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, net/coobird/thumbnailator/util/exif/ExifUtils, and the class loader (instance of ) for the method's defining class, org/w3c/dom/Node, have different Class objects for the type org/w3c/dom/NodeList used in the signature java.lang.LinkageError: loader constraint violation: when resolving interface method "org.w3c.dom.Node.getChildNodes()Lorg/w3c/dom/NodeList;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, net/coobird/thumbnailator/util/exif/ExifUtils, and the class loader (instance of ) for the method's defining class, org/w3c/dom/Node, have different Class objects for the type org/w3c/dom/NodeList used in the signature

Steps to reproduce the behavior

Please enter step-by-step instructions for reproducing the actual behavior. Including code can be helpful in diagnosing issue, but please keep the code to a minimal that will reproduce the behavior.

Environment

Please provide vendor and version information for the Operating System, JDK, and Thumbnailator. Please feel free to add any other information which may be pertinent.