I made a test class in my android project to check if my database works. But when I want to debug this class it gives me an error: "Cannot connect to VM", in details it says also "Socket operation on nonsocket: configureBlocking". When I try debugging a test class in another project it works and debugging my other classes in the android project also works. Can the problem be that I try to run a normal test on an android project?
Can someone help me? Thanks!
Shut down your virtual machine. In Workstation, go to VM > Settings > Network Adapter. Ensure that the network adapter is connected (that is, the Connected and Connect at power on options are selected). Ensure that the network adapter is configured for NAT or Bridged, and not Host-Only.
Connect to the virtual machineSelect the virtual machine from the list. At the beginning of the virtual machine page, select Connect. On the Connect to virtual machine page, select RDP, and then select the appropriate IP address and Port number. In most cases, the default IP address and port should be used.
Just restart the Java application in debug mode. One of the human error which causes "Failed to connect to remote VM. Connection refused". Some time typo on hostname or port causes Eclipse trying to connect different servers or a different port, which is an obvious reason you get this error.
You probably figured this out already, but for others who get stuck in this situation, here is my answer. I've had this problem a couple of times myself now, and I finally found out that it's related to
including a "main" method in your android class files: Don't do it!
Run Configuration in Eclipse: Delete the automatically created application configurations
The following link provides a very good explanation about the problem, the solution, and the reasons: http://independentlyemployed.co.uk/2010/11/16/solved-internal-error-classfileparser-cpp3161/
It caused by having a "main" method.
Delete/rename the method and then go to the properties of the project.
Click "Run/Debug Settings" and delete the class (it may make eclipse to run the class after being compiled).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With