QuickStart Tutorial Problem, SLF4J, REST


#1

Hi, I am new to camunda and I tried to learn with the Quickstart Tutorial. Tutorial

I created a maven project in eclipse how it is described. When I run the class ChargeCardWorker as a Java Application the following error ocurres:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I am not used in working with maven projects. Has anyone an idea what to do? When I look into the build path of the project, the slfj is referenced.

To test starting a process via rest I added a System.out.println command in the class. I tried to start the process via a RestClient Addon from Firefox with the code from the tutorial.
The rest client said that the command was succesfully sent.
Unfortunatelly I cant see anything in the eclipse console and if I look at the cockpit, there ist no process started.

Can anyone help me?
thanks a lot,
Nicole


#2

Failed to load class org.slf4j.impl.StaticLoggerBinder

This warning message is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar slf4j-simple.jar , slf4j-log4j12.jar , slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.

SINCE 1.6.0 As of SLF4J version 1.6, in the absence of a binding, SLF4J will default to a no-operation (NOP) logger implementation.

If you are responsible for packaging an application and do not care about logging, then placing slf4j-nop.jar on the class path of your application will get rid of this warning message. Note that embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api. When a library declares a compile-time dependency on a SLF4J binding, it imposes that binding on the end-user, thus negating SLF4J’s purpose.

So please replace with these dependencies in classpath:
add slf4j-simple-1.6.1.jar to the application along with slf4j-api-1.6.1.jar


#3

Thank you. The warning disappeared (I added `slf4j-simple-1.6.1.jar)
But the worker ChargeCardWorker still does not print anything. Any more ideas what I did wrong?


#4

the java workers is pretty silent - it’s probably working :slight_smile:
Try to create a process with the topic you’re subscribing to and it should do some stuff


#5

Yes, I know it is working silent :wink: But the worker should tell me some things via the logger. Here is the code from the worker:

//Code from tutorial
package org.camunda.bpm.getstarted.chargecard;
import java.util.logging.Logger;
import org.camunda.bpm.client.ExternalTaskClient;

public class ChargeCardWorker {
  private final static Logger LOGGER = Logger.getLogger(ChargeCardWorker.class.getName());

  public static void main(String[] args) {
    ExternalTaskClient client = ExternalTaskClient.create().baseUrl("http://localhost:8080/engine-rest").build();

// subscribe to an external task topic as specified in the process
client.subscribe("charge-card")
    .lockDuration(1000) // the default lock duration is 20 seconds, but you can override this
    .handler((externalTask, externalTaskService) -> {
      // Put your business logic here

      // Get a process variable
      String item = (String) externalTask.getVariable("item");
      Long amount = (Long) externalTask.getVariable("amount");
      LOGGER.info("Charging credit card with an amount of '" + amount + "'€ for the item '" + item + "'...");

      // Complete the task
      externalTaskService.complete(externalTask);
    })
    .open();
  }
}

I started it as java application. Then I sent a restrequest how it is described in the tutorial.

Blockquote
In your worker, you should now see the output in your console. This means you have successfully started and executed your first simple process.