无法在 KIE workbench (jBPM) 中添加 Java 导入

Unable to add Java imports in KIE workbench (jBPM)

我是 jBPM 的新手。我正在使用 jBPM KIE workbench。正如您在第二张图片中看到的,我在 KIE 外部数据对象部分添加了必要的导入。为什么我会收到错误?我需要对导入做些别的事情吗?

我收到一个抛出的错误:

[KBase: defaultKieBase]: Process Compilation error URL cannot be resolved to a type
URL cannot be resolved to a type
HttpURLConnection cannot be resolved to a type
HttpURLConnection cannot be resolved to a type
BufferedReader cannot be resolved to a type
BufferedReader cannot be resolved to a type
InputStreamReader cannot be resolved to a type

Java代码:

    try {
        URL url = new URL("http://localhost:8080/users");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setRequestProperty("Content-Type", "application/json");

        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }

        in.close();

        System.out.println(content);
    }

    catch(Exception e){
        throw new RuntimeException(e);
    }

内置的 REST 工作项应该是一个很好的起点。

创建项目并添加业务流程:

然后添加内置的 Rest Workitem

然后打开 Rest Workitem 属性和select数据分配

并输入 Rest Call 的值