Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange start error updating to Mojarra 2.2.6

I've updated Mojarra 2.2.5 to 2.2.6 on a Tomcat 7.0.42 + jdk1.6.0_27 system and, on startup, I experienced the folloging error (... even if the application starts and works correctly) :

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>

Any suggestion ? Thanks.

like image 607
NCister Avatar asked Mar 31 '14 17:03

NCister


1 Answers

The same thing happened to me. Apparently if the view state saving method is configured as "client" the hidden view state is encrypted, and the key used to encrypt it can be supplied (optionally) using the "jsf/ClientSideSecretKey" environment variable. By trial-and-error I've found out that the key has to be Base64 encoded.

After adding this to my web.xml file...

<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>  

the error disappeared.

What I would really want to know is... Where is this feature documented? The only information I could find is here: https://java.net/jira/browse/JAVASERVERFACES-3083

like image 80
sanchon Avatar answered Sep 30 '22 05:09

sanchon