奇怪的启动错误更新到Mojarra 2.2.6

时间:2014-03-31 17:29:33

标签: jsf-2 tomcat7 mojarra

我已经在Tomcat 7.0.42 + jdk1.6.0_27系统上将Mojarra 2.2.5更新为2.2.6,并且在启动时,我遇到了folloging错误(...即使应用程序启动并正常工作) :

SEVERE: Unable to find the encoded key.
javax.naming.NameNotFoundException: Name [jsf/ClientSideSecretKey] is not bound in this Context. Unable to find [jsf].
    at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at com.sun.faces.renderkit.ByteArrayGuard.setupKeyAndMac(ByteArrayGuard.java:214)
    at com.sun.faces.renderkit.ByteArrayGuard.<init>(ByteArrayGuard.java:89)
    at com.sun.faces.renderkit.ClientSideStateHelper.init(ClientSideStateHelper.java:476)
    at com.sun.faces.renderkit.ClientSideStateHelper.<init>(ClientSideStateHelper.java:150)
    at com.sun.faces.renderkit.ResponseStateManagerImpl.<init>(ResponseStateManagerImpl.java:68)
    at com.sun.faces.renderkit.RenderKitImpl.<init>(RenderKitImpl.java:121)
    at com.sun.faces.renderkit.RenderKitFactoryImpl.<init>(RenderKitFactoryImpl.java:79)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:721)
    at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:553)
    at javax.faces.FactoryFinder.access$500(FactoryFinder.java:140)
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1120)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4937)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
SecretKey: 31chBtWqlcPEsnTy/BVEOA==Mar 31, 2014 7:20:48 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>

有什么建议吗? 感谢。

1 个答案:

答案 0 :(得分:21)

同样的事发生在我身上。显然,如果视图状态保存方法被配置为“客户端”,则隐藏视图状态被加密,并且可以使用“jsf / ClientSideSecretKey”环境变量(可选地)提供用于加密它的密钥。通过反复试验,我发现密钥必须是Base64编码的。

将此添加到我的web.xml文件后......

<env-entry>
   <env-entry-name>jsf/ClientSideSecretKey</env-entry-name>
   <env-entry-type>java.lang.String</env-entry-type>
   <env-entry-value>am9kZXRlcHV0b2hhY2tlcg==</env-entry-value>
</env-entry>  

错误消失了。

真正想知道的是......这个功能记录在哪里?我能找到的唯一信息是:https://java.net/jira/browse/JAVASERVERFACES-3083