Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发送模板消息异常 invalid key or spec in GCM mode] with root cause #14

Open
zhonghuafy opened this issue Jul 4, 2019 · 1 comment

Comments

@zhonghuafy
Copy link

微信服务号发送模板消息失败。异常发生在wxMpTemplateMsgService.sendTemplateMsg(wxMpTemplateMessage); 公众号已经添加了服务器的公网ip到白名单。
异常信息:
2019-07-04 11:53:03.976 ERROR 1 --- [nio-9000-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: invalid key or spec in GCM mode] with root cause

java.security.InvalidAlgorithmParameterException: Cannot reuse iv for GCM encryption
at com.sun.crypto.provider.CipherCore.init(CipherCore.java:583) ~[sunjce_provider.jar:1.8.0_162]
at com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:346) ~[sunjce_provider.jar:1.8.0_162]
at javax.crypto.Cipher.init(Cipher.java:1394) ~[na:1.8.0_162]
at sun.security.ssl.CipherBox.createExplicitNonce(CipherBox.java:1029) ~[na:1.8.0_162]
at sun.security.ssl.OutputRecord.encrypt(OutputRecord.java:248) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:869) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:808) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:727) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.sendAlert(SSLSocketImpl.java:2084) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.warning(SSLSocketImpl.java:1911) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.closeInternal(SSLSocketImpl.java:1674) ~[na:1.8.0_162]
at sun.security.ssl.SSLSocketImpl.close(SSLSocketImpl.java:1612) ~[na:1.8.0_162]
at org.apache.http.impl.BHttpConnectionBase.shutdown(BHttpConnectionBase.java:309) ~[httpcore-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.conn.DefaultManagedHttpClientConnection.shutdown(DefaultManagedHttpClientConnection.java:97) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(LoggingManagedHttpClientConnection.java:89) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.conn.CPoolEntry.shutdownConnection(CPoolEntry.java:74) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.conn.CPoolProxy.shutdown(CPoolProxy.java:96) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.execchain.ConnectionHolder.abortConnection(ConnectionHolder.java:127) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.impl.execchain.ConnectionHolder.cancel(ConnectionHolder.java:144) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.client.methods.AbstractExecutionAwareRequest.reset(AbstractExecutionAwareRequest.java:133) ~[httpclient-4.4.1.jar!/:4.4.1]
at org.apache.http.client.methods.HttpRequestBase.releaseConnection(HttpRequestBase.java:121) ~[httpclient-4.4.1.jar!/:4.4.1]
at me.chanjar.weixin.common.util.http.apache.ApacheSimplePostRequestExecutor.execute(ApacheSimplePostRequestExecutor.java:56) ~[weixin-java-common-3.3.0.jar!/:na]
at me.chanjar.weixin.common.util.http.apache.ApacheSimplePostRequestExecutor.execute(ApacheSimplePostRequestExecutor.java:20) ~[weixin-java-common-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.executeInternal(BaseWxMpServiceImpl.java:323) ~[weixin-java-mp-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.execute(BaseWxMpServiceImpl.java:283) ~[weixin-java-mp-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.executeInternal(BaseWxMpServiceImpl.java:338) ~[weixin-java-mp-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.execute(BaseWxMpServiceImpl.java:283) ~[weixin-java-mp-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.executeInternal(BaseWxMpServiceImpl.java:338) ~[weixin-java-mp-3.3.0.jar!/:na]
at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.execute(BaseWxMpServiceImpl.java:283) ~[weixin-java-mp-3.3.0.jar!/:na]

@binarywang
Copy link
Owner

看起来像是你的运行环境问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants