"Object cannot be resolved to a type" while compiling the process

Solution Verified - Updated -

Issue

  • Following error is thrown during the compilation of the process:
Process Compilation error : Process org.jbpm.SampleEvent(SampleProcess.SampleEvent)
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (9:376) : Syntax error on token "import", throw expected
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (9:383) : java.time.LocalDateTime cannot be resolved to a variable
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (10:408) : Syntax error on token "import", assert expected
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (10:415) : java.time.format.DateTimeFormatter cannot be resolved to a variable
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (11:451) : Syntax error on token "import", int expected
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (14:467) : Event cannot be resolved to a type
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (14:485) : Event cannot be resolved to a type
        org/jbpm/Process_org$u46$jbpm$u46$SampleEvent1553941447.java (34:1137) : event cannot be resolved to a variable

The Event class is located in the same package as the process itself, and the process contains Script with following content:

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import Event;


Event event = new Event();
event.setDate_time(java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss")));
event.setEvent_code("TESTCODE");
event.setProduct_service_code("TEST_CODE");
event.setSource("TEST_SOURCE");
event.setTracking_number("XXX");
event.setBranch("TEST_BRANCH");
event.setUser_id("TEST_USER");


kcontext.setVariable("pEvent", event);

System.out.println("event ----->"+event);

Environment

  • Red Hat JBoss BPM Suite
    • 6
  • Red Hat Process Automation Manager
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content