在Websphere中获取HMAC SHA1上的NoClassdef

时间:2012-09-17 17:21:41

标签: java security websphere

我们有WAS 6.0(我知道).2.43 ND在多个地区运行。

我们的Dev-B区域运行良好,但Dev-C在我们进行网络调用时会抛出一个java异常(至少这是开发人员告诉我的)...两个地区的代码相同,我检查了明显的嫌疑人(全局安全,SSL密码等)它们似乎都匹配。这是来自SystemErr的堆栈跟踪:

[8/1/12 4:02:31:758 EDT] 0000005c ServletWrappe E   SRVE0068E: Could not invoke the service() method on servlet action. Exception thrown : java.lang.NoClassDefFoundError
    at javax.crypto.Mac.getInstance(DashoA12275)
    at net.oauth.signature.HMAC_SHA1.computeSignature(HMAC_SHA1.java:73)
    at net.oauth.signature.HMAC_SHA1.getSignature(HMAC_SHA1.java:39)
    at net.oauth.signature.OAuthSignatureMethod.getSignature(OAuthSignatureMethod.java:83)
    at net.oauth.signature.OAuthSignatureMethod.sign(OAuthSignatureMethod.java:54)
    at com.harcourt.hsp.utils.LTIUtil.generateSignature(LTIUtil.java:62)
    at com.harcourt.hsp.web.struts.lti.action.BaseLTIAction.generateSignature(BaseLTIAction.java:238)
    at com.harcourt.hsp.web.struts.lti.action.BaseLTIAction.execute(BaseLTIAction.java:96)
    at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1796)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:887)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1937)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:130)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:434)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:373)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:253)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)

    at javax.crypto.Mac.getInstance(DashoA12275)
    at net.oauth.signature.HMAC_SHA1.computeSignature(HMAC_SHA1.java:73)
    at net.oauth.signature.HMAC_SHA1.getSignature(HMAC_SHA1.java:39)
    at net.oauth.signature.OAuthSignatureMethod.getSignature(OAuthSignatureMethod.java:83)
    at net.oauth.signature.OAuthSignatureMethod.sign(OAuthSignatureMethod.java:54)
    at com.harcourt.hsp.utils.LTIUtil.generateSignature(LTIUtil.java:62)
    at com.harcourt.hsp.web.struts.lti.action.BaseLTIAction.generateSignature(BaseLTIAction.java:238)
    at com.harcourt.hsp.web.struts.lti.action.BaseLTIAction.execute(BaseLTIAction.java:96)
    at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1796)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:887)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1937)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:130)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:434)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:373)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:253)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)

感谢您的帮助。我确定它是我失踪的配置。

1 个答案:

答案 0 :(得分:0)

由于某种原因,无法解析javax.crypto.Mac.getInstance。如果你想在完全彻底的故障排除之前尝试一些低悬的水果:你错过了一个罐子吗?是否需要将类添加到类路径中?

最终,解决问题的最佳方法是逐步分析逻辑。这个3 part article会引导您对java.lang.NoClassDefFoundError进行问题排查。这是一个相对较短的阅读,我怀疑可能会回答你的问题。

为了完整起见,我已经包含了短版(摘自上述文章)

  1. 查看java.lang.NoClassDefFoundError错误并识别 缺少Java类。 (在本例中为javax.crypto.Mac.getInstance)

  2. 从编译/构建中验证并找到缺少的Java类 环境

  3. 确定缺少的Java类是否来自您的应用程序代码, 第三部分API甚至Java EE容器本身。验证在哪里 预计会找到丢失的JAR文件

  4. 找到后,验证您的运行时环境Java类路径 错误或缺少JAR文件

  5. 如果从Java EE应用程序触发问题,请执行 相同的上述步骤,但验证您的EAR / WAR文件的包装 缺少JAR和其他库文件依赖项,例如MANIFEST

  6. 执行受影响类的代码演练并确定是否存在 包含静态初始化代码(变量和静态块)

  7. 检查您的服务器和应用程序日志,并确定是否有任何错误 源自静态初始化代码

  8. 确认后,进一步分析代码并确定根目录 初始化程序代码失败的原因。您可能需要添加一些 额外的日志记录以及适当的错误处理以防止和更好地 处理未来静态初始化程序代码的未来失败