简体   繁体   English

工作灯适配器和Groovy

[英]worklight adapters and Groovy

Has anyone had success implementing IBM Worklight 5.0.6 Adapters using the Groovy language? 有没有人成功使用Groovy语言实现IBM Worklight 5.0.6适配器? Ie. 就是 Instead of calling a Java class from the JS adapter call a Groovy class. 而不是从JS适配器调用Java类,而是调用Groovy类。 We have tried this and it seems to work most of the time but randomly we will get strange errors when invoking an adapter procedure. 我们已经尝试过了,它似乎大多数时候都可以工作,但是随机地,当调用适配器过程时,我们会得到奇怪的错误。 Ie. 就是

Failed to create DGM method proxy : java.lang.NoSuchMethodException: org.codehaus.groovy.runtime.dgm$24.<init>(java.lang.String, org.codehaus.groovy.reflection.CachedClass, java.lang.Class, [Ljava.lang.Class;)
FWLSE0101E: Caused by: java.lang.NoSuchMethodException: org.codehaus.groovy.runtime.dgm$24.<init>(java.lang.String, org.codehaus.groovy.reflection.CachedClass, java.lang.Class, [Ljava.lang.Class;)

Unit tests executing the Groovy code run fine within Eclipse and the Groovy code seems to be compiling fine down to .class files and included in the adapter package. 执行Groovy代码的单元测试可以在Eclipse中正常运行,并且Groovy代码似乎可以编译为.class文件并包含在适配器包中。 We're wondering if this is an issue with Groovy itself or invoking Groovy within the Worklight server container. 我们想知道这是Groovy本身的问题还是在Worklight服务器容器中调用Groovy。 I believe Worklight is using Rhino behind the scenes which may also be a culprit? 我相信Worklight在后台使用Rhino,这也可能是罪魁祸首吗?

We are using Groovy 2.1.5 and the Eclipse plugin 2.8 我们正在使用Groovy 2.1.5和Eclipse插件2.8

did you open the .war and check if all compiled classes and libraries are actually in there? 您是否打开.war并检查是否所有编译的类和库实际上都在其中? We had the case quite often that the WL Eclipse Plugin/Build did not compile and package our Java Classes for the Adapter in the "server" folder ... they were missing in the .war file that we deployed and we got all sorts of Rhino, ClassNotFound etc. errors. 我们经常遇到这样的情况,即WL Eclipse插件/构建程序没有将适配器的Java类编译并打包到“服务器”文件夹中……它们在我们部署的.war文件中丢失了,并且得到了各种各样的Rhino,ClassNotFound等错误。

In addition to previous answer. 除了以前的答案。 You can always force a rebuild by selecting the project in the Enterprise Explorer or Navigator views, then select menu Project -> Clean -> Clean Projects Selected Below (the only choice should be your project). 您始终可以通过在Enterprise Explorer或Navigator视图中选择项目来强制进行重新构建,然后选择菜单Project-> Clean-> Clean下方选择的项目(唯一的选择应该是您的项目)。

This will clean the binaries, then rebuild your entire project. 这将清理二进制文件,然后重建整个项目。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM