Tomcat 7 + MyFaces 2.1 : java.security.NoSuchAlgorithmException
I'm setting up a simple application using Tomcat 7 and MyFaces 2.1. I create the app, create a simple index.xhtml, deploy it and when I visit it on the browser I get the exception. I saw a post in which a solution was given, but it didn't work for me because I already have the settings suggested in the answer.
This is the stack trace i get:
19-lug-2011 9.38.45 org.apache.catalina.core.ApplicationDispatcher invoke
GRAVE: Servlet.service() for servlet Faces Servlet threw exception
java.security.NoSuchAlgorithmException: Algorithm HmacSHA1 not available
at javax.crypto.Mac.getInstance(DashoA13*..)
at org.apache.myfaces.shared_impl.util.StateUtils.encrypt(StateUtils.java:306)
at org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.java:239)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeViewStateField(HtmlResponseStateManager.java:138)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(HtmlResponseStateManager.java:116)
at org.apache.myfaces.application.StateManagerImpl.writeState(StateManagerImpl.java:308)
at org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.flushBufferToWriter(JspViewDeclarationLanguageBase.java:285)
at org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.renderView(JspViewDeclarationLanguageBase.java:210)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:745)
at org.apache.jasp开发者_如何学Pythoner.runtime.PageContextImpl.forward(PageContextImpl.java:716)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:140)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
19-lug-2011 9.38.45 org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [jsp] in context with path [/mcconsole] threw exception [An exception occurred processing JSP page /index.jsp at line 7
4: <html>
5: <head> </head>
6: <body>
7: <jsp:forward page="/testIndex.jsf" />
8: </body>
9: </html>
Thank you very much for any kind of help.
SOLUTION:
I got to the solution: I uninstalled Java SE 6 Update 26, installed JDK 6 Update 26 with Java EE, changed Eclipse and Tomcat properties to use new JDK (under Glassfish folder) and now it seems to be correctly working. I got Glassfish installed, too, whether I don't need it, but it's not a problem.
I can't help directly (never had problems with it). I would use the Archetype for generating the setup or I would write a mail to the mailing list.
精彩评论