mikelangelo-project / capstan-packages

Docker container that builds OSv from source and recompiles all Capstan packages it has recipe for.
Other
2 stars 3 forks source link

unable to compose /build image file #14

Open pritip123 opened 6 years ago

pritip123 commented 6 years ago

I trying to do capstan build for a Maven project in EC2 but while composing the image file I am getting the below error . I have followed the below steps wget -O - https://raw.githubusercontent.com/mikelangelo-project/capstan/master/scripts/download | bash capstan pull mike/osv-loader

Can you please help me . Resolved runtime into: java Prepending 'java' runtime dependencies to dep list: [eu.mikelangelo-project.osv.java] package eu.mikelangelo-project.osv.java is not available in the given repository (https://mikelangelo-capstan.s3.amazonaws.com/)

miha-plesko commented 6 years ago

@pritip123 problem is that the precompiled Capstan that scripts/download fetched you is not up-to-date. Could you please try to build the latest master?

Alternatively, you can download it from here: http://x.k00.fr/1yosr (compiled latest master). Thanks for reporting the issue, I'll update the scripts/download script soon.

pritip123 commented 6 years ago

Hi miha-plesko , Thanks for replying , I tried building it again using : wget -O - https://raw.githubusercontent.com/mikelangelo-project/capstan/master/scripts/download | bash capstan pull mike/osv-loader

but still the error is coming can you please give the master link you are talking or updated.

miha-plesko commented 6 years ago

Hello @pritip123, could you please try to download the Capstan binary like this:

curl "https://xlab.koofr.net/content/links/4e9a3f4e-adbb-4c82-b199-ab68b8d39e32/files/get/capstan?path=" > $HOME/bin/capstan

Then it should work.

pritip123 commented 6 years ago

Thanks a lot miha-plesko its working now . But do you have any idea why capstan image file its not able to get AwsSdkMetrics.java class though i have added the dependency .Its running well without capstan build but a capstan build image is giving below exception while execution . java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27) at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:398) at com.amazonaws.metrics.AwsSdkMetrics.(AwsSdkMetrics.java:359) at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.(AmazonDynamoDBClient.java:76)

miha-plesko commented 6 years ago

Just to double-check:

I'm asking because we've updated Capstan since you've reported this issue so that it now automatically runs the .jar properly.

If you provide some more information (say content of your meta/run.yaml and command that you use to run the Java application on your machine) we could probably be of some more help.

pritip123 commented 6 years ago

Hi miha , Thanks for helping out . Yes i have generated the jar file wth all dependencies but the problem what It seems is that during capstan build its taking JRE instead of JDK and that might be causing the error .after trying to resolve the above exception now I got the following exception during the runtime java.lang.NoClassDefFoundError: java/lang/management/ManagementFactory at com.amazonaws.jmx.MBeans.getMBeanServer(MBeans.java:114) at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:50) at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27) at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:398) at com.amazonaws.metrics.AwsSdkMetrics.(AwsSdkMetrics.java:359) at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.(AmazonDynamoDBClient.java:76)

I am using the following command to get the capstan image and the run.yaml is according to link given link sudo capstan package init --name test --title Test --author test sudo mvn clean install sudo capstan runtime init --runtime java sudo capstan package compose test sudo capstan run test

miha-plesko commented 6 years ago

@pritip123 could you please try to include this in your meta/package.yaml and then compose the unikernel:

# meta/package.yaml

name: demo
title: demo
author: demo
require:
  - openjdk8-zulu-compact3-with-java-beans # <---------------------- this

By default the runtime: java requires openjdk8-zulu-compact1, but you seem to be needing java beans as well. Looking forward to be hearing whether this resolved the issue.

pritip123 commented 6 years ago

Hi miha , Thanks , Its working now but I came across with new exception

Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959)

gasper-vrhovsek commented 6 years ago

Hi @pritip123 ,

i think you just encountered this: https://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty

Quoted from the stackoverflow:

ca-certificates-java is not a dependency in the Oracle JDK/JRE so this must be explicitly installed

ukeshkumar commented 6 years ago

Hi Miha Pleško,

Regarding above SSLException, I am using 'openjdk8-zulu-compact3-with-java-beans' package for my java application and Capstan binary, packages & repositories as below, http://x.k00.fr/0xmx0 | password: 120344 -> this is the latest Capstan packages & repository. http://x.k00.fr/3ub70 ->this is the latest Capstan binary that I've used (development branch)

capstan runtime list RUNTIME DESCRIPTION DEPENDENCIES
native Run arbitrary command inside OSv [] node Run JavaScript NodeJS 4.4.5 application [node-4.4.5 ] java Run Java application [openjdk8-zulu-compact1]

I have done the followings and the issue got resolved.

Added aws certificate to cacerts file in the below path, etc/pki/ca-trust/extracted/java/cacerts of the application directory.

Added cacerts link file (by default it is not available) ./usr/lib/jvm/java/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts

After adding the above two changes, I am not getting SSLException. Want to know is this the correct way or any other better way available ?

Thanks, Ukesh

ukeshkumar commented 6 years ago

Found the root-cause, /usr/lib/jvm/java/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts

The above link file is not available in 'openjdk8-zulu-compact1' package.

Could you suggest / share the stable release files which we can use ?

Thanks for your support..

miha-plesko commented 6 years ago

Hi, sorry for delayed response - did you manage to resolve the issue? If not, could you please try to use openjdk8-zulu-compact3-with-java-beans package instead of openjdk8-zulu-compact1? There should be some more files in there, not sure if this one among them.