GAE端点错误:无法使用修饰符“private”访问类的成员

时间:2022-09-02 10:50:03

I have a GAE API Endpoint that keeps giving me a 503 Error. The API Endpoint does its job properly (processes/post data to the datastore), but once it comes to return the object, this error is thrown:

我有一个GAE API端点,一直给我503错误。 API端点正常工作(处理/发布数据到数据存储区),但一旦返回对象,就会抛出此错误:

java.lang.IllegalStateException: Failed to instantiate standard serializer (oftypecom.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.NullSerializer):Classcom.google.appengine.repackaged.org.codehaus.jackson.map.ser.BasicSeriaiizerFactory can not access a member of class com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.NullSerializer with modifiers "private"

java.lang.IllegalStateException:无法实例化标准序列化程序(oftypecom.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.NullSerializer):Classcom.google.appengine.repackaged.org.codehaus.jackson.map .ser.BasicSeriaiizerFactory无法访问com.google.appengine.repackaged.org.codehaus.jackson.map.ser.std.NullSerializer类的成员,修饰符为“private”

The object which is being returned is an Extended object (FacebookUser extends User). I thought it may have something to do with accessing the base class private variables, so I declared all private variables as protected; I still keep getting this error.

正在返回的对象是扩展对象(FacebookUser扩展用户)。我认为它可能与访问基类私有变量有关,所以我将所有私有变量声明为protected;我仍然一直收到这个错误。

I have one other endpoint which returns a FacebookUser object and it works fine. I interpret it as a GAE serialize cannot serialize the object on return; the data being returned is a lot of the same data being returned in the one working endpoint. The API Endpoint does its job properly, but once it comes to return the object and data, the above error is thrown.

我有一个其他端点返回一个FacebookUser对象,它工作正常。我将其解释为GAE序列化无法在返回时序列化对象;返回的数据是在一个工作端点中返回的大量相同数据。 API端点正常工作,但一旦返回对象和数据,就会抛出上述错误。

Any input is greatly appreciated, thanks!

非常感谢任何输入,谢谢!

1 个解决方案

#1


So I figured it out.

所以我明白了。

I had a function called getToken() in the FacebookUser class. This function was not a getter/setter for a private/protected variable; it was a function which processes incoming information into a token. It seems like the GAE Java APIs assumed getToken was a getter/setter for private variable called "token." Since there isn't a private variable called "token" it was throwing the error I saw. I figured it out when it threw an error for the getToken() function when I ran another function which didn't call the getToken() function.

我在FacebookUser类中有一个名为getToken()的函数。此函数不是私有/受保护变量的getter / setter;它是一个将传入信息处理成令牌的函数。似乎GAE Java API假定getToken是私有变量的getter / setter,称为“token”。由于没有一个名为“token”的私有变量,它抛出了我看到的错误。当我运行另一个没有调用getToken()函数的函数时,当它为getToken()函数抛出一个错误时,我想通了。

#1


So I figured it out.

所以我明白了。

I had a function called getToken() in the FacebookUser class. This function was not a getter/setter for a private/protected variable; it was a function which processes incoming information into a token. It seems like the GAE Java APIs assumed getToken was a getter/setter for private variable called "token." Since there isn't a private variable called "token" it was throwing the error I saw. I figured it out when it threw an error for the getToken() function when I ran another function which didn't call the getToken() function.

我在FacebookUser类中有一个名为getToken()的函数。此函数不是私有/受保护变量的getter / setter;它是一个将传入信息处理成令牌的函数。似乎GAE Java API假定getToken是私有变量的getter / setter,称为“token”。由于没有一个名为“token”的私有变量,它抛出了我看到的错误。当我运行另一个没有调用getToken()函数的函数时,当它为getToken()函数抛出一个错误时,我想通了。