Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building joynr Java failed #18

Open
Mandhata121 opened this issue Feb 16, 2018 · 8 comments
Open

Building joynr Java failed #18

Mandhata121 opened this issue Feb 16, 2018 · 8 comments

Comments

@Mandhata121
Copy link

Mandhata121 commented Feb 16, 2018

For me # ./joynr-docker build working fine and when i trying to run the following command
docker run --rm --sig-proxy -e DEV_UID="$(id -u)"
-v <FULL_PATH_TO_JOYNR_SOURCES>:/data/src
-v <FULL_PATH_TO_MAVEN_DIRECTORY>:/home/joynr/.m2 \
joynr-java
/data/src/docker/joynr-java/scripts/build/java-clean-build ,that time i am getting the error this type of error
ERROR:-
useradd: UID 0 is not unique
chown: invalid user: 'joynr:joynr'
error: failed switching to "joynr": get supplementary groups Unable to find user joynr

2.After removing the [ -e DEV_UID="$(id -u)" ] from the above command it is building, but after some time it is showing below error and same things repeated .
ERROR:-
[ERROR] io.joynr.messaging.mqtt.paho.client.MqttPahoClient: MQTT Connect failed. Error code 32103

Please give some suggestions on the above issue.
You can follow to this (link:-https://github.com/bmwcarit/joynr/blob/master/wiki/java_building_joynr.md)

@engineerPapa
Copy link

engineerPapa commented Feb 18, 2018

were you able to fix this issue?
i am also stuck at samee point

~Matthias

@Mandhata121
Copy link
Author

Mandhata121 commented Feb 19, 2018 via email

@rendner
Copy link

rendner commented Apr 9, 2018

I got the same error: [ERROR] io.joynr.messaging.mqtt.paho.client.MqttPahoClient: MQTT Connect failed. Error code 32103

I "solved" this by skipping the tests:

docker run --rm --sig-proxy -e DEV_UID="$(id -u)"
-v <FULL_PATH_TO_JOYNR_SOURCES>:/data/src
-v <FULL_PATH_TO_MAVEN_DIRECTORY>:/home/joynr/.m2 \
joynr-java
/data/src/docker/joynr-java/scripts/build/java-clean-build skipTests

@manuel-schiller
Copy link
Contributor

@Mandhata121 is this issue still valid?

@rendner
Copy link

rendner commented Aug 28, 2018

After updating to the latest source, the problem persists. The problem is located in the integration-tests module. If I exclude this module, the build succeeds.

@rendner
Copy link

rendner commented Aug 31, 2018

I took a deeper look into the problem.

(my) problem

The reason for my problems, e.g. Error 32103 which results in an endless loop, was that there is no mosquitto (MQTT server) or joynr backend-service running during the tests. I found the following description (javascript_testing) which explicit states that there are some prerequisites to get the tests work. If these dependencies to mosquitto and the joynr backend-services are really required, the documented example in Building joynr Java and common components can't work.

(my) solution

This is maybe not the right way to solve this problem but it works for me. I find it a litle bit strange to prebuild the "joynr backend-services" to make the whole build work.

  • create a file called java-clean-build-fixed inside the docker/joynr-java/scripts/build directory
  • paste the following code into it:
#!/bin/bash

source /data/scripts/global.sh

# fail on first error
# exit immediately if a command exits with a non-zero status
# print commands before they are executed
set -e

function usage
{
  echo "usage: java-clean-build-fixed [skipTests]"
}

SKIPTESTS="false"

while [ "$1" != "" ]; do
  case $1 in
    skipTests )             SKIPTESTS="true"
                            ;;
    * )                     usage
                            exit 1
  esac
  shift
done


if [ "$SKIPTESTS" == "false" ]
then

    (
      # prebuild required dependencies
      log "prebuild joynr tools"
      mvn clean install \
        -f /data/src/tools/pom.xml \
        -P no-tests,no-license-and-notice,no-java-formatter,no-checkstyle
      log "prebuild joynr basemodel"  
      mvn clean install \
        -f /data/src/basemodel/pom.xml \
        -P no-tests,no-license-and-notice,no-java-formatter,no-checkstyle
      log "prebuild joynr backend-services"  
      mvn clean install \
        -f /data/src/java/backend-services/pom.xml \
        -P no-tests,no-license-and-notice,no-java-formatter,no-checkstyle
    )

    log "start services"
    mosquitto -c /etc/mosquitto/mosquitto.conf -v &
    MOSQUITTO_PID=$!

    DISCOVERY_DIRECTORY_WAR_FILE=$(find /data/src/java/backend-services/discovery-directory-jee/target -iregex ".*discovery-directory-jee-.*war")
    ACCESS_CTRL_WAR_FILE=$(find /data/src/java/backend-services/domain-access-controller-jee/target -iregex ".*domain-access-controller-jee-.*war")
    /data/scripts/start-payara.sh -w $DISCOVERY_DIRECTORY_WAR_FILE,$ACCESS_CTRL_WAR_FILE
fi

(
    log "build joynr Java" (copied from 'java-clean-build')
    mvn clean install \
      -f /data/src/pom.xml \
      -P no-license-and-notice,no-java-formatter,no-checkstyle \
      -Denforcer.skip=true \
      -Dmaven.compile.fork=true \
      -DskipTests=$SKIPTESTS \
      -Dmaven.junit.fork=true \
      -Dmaven.test.failure.ignore=true
)


if [ "$SKIPTESTS" == "false" ]
then
    log "stop services"
    /data/scripts/stop-payara.sh

    kill -TERM $MOSQUITTO_PID
    wait $MOSQUITTO_PID
fi
  • make the file executable (chmod +x java-clean-build-fixed)
  • use the following code to build the joynr java api:
docker run --rm --sig-proxy -e DEV_UID="$(id -u)"  \
    -v <FULL_PATH_TO_JOYNR_SOURCES>:/data/src \
    -v <FULL_PATH_TO_MAVEN_DIRECTORY>:/home/joynr/.m2 \
    joynr-java \
    /data/src/docker/joynr-java/scripts/build/java-clean-build-fixed

@rendner
Copy link

rendner commented Oct 5, 2018

These changes fix the problem with the infinite loop during the tests. Building joynr Java is now possible again, at least for me.

@ostkamp
Copy link
Contributor

ostkamp commented Sep 22, 2022

Today the container to be used is joynr-base as described on https://github.com/bmwcarit/joynr/blob/master/wiki/java_building_joynr.md.
For just building use the skipTests option as now documented.
For full tests use https://github.com/bmwcarit/joynr/blob/master/docker/joynr-base/scripts/ci/java-android-clean-build which also creates certs and invokes mosquitto and the required backend service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants