安装GWT 2.6的问题

我刚刚安装了GWT 2.6,现在收到错误“描述资源路径位置类型文件war \ WEB-INF \ lib \ gwt-servlet.jar与GWT SDK库gwt-servlet.jar的大小不同;也许是一个不同的版本?gwt-servlet.jar / AwardTracker / war / WEB-INF / lib未知的Google Web Toolkit问题“

我下载了GWT 2.6 zip,然后将目录“GWT-2.6.0”复制到“Eclipse \ eclipse-jee-juno-SR1-win32 \ eclipse \ plugins”中。 然后我右键单击该项目并选择“properties / Google / Web Toolkit / Configure SDKs … / Add”。 然后我浏览了“GWT-2.6.0”目录,添加并选中它。


我按照Braj的解决方案,并在重新编译时收到以下错误:

编译模块org.AwardTracker.AwardTrackervalidation单元:在第一次传递中忽略了2个包含编译错误的单元。 使用-strict或-logLevel进行编译设置为TRACE或DEBUG以查看所有错误。 计算’gwtupload.client.DecoratedFileUpload.DecoratedFileUploadImpl’的所有可能重新绑定结果重新绑定gwtupload.client.DecoratedFileUpload.DecoratedFileUploadImpl无法找到完全匹配规则。 使用基于后退值的“最接近”规则。 您可能需要实现特定绑定,以防后退行为不替换’gwtupload / client / DecoratedFileUpload.java’中缺少的绑定[错误]错误[ERROR]第347行:重新绑定结果’gwtupload.client.DecoratedFileUpload.DecoratedFileUploadImpl ‘不能抽象

通过下载gwtupload-1.0.1.jar,使用“Add External JARS”将其添加到库并删除旧的gwtupload-0.6.6.jar来解决上述问题。 然后我重新编译并编译工作。 但是,现在我的“MyCustomisedUploadServlet”出现了错误(之前没有出现此错误):

protected static final String XML_ERROR_ITEM_NOT_FOUND = "item not found"; 

其余代码是:

 package org.AwardTracker.server; import gwtupload.server.UploadAction; import gwtupload.server.exceptions.UploadActionException; import gwtupload.shared.UConsts; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Hashtable; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; /** * This is an example of how to use UploadAction class. * * This servlet saves all received files in a temporary folder, * and deletes them when the user sends a remove request. * * @author Manolo Carrasco Moñino * */ public class MyCustomisedUploadServlet extends UploadAction { private static final long serialVersionUID = 1L; protected static final String XML_ERROR_ITEM_NOT_FOUND = "item not found"; Hashtable receivedContentTypes = new Hashtable(); /** * Maintain a list with received files and their content types. */ Hashtable receivedFiles = new Hashtable(); /** * Override executeAction to save the received files in a custom place * and delete this items from session. */ @Override public String executeAction(HttpServletRequest request, List sessionFiles) throws UploadActionException { String response = ""; @SuppressWarnings("unused") int cont = 0; for (FileItem item : sessionFiles) { if (false == item.isFormField()) { cont ++; try { /// Create a temporary file placed in the default system temp folder File file = File.createTempFile("upload-", ".bin"); item.write(file); /// Save a list with the received files receivedFiles.put(item.getFieldName(), file); receivedContentTypes.put(item.getFieldName(), item.getContentType()); /// Send a customised message to the client. response += file.getAbsolutePath(); } catch (Exception e) { throw new UploadActionException(e); } } } /// Remove files from session because we have a copy of them removeSessionFileItems(request); /// Send your customised message to the client. return response; } /** * Get the content of an uploaded file. */ @Override public void getUploadedFile(HttpServletRequest request, HttpServletResponse response) throws IOException { String fieldName = request.getParameter(UConsts.PARAM_SHOW); File f = receivedFiles.get(fieldName); if (f != null) { response.setContentType(receivedContentTypes.get(fieldName)); FileInputStream is = new FileInputStream(f); copyFromInputStreamToOutputStream(is, response.getOutputStream()); } else { renderXmlResponse(request, response, XML_ERROR_ITEM_NOT_FOUND); } } /** * Remove a file when the user sends a delete request. */ @Override public void removeItem(HttpServletRequest request, String fieldName) throws UploadActionException { File file = receivedFiles.get(fieldName); receivedFiles.remove(fieldName); receivedContentTypes.remove(fieldName); if (file != null) { file.delete(); } } } 

我只是评论了这一行(“protected static final String XML_ERROR_ITEM_NOT_FOUND =” item not found“;”),重新编译并运行它,它工作正常。 我希望这一切都有助于他人。 感谢Braj的帮助。

每当您更改GWT版本时,您必须从之前GWT版本自动生成的存根中清除项目,如下面的屏幕截图所示。

问题:文件war\WEB-INF\lib\gwt-servlet.jar的大小与GWT SDK库gwt-servlet.jar ; 也许它是一个不同的版本?

解决方案:您的案例中的问题是gwt-servlet.jar ,它是由以前的GWT版本自动生成的。 只需将其与其他存根一起删除并重新编译项目即可。

在此处输入图像描述

这对我很有用

选择警告,右键单击并选择“快速修复” – >“使用SDK库同步/ WEB-INF / lib”

“完成”

复制插件目录中的sdk并不是添加其他SDK版本的正确方法。

使用首选项 – > Google – > Web Toolkit添加另一个GWT SDK版本。

在您的项目中选择:

项目属性 – > Goolge – > Web Toolkit您可以选择项目应该使用的SDK。

我将编译器从1.8更改为1.7并丢失了此消息。