本文介绍了Worklight适配器它不是一个功能,它是“对象”。错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将worklight适配器部署到生产服务器上之后,当适配器从javascript调用
java代码时出现错误:

After deploying worklight adapter onto production server, when adapter makes a call tojava code from javascript I get an error:

rocedure invocation error. Ecma Error: TypeError: Cannot call property updateProposal in object [JavaPackage com.idit.smartphone.managers.ProposalManager]. It is not a function, it is "object". (IDITBackend-impl.js#119) 

我试过在没有参数的类中调用测试函数并且它仍然没有工作
我的班级看起来像

I have tried calling a test function in a class without parameters and it's still not workingmy class looks like

package com.idit.smartphone.managers;
public class ProposalManager {
    public static String test(){
        return "Successss";
    }
}

,电话是:

function finishTask(policyExtNum, answers, closeUnderwriting){

   WL.Logger.info("Service finishTask called.");
   var proposal = getProposalForUpdate(policyExtNum);
   WL.Logger.info("finishTask got proposal");
   var updatedProposal = com.idit.smartphone.managers.ProposalManager.test();
   var result = sendProposalForUpdate(updatedProposal);
   WL.Logger.info("finishTask updated proposal");

   return result;
}




  • 我正在使用最新版本的工作灯昨天发布了
    。部署在tomcat 6上的6.0.0.20130917-1749

  • 它适用于worklight studio,只有当我将适配器上传到tomcat时才会出现问题

  • 我想在这个论坛中尝试了所有其他问题的解决方案

  • 推荐答案

    搜索会给出你已经提出了几个问题/答案:; ;

    a search would have given you a couple of questions/answers already: i want to call a java class from the worklight adapter ; ECMA TypeError calling Java class from Worklight adapter ; Ecma Error: TypeError: Cannot call property

    我们多次遇到这个问题,它总是与损坏的eclipse .project文件有关。会发生的是,您拥有的Java类没有构建,也没有添加到您的worklight.war文件中。当您部署应用程序时,服务器上缺少已编译的类,并且ECMA错误以非常神秘的方式告诉您。

    we had that problem several times and it always had something to do with a corrupted eclipse .project file. What happens is that the Java Class you have does not get built and does not get added to your worklight.war file. When you deploy your app, the compiled class is missing on the server and the ECMA error tells you that in a very cryptic way.

    我们发现的一个解决方案是打开右键单击WL项目的属性转到Java Build Path并使用那里的按钮向上和向下移动一些条目。在关闭属性对话框之后,eclipse应该重写.project文件并且构建应该有效。

    One solution we found was to open the properties of the WL project with a right click go to the Java Build Path and move some of the entries UP and DOWN using the buttons there. After closing the properties dialog eclipse should rewrite the .project file and the build should work.

    我们有时做的另一件事是向项目/服务器/添加一个新类java部分项目使用eclipse New-Class向导,清理并重建项目,然后再次删除该类。甚至可以在它使用的启动字符串末尾使用选项-clean启动eclipse。

    Another thing we did sometimes was to add a new class to the project/server/java part of the project using the eclipse New-Class wizard, clean and rebuild the project and then remove the class again. Maybe even start eclipse with the option -clean at the end of the startup string that it uses.

    这篇关于Worklight适配器它不是一个功能,它是“对象”。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 13:15