cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiException: Can't find scripting engine for 'groovy'

anasofiafreitas
Champ in-the-making
Champ in-the-making
I'm trying to deploy and execute a very simple workflow that runs a groovy script.
I implemented the code in Eclipse and I can successfully execute it, but when I try to export it to a .jar file, using Maven, I'm getting an exception saying: Can't find scripting engine for 'groovy'.

I've seen a couple of old topics related to this exception here in the forum, and the solution was to add groovy-all as a dependency (instead of groovy). But I'm already doing it… and still the same problem.

Here is a snapshot of my pom.xml file. Does anybody know what I'm doing wrong here?


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Oil_Spill</groupId>
  <artifactId>Oil_Spill</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <build>
    <sourceDirectory>src/main/java/Job1</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
        <archive>
          <index>true</index>
          <manifest>
            <addClasspath>true</addClasspath>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          </manifest>
        </archive>
      </configuration>
    </plugin>
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>Job1.Main</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.bpmn</include>
          <include>*.xml</include>
        </includes>
      </resource>
    </resources>
  </build>
  <dependencies>
     <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-engine</artifactId>
        <version>6.0.0.Beta1</version>
     </dependency>
     <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.3</version>
    </dependency>
     <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.13</version>
     </dependency>
     <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.176</version>
    </dependency>
  </dependencies>
</project>
5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

is groovy-all jar in the classpath of the application where you runs your project?

Regards
Martin

anasofiafreitas
Champ in-the-making
Champ in-the-making
Yes, it is in the classpath and when I run the application from the eclipse everything is fine.
The problem is when I run the application from the console, using the .jar file generated with Maven.

I really don't know may be the problem…

jbarrez
Star Contributor
Star Contributor
Does the jar include the groovy-all jar (ie a fat jar)? Do you add the groovy-all jar to the classpath when executing the jar?

anasofiafreitas
Champ in-the-making
Champ in-the-making
Yes, the jar includes the groovy-all jar.

The pom is presented below. I'm compiling the code with the following command:  mvn clean compile assembly:single package
And then running the jar by just doing java -jar NAME_OF_THE_JAR. Am I missing something? Do I need to define any environment variable before running the jar? Thanks!

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Oil_Spill</groupId>
  <artifactId>Oil_Spill</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <build>
    <sourceDirectory>src/main/java/Job1</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
        <archive>
          <index>true</index>
          <manifest>
            <addClasspath>true</addClasspath>
            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          </manifest>
          <manifestEntries>
              <Class-Path>./classes/groovy-all-2.4.3.jar</Class-Path>
            </manifestEntries>
        </archive>
      </configuration>
    </plugin>
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>Job1.Main</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.bpmn</include>
          <include>*.xml</include>
          <include>*.jar</include>
        </includes>
      </resource>
    </resources>
  </build>
  <dependencies>
   <dependency>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-engine</artifactId>
    <version>6.0.0.Beta1</version>
   </dependency>
   <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.5</version>
    </dependency>
   <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.13</version>
   </dependency>
   <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.176</version>
    </dependency>
  </dependencies>
</project>

jbarrez
Star Contributor
Star Contributor
Yes you are: if you run java -jar NAME_OF_JAR, groovy_all will not be on the classpath.
You need to run with java -cp path/to/your/libs -jar yourjar.jar (or create a fat jar that includes it)