Java Chaincode remote debug
bendre opened this issue · 0 comments
I am looking for Java chaincode remote debugging setup/configuration
Expectation:
- Able to do hit breakpoint/ line debug java chaincode on my local machine.
- connect local code to remote chaincode via 'java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000'
Environment:
- Fabric networking running on local machine via docker compose (Fabcar) network
- Two Peer / each Org (Two Org), raft ordered, cli, couchdb
- Java chaincode deployment on peer.
- Able to call query on chaindode
Configuration:
- Peer compose yaml property set to : 'command: peer node start --peer-chaincodedev=true'
- 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
- build.sh chaincode lib start
- 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
else
exec java -cp
fi
How to perform the below steps:
- how to add jvm argument xdebug in start scrip? so that it will open debug port