mail2lawi commented on issue #7102:
URL: https://github.com/apache/cloudstack/issues/7102#issuecomment-1387271051

   @weizhouapache I got the same error even after amending the build.sh to 
python3. 
   
   On looking closely at the log I think I've found what's causing the error.  
Looks like a JRE mismatch error. 
   
   `
   [INFO] --- maven-remote-resources-plugin:1.3:process (default) @ 
cloud-apidoc ---
   [INFO] 
   [INFO] --- exec-maven-plugin:1.2.1:exec (compile) @ cloud-apidoc ---
   Error: A JNI error has occurred, please check your installation and try again
   Exception in thread "main" java.lang.UnsupportedClassVersionError: 
com/cloud/api/doc/ApiXmlDocWriter has been compiled by a more recent version of 
the Java Runtime (class file version 55.0), this version of the Java Runtime 
only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
   [INFO] ------------------------------------------------------
   `
   I had set the JAVA_HOME env to JDK11 but the default java and javac were 
still pointing to the default 1.8 that came with the system.
   So I changed the default to version 11 using alternatives and managed to get 
past that issue.
   
   But then I was faced with the python error:
   `[ERROR] Failed to execute goal 
org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (package) on project 
cloud-marvin: Command execution failed.: Cannot run program "python" (in 
directory 
"~/apache-cloudstack-4.17.2.0-src/dist/rpmbuild/BUILD/cloudstack-4.17.2.0/tools/marvin"):
 error=2, No such file or directory -> [Help 1]`
   
   I fixed this by changing the instances of python to python3 in 
tools/marvin/pom.xml. 
   `
    81                     <execution>
    82                         <id>package</id>
    83                         <phase>package</phase>
    84                         <goals>
    85                             <goal>exec</goal>
    86                         </goals>
    87                         <configuration>
    88                             
<workingDirectory>${exec.workingdir}</workingDirectory>
    89                             <executable>python3</executable>
    90                             <arguments>
    91                                 <argument>mvn-setup.py</argument>
    92                                 <argument>${project.version}</argument>
    93                                 <argument>sdist</argument>
    94                             </arguments>
    95                         </configuration>
    96                     </execution>
   
   `
   
   The next error was `[ERROR] Failed to execute goal 
org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (package) on project 
cloud-marvin: Command execution failed.: Process exited with an error: 1 (Exit 
value: 1) -> [Help 1]`
   
   Log showed this as the culprit:
   
   ```
   [INFO] --- exec-maven-plugin:1.2.1:exec (package) @ cloud-marvin ---
   Traceback (most recent call last):
     File "mvn-setup.py", line 54, in <module>
       runSetupScript(remainingArgs)
     File "mvn-setup.py", line 46, in runSetupScript
       exitCode = subprocess.call(cmd)
     File "/usr/lib64/python3.6/subprocess.py", line 287, in call
       with Popen(*popenargs, **kwargs) as p:
     File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
       restore_signals, start_new_session)
     File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
       raise child_exception_type(errno_num, err_msg, err_filename)
   FileNotFoundError: [Errno 2] No such file or directory: 'python': 'python'
   ```
   
   So now I've changed the tools/marvin/mvn-setup.py to python3 (line 45 in my 
version):
   
   `43 def runSetupScript(args):
   44     """Invoke setup.py with the provided arguments"""
   45     cmd = ['python3', setupScript] + args
   46     exitCode = subprocess.call(cmd)
   47     return exitCode
   48
   `
   I will update with what comes after this change. Each run takes almost 30 
minutes so I can't update frequently enough.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to