Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Java Chaincode remote debug #47

Description

@bendre

I am looking for Java chaincode remote debugging setup/configuration
Expectation:

  1. Able to do hit breakpoint/ line debug java chaincode on my local machine.
  2. connect local code to remote chaincode via 'java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000'

Environment:

  1. Fabric networking running on local machine via docker compose (Fabcar) network
  2. Two Peer / each Org (Two Org), raft ordered, cli, couchdb
  3. Java chaincode deployment on peer.
  4. Able to call query on chaindode

Configuration:

  1. Peer compose yaml property set to : 'command: peer node start --peer-chaincodedev=true'
  2. Peer compose yaml property set to: CORE_CHAINCODE_LOGGING_LEVEL=DEBUG

Observation: on chaincode container 'dev-peer0.org1.example.com-fabcarv1-99a85fb372cb80ca5efcc11f7dc3debe3bcec4fd8b22b81cae9273ca43332265'
Files under location: /root/chaincode-java

  1. build.sh chaincode lib start
  2. Below is the script in above mentioned 'start' script
    #!/usr/bin/env bash
    set -ex

ROOT_DIR=/root/chaincode-java
LIB_DIR=${ROOT_DIR}/lib
CHAINCODE_DIR=${ROOT_DIR}/chaincode
LIB_JARS=$(find ${LIB_DIR} -name ".jar" | paste -s -d ":" -)
CHAINCODE_JARS=$(find ${CHAINCODE_DIR} -name "
.jar" | paste -s -d ":" -)
NUM_CHAINCODE_JARS=$(find ${CHAINCODE_DIR} -name "*.jar" | wc -l)

if [ -f ${CHAINCODE_DIR}/.uberjar ]; then
if [ ${NUM_CHAINCODE_JARS} -ne 1 ]; then
>&2 echo "Cannot start uber JAR as more than one JAR file was found in the chaincode directory"
exit 255
fi
exec java -jar ${CHAINCODE_JARS} "$@"
else
exec java -cp ${CHAINCODE_JARS}:${LIB_JARS} org.hyperledger.fabric.contract.ContractRouter "$@"
fi

How to perform the below steps:

  1. how to add jvm argument xdebug in start scrip? so that it will open debug port

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions