JeffersonLab / clara-demo

Demo of a CLARA application with multi-language services
0 stars 1 forks source link

gradlew fails #2

Open whit2333 opened 5 years ago

whit2333 commented 5 years ago
 ./gradlew                                                               

> Task :legacy:compileJava FAILED                                                                                                                
/mnt/old_home/whit/projects/clara/clara-demo/legacy/src/main/java/org/jlab/clara/demo/core/FaceDetector.java:3: error: cannot access Core        
import org.opencv.core.Core;                                                                                                                      
                      ^                                                                                                                          
  bad class file: /usr/share/OpenCV/java/opencv-320.jar(org/opencv/core/Core.class)                                                               
    class file has wrong version 54.0, should be 52.0                                           
    Please remove or make sure it appears in the correct subdirectory of the classpath.                                                          

FAILURE: Build failed with an exception.                                                                                                         

* What went wrong:
Execution failed for task ':legacy:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insight
s.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
1 actionable task: 1 executed
smancill commented 5 years ago

OpenCV seems to be compiled with Java 10.

CLARA and CLAS12 use Java 8.

whit2333 commented 5 years ago

Any idea how to fix this?

smancill commented 5 years ago

You'll probably have to compile OpenCV with a compatible Java version.

Here you have all the CMake options used to compile OpenCV in the CI:

https://github.com/JeffersonLab/clara-demo/blob/398ad97917ce7b4705dd0f3be031e03ab6916dfc/.ci/CMakeLists.txt#L12-L50

Note that CMAKE_INSTALL_PREFIX is set to $CLARA_HOME for simplicity, you can keep it that way to see it work, but it is recommended to use an standard location or a directory like /opt/opencv3/.

If a non-standard directory is used, it may be required to set the OpenCV install location as a Gradle property:

https://github.com/JeffersonLab/clara-demo/blob/398ad97917ce7b4705dd0f3be031e03ab6916dfc/.travis.yml#L43

The same for C++, if CMake cannot find OpenCV, you should pass where OpenCV is installed with -DOpenCV_ROOT=<path> (in the Travis build CMake finds OpenCV because it is installed in the same install prefix path).

You may want to ensure the Java 8 compiler is used (while Clara compiles with JDK 11, I do not know about OpenJDK).

The build passes and the Clara shell runs without issues:

https://travis-ci.org/JeffersonLab/clara-demo/builds/497325107

But all this is just for this example, and it is specified in build.gradle/CMakeLists.txt. (I couldn't think of anything else to demo services than OpenCV.) In your own services you should have control over your own dependencies and paths.

whit2333 commented 5 years ago

But all this is just for this example, and it is specified in build.gradle/CMakeLists.txt. (I couldn't think of anything else to demo services than OpenCV.) In your own services you should have control over your own dependencies and paths.

Could you make a c++ demo without any dependencies that does something trivial?

I have setup something (non functioning) here: https://github.com/whit2333/clara_cpp_test

whit2333 commented 5 years ago

Thanks for the tips for building opencv-3. Running this demo I get the same failure: 2019-06-30 20:24:16.369: Could not use 172.17.0.1 for processing: could not start container = 172.17.0.1%7650_cpp:whit. Clara seems to hang at this point.

The full output is below:

Distribution  :    clara-cre-4.3.8
CLAS12 plugin :    coatjava-5.9.0

==========================================
               CLARA FE/DPE
==========================================
 Name             = 172.17.0.1%7640_java
 Session          = whit_clara
 Start time       = 2019-06-30 20:24:10
 Version          = 4.3
 Lang             = Java
 Pool size        = 2

 Proxy Host       = 172.17.0.1
 Proxy Port       = 7640
==========================================
=========================================
                 CLARA DPE
=========================================
 Name             = 172.17.0.1%7650_cpp
 Date             = 2019-06-30 20:24:11
 Version          = 4.3
 Lang             = C++

 Proxy Host       = 172.17.0.1
 Proxy Port       = 7650

 FrontEnd Host    = 172.17.0.1
 FrontEnd Port    = 7640
 FrontEnd Lang    = Java
=========================================
==========================================
            CLARA Orchestrator
==========================================
 Front-end          = 172.17.0.1%7640_java
 Start time         = 2019-06-30 20:24:13
 Threads            = 2

 Input directory    = /mnt/old_home/whit/projects/clara/clara-demo/resources
 Output directory   = /mnt/old_home/whit/projects/clara/clara-demo
 Output file prefix = out_
 Number of files  = 1
==========================================
2019-06-30 20:24:13.646: Waiting for local node...
2019-06-30 20:24:13.801: Start processing on 172.17.0.1...
2019-06-30 20:24:13.802: Searching services in 172.17.0.1...
2019-06-30 20:24:13.816: Deploying services in 172.17.0.1...
2019-06-30 20:24:14: started container = 172.17.0.1%7640_java:whit
2019-06-30 20:24:14: basic_string::_M_create
2019-06-30 20:24:14: started service = 172.17.0.1%7640_java:whit:DataManager  pool_size = 1
2019-06-30 20:24:14: started service = 172.17.0.1%7640_java:whit:ImageReaderService  pool_size = 1
using classifier: lbpcascade_frontalface.xml
2019-06-30 20:24:15: started service = 172.17.0.1%7640_java:whit:ImageWriterService  pool_size = 1
2019-06-30 20:24:15: started service = 172.17.0.1%7640_java:whit:FaceDetectorService  pool_size = 4
2019-06-30 20:24:16.369: Could not use 172.17.0.1 for processing:
could not start container = 172.17.0.1%7650_cpp:whit