dropbox / zxcvbn

Low-Budget Password Strength Estimation
https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/wheeler
MIT License
14.98k stars 932 forks source link

Facing issue for NoClassDefFoundError #262

Open PriyankaNaikwade opened 5 years ago

PriyankaNaikwade commented 5 years ago

Hi Team,

we have added maven dependency & version is 1.2.6. & we are just using following code snippet when we try to measure strength of password we are getting error. we are using java 1.6. so is it issue?

Code snippet: Zxcvbn zxcvbn = new Zxcvbn(); Strength localizStrength = zxcvbn.measure(password); int zxcvbnScore = localizStrength.getScore(); logger.info("Score Of Password:"+ zxcvbnScore); switch ( zxcvbnScore ) { case 4: logger.info("Password Strength is Very Strong"); break; case 3: logger.info("Password Strength is Strong"); break; case 2: logger.info("Password Strength is Good"); break; case 1: logger.error("Password Strength is Weak"); Feedback feedback = localizStrength.getFeedback(); List localizedSuggestions = feedback.getSuggestions(); String localizedWarning = feedback.getWarning(); System.out.println("localizedSuggestions:="+ localizedSuggestions); System.out.println("LocalizedWarnings:="+localizedWarning); result.add(rule); break; default: logger.error("Password Strength is very Weak"); Feedback feedback1 = localizStrength.getFeedback(); List localizedSuggestions1 = feedback1.getSuggestions(); String localizedWarning1 = feedback1.getWarning(); System.out.println("localizedSuggestions:="+ localizedSuggestions1); System.out.println("LocalizedWarnings:="+localizedWarning1); result.add(rule); break;

Error Trace:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.nulabinc.zxcvbn.Matching   at com.nulabinc.zxcvbn.Zxcvbn.createMatching(Zxcvbn.java:45)   at com.nulabinc.zxcvbn.Zxcvbn.measure(Zxcvbn.java:32)   at com.nulabinc.zxcvbn.Zxcvbn.measure(Zxcvbn.java:15)   at com.riskmetrics.wb.service.impl.PasswordServiceImpl.validate(PasswordServiceImpl.java:123)   at com.riskmetrics.apollo.spring.controller.PasswordController.validatePassword(PasswordController.java:412)   at com.riskmetrics.apollo.spring.controller.PasswordController.validate(PasswordController.java:71)   at sun.reflect.GeneratedMethodAccessor652.invoke(Unknown Source)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   at java.lang.reflect.Method.invoke(Method.java:497)   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)   ... 79 more

mkopinsky commented 5 years ago

This repository is for the original Javascript library. You probably want https://github.com/nulab/zxcvbn4j which is the Java port you imported via Maven.

PriyankaNaikwade commented 5 years ago

we already added maven dependency in our project but still we are facing issue in environment. and we are using java 1.6.

com.nulab-inc zxcvbn 1.2.6
mkopinsky commented 5 years ago

You're not understanding. Java and Javascript are not the same language. We have absolutely nothing to do with the Maven package. Go to the link I posted above and open an issue there instead.

vvatanabe commented 5 years ago

@PriyankaNaikwade We already released version 1.2.7 that fixed the problem. https://github.com/nulab/zxcvbn4j/releases/tag/1.2.7