阅读背景:

Groovy无法在CloudHub中解析类

来源:互联网 

Have the following errors for the following scripts in a Mule flow when I run the application in CloudHub. When I run it on Anypoint studio, there's no issues.

当我在CloudHub中运行应用程序时,在Mule流程中对以下脚本有以下错误。当我在Anypoint studio上运行时,没有问题。

I checked the deployed application archive file and in the classes folder is the compiled company.cloudtools.util.Utilities class. I am not sure why the CloudHub server cannot locate the class file as defined by the error.

我检查了部署的应用程序归档文件,在classes文件夹中是已编译的company.cloudtools.util.Utilities类。我不确定为什么CloudHub服务器找不到错误定义的类文件。

Error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script16.groovy: 1: unable to resolve class company.cloudtools.util.Utilities
 @ line 1, column 1.
   import company.cloudtools.util.Utilities
   ^

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:858)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:214)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngin

Script in Mule flow:

骡流中的脚本:

<scripting:transformer doc:name="parse record type">
                    <scripting:script engine="Groovy"><![CDATA[import company.cloudtools.util.Utilities
        import com.netsuite.webservices.platform.core.types.RecordType
        import org.mule.module.netsuite.RecordTypeEnum

        // flowVars[ns_record_type] is used for the "get-record" operation
        flowVars["ns_record_type"] = Utilities.findRecordType(payload["ns_record_type"], Arrays.asList(RecordType.values()), 0)
        // flowVars[ns_record_type_enum] is used for the "update record" operation?
        flowVars["ns_record_type_enum"] = Utilities.findRecordTypeEnum(payload["ns_record_type"], Arrays.asList(RecordTypeEnum.values()), 0)

        return payload]]></scripting:script>
                </scripting:transformer>

Utilities Class:

package company.cloudtools.util;

import com.netsuite.webservices.platform.core.types.RecordType;
import org.mule.module.netsuite.RecordTypeEnum;
import java.util.*;

public class Utilities {

    //initial call... findRecordType("downloaditem", RecordType.values(), 0)
    public static RecordType findRecordType(String bad_name, List<RecordType> available_enums, Integer current_character) {}

    //initial call... findRecordTypeEnum("downloaditem", RecordTypeEnum.values(), 0)
    public static RecordTypeEnum findRecordTypeEnum(String bad_name, List<RecordTypeEnum> available_enums, Integer current_character) {}
}

1 个解决方案

#1


The issue is that CloudHub only supports JRE 1.6 for the version of Mule I am using, Mule 3.5.0. Mule workers that are 3.5.1 above uses the currently supported JRE 1.7. Had the change my applications JRE to get it to work.

问题是CloudHub仅支持JRE 1.6用于我使用的Mule版本,Mule 3.5.0。上面3.5.1的骡子工作者使用当前支持的JRE 1.7。如果改变我的应用程序JRE以使其工作。

As a later task, I will find out how to make it work with JRE 1.7 (probably have to update the runtime environment to 3.5.1 or above).

作为后续任务,我将了解如何使其与JRE 1.7一起使用(可能必须将运行时环境更新为3.5.1或更高版本)。

See the Technical / Troubleshooting section at Mulesoft - https://www.mulesoft.org/documentation/display/current/FAQ

请参阅Mulesoft的技术/故障排除部分 - https://www.mulesoft.org/documentation/display/current/FAQ


分享到: