Reputation: 622
Ok so ive just finished my first JSF project and i want to upload it to GAE. I have been trying for about the last 4 hours and cannot make it work.
I am using JSF 2.0 and App Engine 1.6.5.
I have tried several tutorials and all combinations of the following:
Jars - javax.faces-2.1.7-sources.jar el-ri-1.0.jar
Setup - GAE 1.6.5, JDK 1.7
Error:
java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
I thought this was because I was using different configuration so i changed to use the exact set up. Downgraded to GAE 1.6.3.1 and used the exact jars in the tutorial but it was no different.
So i tried the second tutorial which stated fix listed which involves replacing the jsf-impl.jar with jsf-impl-gae.jar but this has not helped.
After i do this I get the error:
WARNING: failed com.google.appengine.tools.development.DevAppEngineWebAppContext@1678d71{/,C:\Users\TOSHIBA\Documents\NetBeansProjects\Google AppEngine JSF 2.0 Template\war}: java.lang.VerifyError: Expecting a stackmap frame at branch target 36 in method com.sun.faces.config.WebConfiguration.getServletContextName()Ljava/lang/String; at offset 10
May 07, 2012 5:07:17 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed JettyContainerService$ApiProxyHandler@1547ec9: java.lang.VerifyError: Expecting a stackmap frame at branch target 36 in method com.sun.faces.config.WebConfiguration.getServletContextName()Ljava/lang/String; at offset 10
May 07, 2012 5:07:17 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Error starting handlers
java.lang.VerifyError: Expecting a stackmap frame at branch target 36 in method com.sun.faces.config.WebConfiguration.getServletContextName()Ljava/lang/String; at offset 10
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:163)
I have also tried the guide listed here
I have tried every conceivable combination of tutorials here on two different app engine SDKs and two JDKs with the 7 jar i now have: el-api-2.2.1-b04.jar, el-impl-2.2.1-b05.jar, el-ri-1.0.jar, javax.faces-2.1.7.jar, javax.faces-2.1.7-sources.jar, jsf-api-2.1.7.jar, jsf-impl-gae.jar.
Any help would be greatly appreciated I think i will look for a different way to upload my project tomorrow as I have had nothing but trouble with JSF and Eclipse thus why I always use Netbeans however the GAE plugin for Netbeans is no longer functioning.
Thank you
Upvotes: 3
Views: 2925
Reputation: 34038
From the tutorial:
3.3 Create a new WebConfiguration.java.
JSF 2 is using “javax.naming.InitialContext” that’s not support in GAE.
To solve this, you need to get a copy of the JSF’s source code, clone the WebConfiguration.java, comment methods that are using “javax.naming.InitialContext” class, put it in “src/com/sun/faces/comfig/WebConfiguration.java“. Now, your newly created WebConfiguration.java class will overload the original WebConfiguration.java.
According to the tutorial, the class that is throwing your ClassDefNotFoundError is a retricted class. You'll need to visit GAE-JSF javax.naming.InitialContext is a Restricted Class Source Code and retrieve a copy of the JSF source code and make a copy of the WebConfiguration Class and overload the original.
GAE's Whitelisting can be overrided by renaming packages or, in this case, avoiding them altogether. To clarify, what this step is asking you to do is replace WebConfiguration.java with one you modify where all methods using InitialContext are commented out. This hides that class from Google's whitelist so it doesn't force ClassNotFoundDefErrors.
Upvotes: 4