简体   繁体   English

引起:java.lang.ClassCastException:com.google.appengine.api.datastore.Text 无法转换为 java.lang.String

[英]Caused by: java.lang.ClassCastException: com.google.appengine.api.datastore.Text cannot be cast to java.lang.String

I am trying to download a Excel on my local computer from my web application deployed on Google App Engine.我正在尝试从部署在 Google App Engine 上的 Web 应用程序下载本地计算机上的 Excel。 The Entity from I get the data, have not Text fields.从我获取数据的实体,没有文本字段。

All the fields are String.所有字段都是字符串。 However, when I reach the line (String) catalogo.getProperty("des_definidor") in a object which des_definidor field is 538 characters length (and 538 bytes, I calculated), I get this error.但是,当我到达des_definidor字段长度为 538 个字符(我计算为 538 个字节(String) catalogo.getProperty("des_definidor")的对象中的行(String) catalogo.getProperty("des_definidor")时,我收到此错误。 I thought the characters limit for a String was 1500 bytes in an Entity field.我认为字符串的字符限制是实体字段中的 1500 字节。

Someone knows what is the problem?有人知道是什么问题吗? Thanks you so much非常感谢

to convert com.google.appengine.api.datastore.Text to a String use getValue method on Text:将 com.google.appengine.api.datastore.Text 转换为 String 使用 Text 上的 getValue 方法:

String value = someText.getValue();

Ordinary Java strings indeed stored as properties in Entity objects are limited to 1500 bytes.确实作为属性存储在 Entity 对象中的普通 Java 字符串限制为 1500 字节。

for more info, check Java documentation for App Engine API .有关更多信息,请查看App Engine API 的 Java 文档

暂无
暂无

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

相关问题 Google App Engine:java.lang.ClassCastException:com.google.appengine.api.datastore.Key 无法转换为 java.lang.Integer - Google App Engine: java.lang.ClassCastException: com.google.appengine.api.datastore.Key cannot be cast to java.lang.Integer java.lang.ClassCastException:无法将java.lang.String强制转换为com.tutorial.stateful.Book - java.lang.ClassCastException: java.lang.String cannot be cast to com.tutorial.stateful.Book java.lang.ClassCastException:无法将java.lang.String强制转换为com.security.model.UserRequest - java.lang.ClassCastException: java.lang.String cannot be cast to com.security.model.UserRequest java.lang.ClassCastException:java.lang.String无法强制转换为com.example.service.AlbumService - java.lang.ClassCastException: java.lang.String cannot be cast to com.example.service.AlbumService Prefs错误-Android'原因:java.lang.ClassCastException:java.lang.Boolean无法转换为java.lang.String' - Prefs Error - Android ' Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String' java.lang.ClassCastException:android.text.SpannableString无法强制转换为java.lang.String - java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String 为什么显示java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String? - Why show java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String? Solr CloudSolrClient:原因:java.lang.ClassCastException:java.lang.String无法转换为java.util.Map - Solr CloudSolrClient : Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map JasperReports:java.lang.ClassCastException:无法将java.lang.String强制转换为java.lang.Character - JasperReports:java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character JasperReports:取得java.lang.ClassCastException:java.lang.String无法转换为java.lang.Number - JasperReports: getting java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM