Can't use my JAR file

I created a project and a service bean.
In my bean, I have
import com.jujuworkflow.PDI.*;

but when I go to start the application server in Studio, it fails. In the log I see the following:

2015-12-14 19:26:14,183 DEBUG [] :app-core:compileJavaC:\Users\Francis\studio-projects\jujuflow\modules\core\src\com\company\jujuflow\service\ error: package com.jujuworkflow.PDI does not exist
2015-12-14 19:26:14,184 DEBUG [] import com.jujuworkflow.PDI.*;
2015-12-14 19:26:14,185 DEBUG [] ^
2015-12-14 19:26:14,241 DEBUG [] C:\Users\Francis\studio-projects\jujuflow\modules\core\src\com\company\jujuflow\service\ error: cannot find symbol
2015-12-14 19:26:14,244 DEBUG []         JujuPDI.ExecuteJob(migrationJob, variables,parameters);
2015-12-14 19:26:14,245 DEBUG []         ^
2015-12-14 19:26:14,247 DEBUG []   symbol:   variable JujuPDI
2015-12-14 19:26:14,248 DEBUG []   location: class PDIServiceBean
2015-12-14 19:26:14,249 DEBUG [] Note: C:\Users\Francis\studio-projects\jujuflow\modules\core\src\com\company\jujuflow\service\ uses unchecked or unsafe operations.
2015-12-14 19:26:14,250 DEBUG [] Note: Recompile with -Xlint:unchecked for details.
2015-12-14 19:26:14,251 DEBUG [] 2 errors
2015-12-14 19:26:14,259 DEBUG []  FAILED
2015-12-14 19:26:14,261 DEBUG [] 
2015-12-14 19:26:14,264 DEBUG [] FAILURE: Build failed with an exception.
2015-12-14 19:26:14,265 DEBUG [] 
2015-12-14 19:26:14,266 DEBUG [] * What went wrong:
2015-12-14 19:26:14,268 DEBUG [] Execution failed for task ':app-core:compileJava'.
2015-12-14 19:26:14,269 DEBUG [] > Compilation failed; see the compiler error output for details.
2015-12-14 19:26:14,271 DEBUG [] 
2015-12-14 19:26:14,272 DEBUG [] * Try:
2015-12-14 19:26:14,274 DEBUG [] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
2015-12-14 19:26:14,275 DEBUG [] 
2015-12-14 19:26:14,277 DEBUG [] BUILD FAILED
2015-12-14 19:26:14,279 DEBUG [] 
2015-12-14 19:26:14,280 DEBUG [] Total time: 2.744 secs

Even though in IntelliJ it doesn’t report any errors as I was able to successfully add the JAR, I wonder where it should be placed for a CUBA project.


Perhaps you have directly added your JAR as a module dependency to your project structure in IntelliJ. That’s why it does not report any errors. But Gradle does not know about this dependency and cannot assemble the project. So you have to add the JAR to build.gradle.

If your JAR can be found in a Maven repository (local or Maven Central), just add a dependency for the “core” module:

  • In Studio, go to Project Properties > Edit > Advanced
  • Add compile dependency for “core” module and specify its coordinates, like “activemq:activemq-client:5.13.0”
  • After saving changes, Gradle will recompile the project and recreate IntelliJ files.

If you have a standalone JAR, you have to add a file-based repository to build.gradle manually, for example:

buildscript {
    repositories {
        maven {
        flatDir { dirs 'c:\\work\\lib' }

After that, place your JAR into this directory and specify the dependency as described above. The coordinates must contain at least two parts: “mylibrary:myfile”, where “mylibrary” is an arbitrary group (it is ignored) and “myfile” - name of the JAR file (myfile.jar).

thanks. That solved my problem.

correction: the above solved my problem in the sense that now, the application server starts, but I’m encountering this new issue.
when i create my object and save it, I’m trying to invoke my code, but I get the following message:
java.lang.ClassNotFoundException: org.pentaho.di.core.exception.KettleException
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(
at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(
at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

My JAR file (jujuPDI.jar) depends on other JAR files. Do I have to put those other JAR files in the same path as my JAR file and add all of those as dependencies as well?

Sure. If you use the directory-based repository, you have to include all dependencies manually.
When you use Maven artifacts with properly configured pom.xml files, transitive dependencies are loaded automatically.