升级IDEA后,启动项目时出现问题。当前错误如下:
CONFIGURE SUCCESSFUL in 2s
|Running application...
> Task :compileJava NO-SOURCE
startup failed:
General error during semantic analysis: java.lang.NoClassDefFoundError: org.springframework.security.authentication.encoding.PasswordEncoder
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org.springframework.security.authentication.encoding.PasswordEncoder
at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1118)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1098)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:645)
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileGroovy'.
> Task :compileGroovy FAILED
Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
[如果我尝试清理并运行应用程序,则会得到以下信息:|正在运行应用程序... 0%等待中
IDLE 启动失败: 语义分析期间的一般错误:java.lang.NoClassDefFoundError:org.springframework.security.authentication.encoding.PasswordEncoder
FAILURE:构建因异常而失败。
编译失败;有关详细信息,请参见编译器错误输出。
尝试了我所知道的一切,项目设置,清理缓存,使缓存无效并重新启动...没有任何帮助。
我找到了一个解决方案:grails.plugin.springsecurity.authentication.encoding.BCryptPasswordEncoder-使用不推荐使用的类
class CryptoEncoderWrapper implements org.springframework.security.authentication.encoding.PasswordEncoder
您需要将build.gradle更改为:
compile 'org.grails.plugins:spring-security-core:4.0.0'
BCrypt现在具有此导入
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
现在,此问题已解决,但会导致其他问题。