简体   繁体   English

Eclipse声称Commons-Codec方法不存在

[英]Eclipse claims Commons-Codec methods don't exist

I'm working on validating the signed_request parameter from the Facebook API, following these guidelines , but I'm running into issues calling some of the methods of the Base64 class from Commons Codec. 我正在按照这些准则从Facebook API验证sign_request参数,但是我遇到了从Commons Codec调用Base64类的某些方法的问题。 I added the commons-codec 1.6 library to my project ( 我将commons-codec 1.6库添加到了我的项目中( 我引用的库的图片 ), but Eclipse is showing ),但Eclipse显示

带红色下划线的构造函数

and saying

错误消息(未定义构造函数Base64(boolean))

which is odd, since this says otherwise . 这很奇怪,因为是相反的说法

I verified the md5 of the download, so that's not the issue. 我验证了下载的md5,所以这不是问题。

Any bright ideas? 有什么好主意吗?

I suspect that you have another version of commons-codes classes in your classpath, before the commons-codec jar you installed. 我怀疑在安装Commons编解码器jar之前,您的类路径中有Commons-Codes类的另一个版本。

Make sure the "Link with Editor" icon button at the top of the package explorer is pressed, and then ctrl-click on the Base64 type in your editor. 确保按下了程序包浏览器顶部的“与编辑器链接”图标按钮,然后在编辑器中按住Ctrl并单击Base64类型。 Then check if the selected class file in the package editor is the class inside the commons-codec-1.6.jar, or if it's a class in another jar. 然后检查包编辑器中选定的类文件是否是commons-codec-1.6.jar中的类,或者它是否是另一个jar中的类。

I faced the same issue. 我遇到了同样的问题。 It got resolved after I moved the codec jar in the build order. 在按构建顺序移动编解码器jar之后,此问题得到解决。 But I couldn't able to build the GWT project. 但是我无法构建GWT项目。 It shows the following error 它显示以下错误

String key = new String(Base64.decodeBase64("xxxx")); 字符串键=新字符串(Base64.decodeBase64(“ xxxx”));

error: method decodeBase64 in class Base64 cannot be applied to given types; 错误:无法将Base64类中的方法encodeBase64应用于给定类型; "actual argument String cannot be converted to byte[] by method invocation conversion". “不能通过方法调用转换将实际参数String转换为byte []”。

The JRE still reads the codec package from GWT package. JRE仍从GWT包中读取编解码器包。 How to resolve this? 如何解决呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM