[ https://issues.apache.org/jira/browse/NETBEANS-5949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470164#comment-17470164 ]
pat commented on NETBEANS-5949: ------------------------------- Joao, Here is my complete remote-platform-impl.xml so you can look at everything. I am using ssh with key key file rather than password to open the tunnel between the two hosts. So I am using the debug-remote-key rather than the debug-remote-password I set a breakpoint in my program and ran netstat on the remote host looking for the port on the command line. Here is the output. It looks like what you are describing. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Jan 6 08:17:13 2022 pi@raspberrypi:~ $ netstat -a | grep 62096 tcp 0 0 localhost:62096 0.0.0.0:* LISTEN tcp 0 0 localhost:62096 localhost:60420 ESTABLISHED tcp 0 0 localhost:60420 localhost:62096 ESTABLISHED tcp6 0 0 localhost:62096 [::]:* LISTEN pi@raspberrypi:~ $ Here is netstat on the remote host looking for connections to my development box. pi@raspberrypi:~ $ netstat -a | grep 192.168.1.7 tcp 0 0 192.168.1.34:ssh 192.168.1.7:62100 ESTABLISHED tcp 0 36 192.168.1.34:ssh 192.168.1.7:63911 ESTABLISHED tcp 0 0 192.168.1.34:ssh 192.168.1.7:62097 ESTABLISHED tcp 0 0 192.168.1.34:ssh 192.168.1.7:59179 ESTABLISHED pi@raspberrypi:~ $ <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project default="default" basedir=".." xmlns:remote="http://www.netbeans.org/ns/j2se-project/remote-platform/1" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3"> <target name="default"> <echo message="Default target is not set, you must specify which target you want to run."/> </target> <target name="-init-remote-platform-properties" depends="init"> <fail unless="platform.runtime">Runtime platform (platform.runtime) must be set.</fail> <j2seproject1:property name="remote.platform.home.dir" value="platforms.${platform.runtime}.platform.install.folder"/> <j2seproject1:property name="remote.platform.work.dir" value="platforms.${platform.runtime}.platform.work.folder"/> <j2seproject1:property name="remote.platform.host" value="platforms.${platform.runtime}.platform.host"/> <j2seproject1:property name="remote.platform.port" value="platforms.${platform.runtime}.platform.port"/> <j2seproject1:property name="remote.platform.user" value="platforms.${platform.runtime}.platform.auth.username"/> <j2seproject1:property name="remote.platform.auth" value="platforms.${platform.runtime}.platform.auth.kind"/> <j2seproject1:property name="remote.platform.keyfile" value="platforms.${platform.runtime}.platform.auth.keystore"/> <j2seproject1:property name="remote.platform.exec.decorator" value="platforms.${platform.runtime}.platform.exec.decorator"/> <fail unless="remote.platform.home.dir">Must set remote.platform.home.dir</fail> <fail unless="remote.platform.work.dir">Must set remote.platform.work.dir</fail> <fail unless="remote.platform.host">Must set remote.platform.host</fail> <fail unless="remote.platform.port">Must set remote.platform.port</fail> <fail unless="remote.platform.user">Must set remote.platform.user</fail> <fail unless="remote.platform.auth">Must set remote.platform.auth</fail> <condition property="remote.platform.auth.passwd"> <equals arg1="${remote.platform.auth}" arg2="PASSWORD"/> </condition> <condition property="remote.platform.auth.key"> <equals arg1="${remote.platform.auth}" arg2="KEY"/> </condition> <basename file="${basedir}" property="remote.project.name"/> <basename file="${dist.dir}" property="remote.dist.dir.name"/> <basename file="${dist.jar}" property="remote.dist.jar.name"/> <property name="remote.project.dir" value="${remote.platform.work.dir}/${remote.project.name}"/> <property name="remote.dist.dir" value="${remote.project.dir}/${remote.dist.dir.name}"/> <property name="remote.dist.jar" value="${remote.dist.dir}/${remote.dist.jar.name}"/> <property name="remote.java.executable" value="${remote.platform.home.dir}/bin/java"/> <scriptdef name="addressport" language="javascript"> <attribute name="address" /> <attribute name="property" /> <classpath path="antjars/bsf.jar"/> <classpath path="antjars/commons-logging-1.2.jar"/> <classpath path="antjars/org.mozilla.javascript-1.7.2.jar"/> <![CDATA[ var address = attributes.get("address"); project.setProperty(attributes.get("property"), address.split(":")[1]); ]]> </scriptdef> <condition property="remote.platform.exec.prefix" value="'${remote.platform.exec.decorator}' " else=""> <not> <equals arg1="${remote.platform.exec.decorator}" arg2="$${platforms.${platform.runtime}.platform.exec.decorator}"/> </not> </condition> </target> <target name="-copy-to-remote-platform"> <macrodef name="runwithpasswd" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1"> <attribute name="additionaljvmargs" default=""/> <sequential> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true" command="mkdir -p '${remote.dist.dir}'"/> <scp todir="${remote.platform.user}@${remote.platform.host}:${remote.dist.dir}" port="${remote.platform.port}" password="${remote.platform.password}" trust="true"> <fileset dir="${dist.dir}"/> </scp> <antcall target="profile-rp-calibrate-passwd"/> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true" usepty="true" command="cd '${remote.project.dir}'; ${remote.platform.exec.prefix}'${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${runtime.encoding} ${run.jvmargs} ${run.jvmargs.ide} -jar ${remote.dist.jar} ${application.args}"/> </sequential> </macrodef> <macrodef name="runwithkey" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1"> <attribute name="additionaljvmargs" default=""/> <sequential> <fail unless="remote.platform.keyfile">Must set remote.platform.keyfile</fail> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}" trust="true" command="mkdir -p '${remote.dist.dir}'"/> <scp todir="${remote.platform.user}@${remote.platform.host}:${remote.dist.dir}" port="${remote.platform.port}" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}" trust="true"> <fileset dir="${dist.dir}"/> </scp> <antcall target="profile-rp-calibrate-key"/> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}" trust="true" usepty="true" command="cd '${remote.project.dir}'; ${remote.platform.exec.prefix}'${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${runtime.encoding} ${run.jvmargs} ${run.jvmargs.ide} -jar ${remote.dist.jar} ${application.args}"/> </sequential> </macrodef> </target> <target name="-check-vm-debug" depends="init, -init-remote-platform-properties, -copy-to-remote-platform"> <j2seproject1:property name="remote.platform.jvm.debug" value="platforms.${platform.runtime}.platform.jvm.debug"/> <condition property="remote.platform.jvm.debug.available" value="true"> <or> <contains string="${remote.platform.jvm.debug}" substring="$${platforms."/> <istrue value="${remote.platform.jvm.debug}"/> </or> </condition> <fail unless="remote.platform.jvm.debug.available" message="The Runtime JVM ${remote.platform.host}:${remote.platform.home.dir} does not support debugging."/> </target> <target name="-ask-password" unless="remote.platform.password" if="remote.platform.auth.passwd"> <input message="Password ${remote.platform.user}@${remote.platform.host}:" addproperty="remote.platform.password"> <handler type="secure"/> </input> </target> <target name="-ask-passphrase" unless="remote.platform.passphrase" if="remote.platform.auth.key"> <input message="Passphrase ${remote.platform.user}@${remote.platform.host}:" addproperty="remote.platform.passphrase"> <handler type="secure"/> </input> </target> <target name="-run-remote-passwd" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -ask-password" if="remote.platform.auth.passwd"> <remote:runwithpasswd/> </target> <target name="-debug-remote-passwd" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -ask-password, -debug-start-debugger" if="remote.platform.auth.passwd"> <addressport address="${jpda.address}" property="jpda.port"/> <sshsession host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true"> <remotetunnel lport="${jpda.port}" lhost="localhost" rport="${jpda.port}"/> <sequential> <remote:runwithpasswd additionaljvmargs="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> </sequential> </sshsession> </target> <target name="-run-remote-key" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -ask-passphrase" if="remote.platform.auth.key"> <remote:runwithkey/> </target> <target name="-debug-remote-key" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -ask-passphrase, -debug-start-debugger" if="remote.platform.auth.key"> <addressport address="${jpda.address}" property="jpda.port"/> <sshsession host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}" trust="true"> <remotetunnel lport="${jpda.port}" lhost="localhost" rport="${jpda.port}"/> <sequential> <remote:runwithkey additionaljvmargs="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> </sequential> </sshsession> </target> <target name="profile-clean-rp" depends="profile-rp-renew-local-calibration" if="profiling.started"> <delete dir="${dist.dir}/remotepack"/> <delete file="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new"/> </target> <target name="profile-rp-renew-local-check"> <condition property="profiler.calibration.local-remote.replace"> <and> <available file="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new" type="file"/> <not> <filesmatch file1="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}" file2="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new"/> </not> </and> </condition> </target> <target name="profile-rp-renew-local-calibration" depends="profile-rp-renew-local-check" if="profiler.calibration.local-remote.replace"> <move file="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new" tofile="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}" force="true" verbose="true"/> </target> <target name="profile-rp-unzip" if="profiling.started" depends="profile-rp-create"> <unzip src="${java.io.tmpdir}/profiler-server-${remote.platform.rp.filename}.zip" dest="${dist.dir}/remotepack"/> <chmod perm="a+x"> <fileset dir="${dist.dir}/remotepack"> <include name="**/*.so"/> <include name="**/*.dll"/> <include name="**/*.sh"/> <include name="**/*.jnilib"/> <exclude name="**/*.jar"/> </fileset> </chmod> </target> <target name="profile-rp-create" if="profiling.started"> <property name="profile.cluster" value="${netbeans.home}/../profiler"/> <ant dir="${profile.cluster}/remote-pack-defs" target="profiler-server-${remote.platform.rp.target}" inheritall="false"> <property name="cluster" location="${profile.cluster}"/> <property name="dest.dir" location="${java.io.tmpdir}"/> </ant> </target> <target name="profile-toggle"> <property name="profiling.started" value="true"/> </target> <target name="profile-rp-calibrate-passwd" if="profiling.started"> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true" usepty="true" command="export JAVA_HOME=${remote.platform.home.dir}; [ -f ~/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver} ] && echo "Calibration data exists: skipping calibration" || /bin/sh ${remote.dist.dir}/remotepack/bin/calibrate.sh"/> <scp file="${remote.platform.user}:${remote.platform.password}@${remote.platform.host}:~/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}" localTofile="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new" trust="true"/> <antcall target="profile-clean-rp"/> </target> <target name="profile-rp-calibrate-key" if="profiling.started"> <fail unless="remote.platform.keyfile">Must set remote.platform.keyfile</fail> <sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}" trust="true" usepty="true" command="export JAVA_HOME=${remote.platform.home.dir}; [ -f ~/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver} ] && echo "Calibration data exists: skipping calibration" || /bin/sh ${remote.dist.dir}/remotepack/bin/calibrate.sh"/> <scp file="${remote.platform.user}:${remote.platform.password}@${remote.platform.host}:~/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}" localTofile="${user.home}/.nbprofiler/machinedata.jdk${remote.platform.java.spec.ver}.${remote.platform.host}.new" trust="true" keyfile="${remote.platform.keyfile}" passphrase="${remote.platform.passphrase}"/> <antcall target="profile-clean-rp"/> </target> <target name="run-remote" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -run-remote-passwd, -run-remote-key"/> <target name="debug-remote" depends="init, jar, -init-remote-platform-properties, -copy-to-remote-platform, -check-vm-debug, -debug-remote-passwd, -debug-remote-key"/> <target name="profile-remote" depends="init, jar, profile-toggle, -init-remote-platform-properties, profile-rp-unzip, -profile-check" if="profiler.configured"> <startprofiler/> <mkdir dir="${user.home}/.nbprofiler"/> <antcall target="-run-remote-passwd"/> <antcall target="-run-remote-key"/> </target> </project> > remote debugger does not work > ------------------------------ > > Key: NETBEANS-5949 > URL: https://issues.apache.org/jira/browse/NETBEANS-5949 > Project: NetBeans > Issue Type: Bug > Components: debugger - Java, projects - Ant > Affects Versions: 12.4 > Environment: Host is Windows 10, Netbeans 12.4 > Remote Host is raspberry pi with java 11.0.12. > Reporter: pat > Priority: Major > > Create a java application project. > Add this code to main and fix the imports > public static void main(String[] args) { > try { > InetAddress id = InetAddress.getLocalHost(); > System.out.println(id.getHostName()); > System.out.println("java version is " + > System.getProperty("java.version")); > System.out.println("VM is " + > > ManagementFactory.getRuntimeMXBean().getVmVersion()); > } catch (UnknownHostException ex) { > Logger.getLogger(HelloWorld.class.getName()).log(Level.SEVERE, > null, ex); > } > } > Run natively to verify you got it right. > Follow the instructions here to create a remote java standard edition > platform targeting a different Linux computer. My computer is a raspberry > pi with java 11 installed, Oracle Java SE 8 Embedded is no longer available > for most people but java 11 works fine. (The bug is independent of java > version on the target). > https://netbeans.apache.org/kb/docs/java/javase-embedded.html?print=yes > Select the remote platform you created and run the program. The output > should show that it ran on the remote host. > Now debug the program. I get the following error. > ant -f C:\\Users\\PATGI\\OneDrive\\Documents\\NetBeansProjects\\HelloWorld > -Dnb.internal.action.name=debug -Dremote.platform.passphrase=***** > -Dremote.platform.rp.target=linuxarm-15 > -Dremote.platform.rp.filename=linuxarm -Ddebug.class=helloworld.HelloWorld > -Dremote.platform.java.spec.ver=11 debug-remote > init: > deps-jar: > Updating property file: > C:\Users\PATGI\OneDrive\Documents\NetBeansProjects\HelloWorld\build\built-jar.properties > compile: > Copying 1 file to > C:\Users\PATGI\OneDrive\Documents\NetBeansProjects\HelloWorld\build > Nothing to copy. > To run this application from the command line without Ant, try: > java -jar > "C:\Users\PATGI\OneDrive\Documents\NetBeansProjects\HelloWorld\dist\HelloWorld.jar" > deploy: > jar: > C:\Users\PATGI\OneDrive\Documents\NetBeansProjects\HelloWorld\nbproject\remote-platform-impl.xml:143: > Unable to create javax script engine for javascript > BUILD FAILED (total time: 0 seconds) > I was able to for the debugger to work by manually starting the debugger on > the remote host with something like > /usr/bin/java > -agentlib:jdwp=transport=dt_socket,address=*:8000,suspend=y,server=y > -Dfile.encoding=UTF-8 -jar > /home/pi/NetBeansProjects/HelloWorld/dist/HelloWorld.jar > And then connect the debugger to a process already running on the remote host > at port 8000. > I traced this back to javascript not being supported in this installation of > Ant. I also think several of the configuration variables for remote > debugging are not setup. e.g. jdpa.address and jdpa.port but I could easily > be wrong about this. > The good news is it can be made to work and it is very nice when it is > working. -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists