0

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

这是我得到的堆栈跟踪:

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,安装了带有 Java EE 的 JDK 6 Update 26,更改了 Eclipse 和 Tomcat 属性以使用新的 JDK(在 Glassfish 文件夹下),现在它似乎可以正常工作了。我也安装了 Glassfish,不管我是否不需要它,但这不是问题。

4

1 回答 1

0

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

于 2011-08-27T22:34:04.583 回答