Worklight机票示例“找不到函数[onAuthRequired”。“

时间:2014-01-15 13:01:44

标签: ibm-mobilefirst

我正在尝试为Worklight v6.1.0运行Flight Ticket示例应用程序。我的设置工作正常。我按如下方式部署了应用程序:

  1. 我将项目zip文件FlightTicketSampleProject.zip导入我的工作区。
  2. 我在server.xml文件中创建了一个新的Web应用程序,其上下文根为flightticket,并将战争位置指向flightticket.war。当我导航到http://localhost:10080/flightticket时,我得到了简单的index.html消息。到目前为止,一切都很好。
  3. 然后我将三个适配器FTAdapter,FTPushAdapter和LoginAdapter部署到服务器。
  4. 最后,我使用Run As -> Run on Worklight Development Server部署了应用。
  5. 当我打开Worklight Console并单击Preview as Common Resources时,我在Eclipse控制台中收到错误,如下所示:

    [ERROR   ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'FlightTicket'. [project module_60_4_FlightTicket]
    [ERROR   ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request  [project module_60_4_FlightTicket]There is no application in the DB with the id 'FlightTicket'., User Identity {wl_authenticityRealm=null, FTRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project module_60_4_FlightTicket] 
                                                                                                                   com.worklight.common.log.filters.ErrorFilter
    [ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project module_60_4_FlightTicket]FTAdapter/onAuthRequiredFWLSE0100E:  parameters: [project module_60_4_FlightTicket]{
       "arr": [
          {
             "Accept": [
                "text\/javascript, text\/html, application\/xml, text\/xml, *\/*"
             ],
             "Accept-Encoding": [
                "gzip, deflate"
             ],
             "Accept-Language": [
                "en-IN"
             ],
             "Cache-Control": [
                "no-cache"
             ],
             "Connection": [
                "Keep-Alive"
             ],
             "Content-Length": [
                "66"
             ],
             "Content-Type": [
                "application\/x-www-form-urlencoded; charset=UTF-8"
             ],
             "Cookie": [
                "testcookie=oreo; JSESSIONID=0000Ujzcx6nIYXNuXrpCFmbvqwt:040ac9eb-2103-4149-97c9-431f2113a34f"
             ],
             "Host": [
                "192.168.174.1:10080"
             ],
             "Referer": [
                "http:\/\/192.168.174.1:10080\/module_60_4_FlightTicket\/apps\/services\/preview\/FlightTicket\/common\/0\/default\/views\/socialShare.html"
             ],
             "User-Agent": [
                "Mozilla\/5.0 (Windows NT 6.2; WOW64; Trident\/7.0; MALNJS; rv:11.0) like Gecko"
             ],
             "WL-Instance-Id": [
                "8k22jp5elrdat1d06sitpqeq1f"
             ],
             "X-Requested-With": [
                "XMLHttpRequest"
             ],
             "x-wl-app-version": [
                "1.0"
             ],
             "x-wl-platform-version": [
                "6.1.0.00.20131219-1900"
             ]
          }
       ]
    }
    Function [onAuthRequired] not found.
    

    我检查了onAuthRequired函数的来源,但我找不到定义和函数调用。

    有人可以告诉我这里发生了什么吗?

2 个答案:

答案 0 :(得分:0)

你只是做错了。第2步完全不正确,并且在Worklight文档中没有任何地方可以看到它被要求执行。

以下是我所做的以及你应该遵循的内容:

  1. 下载了Flight Ticket sample project
  2. 将其导入运行Worklight Developer Edition 6.1的Eclipse
  3. 右键单击adapters文件夹中的每个适配器,然后选择Run As > Deploy Worklight adapter
  4. 右键点击apps文件夹中的FlightTicket应用,然后选择Run As > Run on Worklight Development Server
  5. 打开Worklight控制台
  6. 在Android模拟器中运行应用
  7. 第4步是必需的!如果不执行此步骤,则表示您未部署应用程序,这意味着您的应用程序将无法连接到Worklight Server。请参阅问题中提到的错误消息。它确切地告诉你,该应用程序不存在。

    登录后:
    enter image description here

答案 1 :(得分:0)

  1. 请确保您不删除Android项目下的原生文件夹。

  2. war文件用作后端服务器(JAX-RS),因此移动设备将从此war文件中获取数据,就像您的真实企业数据一样,而工作光战则在eclipse中自动部署,并充当您的移动应用和适配器的网关将连接到后端服务器REST api以获取模拟数据。