Home » Java » Process 'command 'C:\Program Files\Java\jdk1.8.0_131\bin\java.exe'' finished with non-zero exit value 1

Process 'command 'C:\Program Files\Java\jdk1.8.0_131\bin\java.exe'' finished with non-zero exit value 1

Posted by: admin June 30, 2018 Leave a comment

Questions:

I am trying to use LDAPAuthentication instead of generic inMemoryAuthentication in Spring Security and while doing so as per article https://spring.io/guides/gs/authenticating-ldap/ .
I am encountering the below error , Can you please help me out with this error?

P.S I have already tried Cleaning up Project via Invalidate Caches/Restart in IntelliJ but that didn’t help.

16:04:49.192 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Process
‘command ‘C:\Program Files\Java\jdk1.8.0_131\bin\java.exe” finished
with non-zero exit value 1


Original File

    public static class FormWebSecurityConfig extends WebSecurityConfigurerAdapter{

                @Override
                public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception
                {                    
                    auth.inMemoryAuthentication()
                    .withUser(user)
                    .password(password)
                    .roles("USER);

                }
}

Updated File:

    public static class FormWebSecurityConfig extends WebSecurityConfigurerAdapter{

                @Override
                public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception 
                {
                    auth
                    .ldapAuthentication()
                    .userDnPatterns("uid={0},ou=people")
                    .groupSearchBase("ou=groups")
                    .contextSource()
                    .url("ldap://localhost:8389/dc=springframework,dc=org")
                    .and()
                    .passwordCompare()
                    .passwordEncoder(new LdapShaPasswordEncoder())
                    .passwordAttribute("userPassword");   
                }
}
Answers: