logicsquad / nanocaptcha

A Java library for generating image and audio CAPTCHAs.
Other
43 stars 7 forks source link

error while using with docker #26

Open torajx opened 2 days ago

torajx commented 2 days ago

Our app works fines when runs with java -jar.When we run our app inside docker container it shows this error. we try many thins such as mapping fonts path when runnning docker. but no success. we also install font packages when building docker and again no success.

:ErrorController: Exception occurred while handling internal server exception java.lang.NullPointerException: Cannot invoke "java.awt.Font.createGlyphVector(java.awt.font.FontRenderContext, char[])" because "font" is null at net.logicsquad.nanocaptcha.image.renderer.DefaultWordRenderer.render(DefaultWordRenderer.java:54) at net.logicsquad.nanocaptcha.image.ImageCaptcha$Builder.addContent(ImageCaptcha.java:208) at com.adp.iau.auth.util.CaptchaGeneratorImpl.generateCaptcha(CaptchaGeneratorImpl.java:31) at com.adp.iau.auth.service.CaptchaServiceImpl.generateCaptchaImage(CaptchaServiceImpl.java:47) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281) at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:482) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768) at org.springframework.aop.framework.Cgli

paulhoadley commented 2 days ago

Unfortunately, I don't use Spring or Docker. I'm not going to be able to reproduce this. Since 1.5, NanoCaptcha has shipped with its own built-in fonts—are you using these, or trying to load other fonts?