Java getEncoded()NoSuchMethodError

Java getEncoded()NoSuchMethodError,java,coldfusion,public-key-encryption,Java,Coldfusion,Public Key Encryption,我正在使用这个web推送java库: Gradle构建任务,编译为在Coldfusion中使用的jar文件 jar { baseName = 'web-push' version = '3.0.0' doFirst { from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } } exclude 'META-INF/*.RSA',

我正在使用这个web推送java库:

Gradle构建任务,编译为在Coldfusion中使用的jar文件

jar {
  baseName = 'web-push'
  version = '3.0.0'
  doFirst {
      from {
          configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
      }
  }
  exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' 
}
因此,我有一个包含所有依赖项的正常运行的jar文件。然而,当我去发送通知时,我得到了这个错误

java.lang.NoSuchMethodError:org.bouncycastle.math.ec.ECPoint.getEncoded(Z)[B

它指向
Utils.java

public static byte[] savePublicKey(ECPublicKey publicKey) {
    return publicKey.getQ().getEncoded(false);
}
据我所知,
getEncoded
是一个build int java Key方法。因此我不确定是否因为
publicKey.getQ
不是有效的键,或者因为我需要导入/包含一个java Key类而出现此错误

提前感谢您提供的任何提示/帮助

CFML代码

<cfscript>

variables.server.pubKey = 'XXXXXXXXXXX';
variables.server.priKey = 'XXXXXX';

variables.subscription = {
      "endpoint": "https://fcm.googleapis.com/fcm/send/eEmctHWg8-k:APA91bF-kzQfUv1Y1T9C3sJ3eN5zDDtyRhcDU0MyVS1XWgPIko2X7VpjeymhqDAzb-4nbg4x2SmObHk1JSITG4lmsx-40E_uNi4a_TnFavs4ICMzbeHQJzKgnuTAcQxSXDxJSBNFrzY_"
    , "keys": {
          "p256dh": "BMIWtizmL6BgkofOn6DmPq/AaDwBvh894GBHvPpH2xgg9/uNoNsvKWAfEXVxLgpaUeytb8tGryguvIAmYTDO0W8="
        , "auth": "zDH8z4GPHvW2zFXG0bf2pQ=="
    } 
}
variables.json = serializeJSON(variables.subscription);

variables.java.gson = createObject('java', 'com.google.gson.Gson', expandPath('/fw/jar/gson-2.8.0.jar'));

variables.lib               = expandPath('/fw/jar/web-push-3.0.0.jar');
variables.java.subscription = createObject('java', 'nl.martijndwars.webpush.Subscription', variables.lib);
variables.java.notification = createObject('java', 'nl.martijndwars.webpush.Notification', variables.lib);
variables.java.pushservice  = createObject('java', 'nl.martijndwars.webpush.PushService', variables.lib);

variables.java.subscription = variables.java.gson.fromJson(variables.json, variables.java.subscription.class);

variables.java.notification.init(variables.java.subscription, 'Hello, World!');

variables.java.pushservice.init(variables.server.pubKey, variables.server.priKey, "mailto:craig@thinkerventures.com");

variables.resonse = variables.java.pushservice.send(variables.java.notification);

</cfscript>

完整堆栈跟踪消息是什么,特别是“由…”部分(如果有)?另外,如何通过
加载jar。javaSettings
?可能是由一个依赖项和内置库(bouncy castle就是其中之一)之间的版本冲突引起的。添加了堆栈跟踪,但不确定这是否会有帮助,因为coldfusion正在调用jar。是的,存在
getEncoded
方法。但它不接受任何参数。我从
getEncoded
调用中删除了false参数,并重新生成jar,现在它通过了该函数。只会在更深层的问题上出错行…认为库可能正在使用不同版本的bouncyhouse?(编辑)这证实了Lucee与它自己的Bouncy Castle版本捆绑在一起。是的,从错误看来,可能是加载了该版本,而不是库所需的较新版本。变量.lib路径是否包括BC jar?我不知怎的找到了它。感谢您的回复。我的解决方案是,我使用了来自的另一个依赖项在bouncycastle中,他们有不同的groupId bouncycastle和org.bouncycastle,但使用相同的artifactId。这花了我的时间来确定。
Full Trace: org.bouncycastle.math.ec.ECPoint.getEncoded(Z)[B 
at nl.martijndwars.webpush.Utils.savePublicKey(Utils.java:36):36 
at nl.martijndwars.webpush.HttpEce.lengthPrefix(HttpEce.java:124):124 
at nl.martijndwars.webpush.HttpEce.deriveDH(HttpEce.java:115):115 
at nl.martijndwars.webpush.HttpEce.deriveKey(HttpEce.java:55):55 
at nl.martijndwars.webpush.HttpEce.encrypt(HttpEce.java:172):172 
at nl.martijndwars.webpush.PushService.encrypt(PushService.java:92):92 
at nl.martijndwars.webpush.PushService.sendAsync(PushService.java:128):128 
at nl.martijndwars.webpush.PushService.send(PushService.java:113):113 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):-2 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62):62 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43):43 
at java.lang.reflect.Method.invoke(Method.java:497):497 
at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:55):55 
at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:857):857 
at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:842):842 
at lucee.runtime.java.JavaObject.call(JavaObject.java:228):228 
at lucee.runtime.java.JavaObject.call(JavaObject.java:259):259 
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743 
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1593):1593 
at script.dev.push_cfm$cf.call(D:\nonprofitthrive_com\script\dev\push.cfm:38):38 
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:954):954 
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:858):858 
at fw.application_fw_cfc$cf.udfCall1(D:\nonprofitthrive_com\fw\application_fw.cfc:279):279 
at fw.application_fw_cfc$cf.udfCall(D:\nonprofitthrive_com\fw\application_fw.cfc):-1 
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111 
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328 
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229 
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:642):642 
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524 
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1761):1761 
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:414):414 
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:223):223 
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:37):37 
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2265):2265 
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2228):2228 
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456 
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:47):47 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729):729 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291):291 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239):239 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217):217 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106):106 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502):502 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142):142 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79):79 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88):88 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518):518 
at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:844):844 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673):673 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500):1500 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456):1456 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142):1142 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617):617 
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61):61 
at java.lang.Thread.run(Thread.java:745):745