java - Tomcat 7 + MyFaces 2.1 : java. security.NoSuchAlgorithmException

标签 java tomcat myfaces

我正在使用 Tomcat 7 和 MyFaces 2.1 设置一个简单的应用程序。 我创建应用程序,创建一个简单的 index.xhtml,部署它,当我在浏览器上访问它时出现异常。 我看到一个post其中给出了解决方案,但它对我不起作用,因为我已经有了答案中建议的设置。

这是我得到的堆栈跟踪:

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

非常感谢您的帮助。

解决方案:

我得到了解决方案: 我卸载了 Java SE 6 Update 26,安装了 JDK 6 Update 26 with Java EE,更改了 Eclipse 和 Tomcat 属性使用新的 JDK(在 Glassfish 文件夹下),现在它似乎可以正常工作。 我也安装了 Glassfish,我是否不需要它,但这不是问题。

最佳答案

我不能直接提供帮助(从来没有遇到过问题)。我会使用 Archetype 来生成设置,或者我会写一封邮件到邮件列表。

关于java - Tomcat 7 + MyFaces 2.1 : java. security.NoSuchAlgorithmException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6743853/

相关文章:

java - Http 请求无响应 : Apache Tomcat

css - 覆盖现有的 CSS 文件

java - 故障转移时的 ActiveMQ MessageConsumer 行为

java - 让 J2ME Midlet 在没有线程的情况下 hibernate ?

java - 将非英文字符的数据传递给网络服务器

java - WAR 不会部署在不同的机器上

tomcat - 托管另一个 ROOT.war Tomcat 应用程序

javascript - RichFaces extendedDataTable 滚动条在调整屏幕大小后才会显示

javascript - f :ajax is present on a page 时不包含 oamSubmit.js

java - javax.annotation 在哪里