2015-11-10 47 views
1

我在尝试在keycloak领域注册新用户时发生错误。我在Mac Yosemite上以独立模式运行keycloak。我是keycloak的新手,但已成功创建了一个新领域并将其配置为与本地托管的Apache Web服务器提供的html/js示例页面一起工作。总之,印象非常深刻;但只想弄清楚我在做这个register.ftl错误。Keycloak注册模板加载错误

感谢任何指针。

这里的错误:

22:25:43,034 ERROR [freemarker.runtime] (default task-115) Error executing FreeMarker template: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: 
==> passwordRequired [in template "register.ftl" at line 46, column 18] 

Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? 

FTL stack trace ("~" means nesting-related): 
    - Failed at: #if passwordRequired [in template "register.ftl" at line 46, column 13] 
    ~ Reached through: #nested "form" [in template "template.ftl" in macro "registrationLayout" at line 72, column 29] 
    ~ Reached through: @layout.registrationLayout; section [in template "register.ftl" at line 2, column 1] 
---- 
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131) 
at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:77) 
    at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:40) 
    at freemarker.core.NonBooleanException.<init>(NonBooleanException.java:44) 
    at freemarker.core.Expression.modelToBoolean(Expression.java:142) 
    at freemarker.core.Expression.evalToBoolean(Expression.java:125) 
    at freemarker.core.Expression.evalToBoolean(Expression.java:110) 
    at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:46) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.MixedContent.accept(MixedContent.java:54) 
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:345) 
    at freemarker.core.IfBlock.accept(IfBlock.java:48) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.Environment.invokeNestedContent(Environment.java:546) 
    at freemarker.core.BodyInstruction.accept(BodyInstruction.java:56) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.MixedContent.accept(MixedContent.java:54) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.Macro$Context.runMacro(Macro.java:184) 
    at freemarker.core.Environment.invoke(Environment.java:701) 
    at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.MixedContent.accept(MixedContent.java:54) 
    at freemarker.core.Environment.visit(Environment.java:324) 
    at freemarker.core.Environment.process(Environment.java:302) 
    at freemarker.template.Template.process(Template.java:325) 
    at <you get the idea...> 
+0

你能后的模板?好像第46行的密码是必需的,但没有设置。 –

回答

0

在我的经验,这主要是由于在形式设置没有默认/后备值为空属性。您可以确保该属性不能在你的服务被设置为空或提供一个默认值:

myOptionalVar!myDefault 

或:

<#if myOptionalVar??> 
    when-present 
<#else> 
    when-missing 
</#if>