grails / grails-mail

The Grails Mail Plugin
https://grails.github.io/grails-mail/
Apache License 2.0
14 stars 25 forks source link

org.grails.plugins:mail:3.0.0 failed when adding grails { pathingJar = true } #41

Closed wureka closed 3 years ago

wureka commented 4 years ago

Hi, My system is developed in Grails 4.0.1. Based on the official document from https://docs.grails.org/4.0.1/guide/single.html#aHelloWorldExample, it suggest developers to add grails { pathingJar = true } to build.gradle for avoiding below problem

" java.io.IOException: CreateProcess error=206, The filename or extension is too long"

However, after I add

grails (pathingJar = true}

to my build.gradle, the below error will happen:

Caused by: java.lang.NoClassDefFoundError: grails/plugins/mail/SendMail
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
    at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.findClass(RestartClassLoader.java:159)
    at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:141)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at grails.boot.config.tools.ClassPathScanner.scanUsingPattern(ClassPathScanner.groovy:181)
    at grails.boot.config.tools.ClassPathScanner.scan(ClassPathScanner.groovy:149)
    at grails.boot.config.tools.ClassPathScanner.scan(ClassPathScanner.groovy:107)
    at grails.boot.config.tools.ClassPathScanner.scan(ClassPathScanner.groovy)
    at grails.boot.config.GrailsAutoConfiguration.classes(GrailsAutoConfiguration.groovy:79)
    at grails.boot.config.GrailsAutoConfiguration.grailsApplicationPostProcessor(GrailsAutoConfiguration.groovy:68)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: grails.plugins.mail.SendMail
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:144)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 48 common frames omitted

I had tried org.grails.plugins:mail:3.0.0 and org.grails.plugins:mail:2.00. Same result.

jackweinbender commented 4 years ago

I've got a similar problem.

derKasi commented 4 years ago

Hi Puneet, End of February I was very happy to see that this Issue is in progress. Is there a solution in sight on this issue? I ask because this problem is preventing us from going to Grails 4 and I will soon have to decide to stay on Grails 3.3.11 for this year or upgrade to Grails 4.

puneetbehl commented 4 years ago

I picked it up but got distracted with some other items, I will look into this tomorrow.

derKasi commented 4 years ago

Thank you very much!

puneetbehl commented 4 years ago

@derKasi I looked into this today but I am unable to replicate the problem. I tested on macOS and Windows 10 VirtualBox VM.

Here is the sample application: https://github.com/puneetbehl/mailplugindemo

I am using Grails 4.0.2 and the mail plugin version 3.0.0. Could you please try to run this application using the instructions in the README.

davebrown1975 commented 3 years ago

Updating Grails to 4.0.5 appears to have fixed the issue for me today.