1

我正在尝试遵循 Google 应用引擎教程

此代码在我的本地开发服务器上运行。当我执行:

 appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8888/remote_api --filename places.csv --kind=Place -e nobody@nowhere.com

我得到一个 UnknownJavaServerError。任何想法为什么会发生这种情况?[我的操作系统是Windows,python版本是2.7]

这是我得到的完整输出:

    C:\EclipseWorkspace\Android\MobileAssistant2-AppEngine\src>appcfg.py upload_data --config_file=bulkloader.yaml --filename=places.csv --kind=Place --url=http://localhost:8888/remote_api -e nobody@nowhere.com
08:46 PM Uploading data records.
[INFO    ] Logging to bulkloader-log-20130821.204602
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
Password for nobody@nowhere.com:
[INFO    ] Opening database: bulkloader-progress-20130821.204602.sql3
[INFO    ] Connecting to localhost:8888/remote_api
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 171, in <module>
    run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 167, in run_file
    execfile(script_path, globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 4282, in <module>
    main(sys.argv)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 4273, in main
    result = AppCfgApp(argv).Run()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2409, in Run
    self.action(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 4003, in __call__
    return method()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3815, in PerformUpload
    run_fn(args)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3706, in RunBulkloader
    sys.exit(bulkloader.Run(arg_dict))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py", line 4395, in Run
    return _PerformBulkload(arg_dict)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py", line 4260, in _PerformBulkload
    loader.finalize()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\bulkload\bulkloader_config.py", line 382, in finalize
    self.reserve_keys(self.keys_to_reserve)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py", line 1228, in ReserveKeys
    datastore._GetConnection()._reserve_keys(ConvertKeys(keys))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1880, in _reserve_keys
    self._async_reserve_keys(None, keys).get_result()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 838, in get_result
    results = self.__rpcs[0].get_result()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612, in get_result
    return self.__get_result_hook(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1921, in __reserve_keys_hook
    self.check_rpc_success(rpc)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastore\datastore_rpc.py", line 1234, in check_rpc_success
    rpc.check_success()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 578, in check_success
    self.__rpc.CheckSuccess()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 200, in MakeSyncCall
    self._MakeRealSyncCall(service, call, request, response)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 236, in _MakeRealSyncCall
    raise UnknownJavaServerError("An unknown error has occured in the "
google.appengine.ext.remote_api.remote_api_stub.UnknownJavaServerError: An unknown error has occured in the Java remote_api handler for this call.

我的源文件如下 -


web.xml 文件:

    <?xml version="1.0" encoding="utf-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

 <servlet>
  <servlet-name>SystemServiceServlet</servlet-name>
  <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
  <init-param>
   <param-name>services</param-name>
   <param-value>com.google.samplesolutions.mobileassistant.CheckInEndpoint,com.google.samplesolutions.mobileassistant.DeviceInfoEndpoint,com.google.samplesolutions.mobileassistant.MessageEndpoint,com.google.samplesolutions.mobileassistant.PlaceEndpoint</param-value>
  </init-param>
 </servlet>
 <servlet-mapping>
  <servlet-name>SystemServiceServlet</servlet-name>
  <url-pattern>/_ah/spi/*</url-pattern>
 </servlet-mapping>

<servlet>
    <display-name>Remote API Servlet</display-name>
    <servlet-name>RemoteApiServlet</servlet-name>
    <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>RemoteApiServlet</servlet-name>
    <url-pattern>/remote_api</url-pattern>
  </servlet-mapping> 

</web-app>

bulkloader.yaml 文件:

    #!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

python_preamble:
- import: base64
- import: re
- import: google.appengine.ext.bulkload.transform
- import: google.appengine.ext.bulkload.bulkloader_wizard
- import: google.appengine.ext.db
- import: google.appengine.api.datastore
- import: google.appengine.api.users

transformers:

- kind: Offer
  connector: csv
  connector_options:
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string

    - property: description
      external_name: description
      # Type: String Stats: 2 properties of this type in this kind.

    - property: title
      external_name: title
      # Type: String Stats: 2 properties of this type in this kind.

    - property: imageUrl
      external_name: imageUrl

- kind: Place
  connector: csv
  connector_options:
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string

    - property: address
      external_name: address
      # Type: String Stats: 6 properties of this type in this kind.

    - property: location
      external_name: location
      # Type: GeoPt Stats: 6 properties of this type in this kind.
      import_transform: google.appengine.api.datastore_types.GeoPt

    - property: name
      external_name: name
      # Type: String Stats: 6 properties of this type in this kind.

    - property: placeId
      external_name: placeId
      # Type: String Stats: 6 properties of this type in this kind.


- kind: Recommendation
  connector: csv
  connector_options:
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string

    - property: description
      external_name: description
      # Type: String Stats: 4 properties of this type in this kind.

    - property: title
      external_name: title
      # Type: String Stats: 4 properties of this type in this kind.

    - property: imageUrl
      external_name: imageUrl

    - property: expiration
      external_name: expiration
      import_transform: transform.import_date_time('%m/%d/%Y')

地方.csv 文件:

    name,placeId,location,key,address
A store at City1 Shopping Center,store101,"47,-122",1,"Some address of the store in City 1"
A big store at Some Mall,store102,"47,-122",2,"Some address of the store in City 2"

谢谢!

4

1 回答 1

0

Google_appengine 1.8.2 和 1.8.3 中有一个错误。降级到版本 1.8.1 以解决该错误。在 Windows 8 x64 和 Python 2.7.5 x64 上检查

于 2013-08-28T22:28:50.247 回答