Search code examples
javabrooklyn

VanillaSoftwareProcess Entity does not work in Apache Brooklyn


I have the last Apache Brooklyn (24.08.2015), Version: 0.8.0-SNAPSHOT, and when I am trying the example of the blueprint which is here: https://brooklyn.incubator.apache.org/v/latest/yaml/custom-entities.html

name: Simple Netcat Server Example
location: localhost
services:
- type: brooklyn.entity.basic.VanillaSoftwareProcess
  name: Simple Netcat Server
  launch.command: |
    echo hello | nc -l 4321 &
    echo $! > $PID_FILE

  # The following overrides demonstrate the use of a custom shell environment as well as
  # check-running and stop commands. These are optional; default behavior will "do the
  # right thing" with the pid file automatically.

  env:                  { CHECK_MARKER: "checkRunning", STOP_MARKER: "stop" }
  checkRunning.command: echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p `cat $PID_FILE` >/dev/null
  stop.command:         echo $STOP_MARKER  >> DATE && test -f "$PID_FILE" && { kill -9 `cat $PID_FILE`; rm /tmp/vanilla.pid; }

# can also define download.url, in which case the launch command defaults to ./start.sh in that (archive) file

When I tried to create the application with the Apache Brooklyn, I get an Internal error. I debugged the application, and the Exception I get is the following (PlanToSpecFactory.java):

java.lang.UnsupportedOperationException: Deployment plan item org.apache.brooklyn.camp.spi.pdp.Service@62abec8e[name=Simple Netcat Server,description=,serviceType=brooklyn.entity.basic.VanillaSoftwareProcess,characteristics=[],customAttributes={launch.command=echo hello | nc -l 4321 & echo $! > $PID_FILE , env={CHECK_MARKER=checkRunning, STOP_MARKER=stop}, checkRunning.command=echo $CHECK_MARKER >> DATE && test -f "$PID_FILE" && ps -p cat $PID_FILE >/dev/null, stop.command=echo $STOP_MARKER

DATE && test -f "$PID_FILE" && { kill -9 cat $PID_FILE; rm /tmp/vanilla.pid; }}] cannot be matched

The trace in debug.log

DEBUG o.a.b.c.plan.PlanToSpecFactory [brooklyn-jetty-server-8443-qtp1119923741-24]: Plan could not be transformed; failure will be propagated (other transformers tried = []): [java.lang.IllegalArgumentException: Transformer for Brooklyn OASIS CAMP interpreter gave an error creating this plan]

Any idea why? In the past this has worked

(I would like to post in the mailing list of Apache Brooklyn, but I get an error and I can not contact nobody)


Solution

  • The latest SNAPSHOT versions went through an heavy refactoring to change the package name to org.apache.brooklyn.*. That's probably why your version of Brooklyn cannot find the VanillaSoftwareProcess anymore.

    Based on the Github repository, this entity is now located here: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess