Getting 'shmemBase_attach failed: The system cannot find the file specified' when trying to attach to applet to debug
Asked Answered
F

2

8

I'm using netbeans 6.1.

I've got the following in my java run time settings:

-agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=n

and the following in the attach dialog in netbeans:

Debugger: JPDA Debugger

Connector: Shared Memory Attach (Attaches by shared memory to other VMs)

Transport: dt_shmem

Name: jdbconn

I got the above settings from the FaqDebuggingAppletRemotely page on the netbeans Wiki.

The applet is in an aspx page (the applet, whcih is signed, is a method of communicating via the client browser to a legacy platform, I'm a C# developer really). I've managed to get the security warning to display which gives me a chance to attach to the applet but whenever I try to attach I see:

Attaching to jdbconn

shmemBase_attach failed: The system cannot find the file specified

in the output window in netbeans.

Any help gratefully received!

Freehold answered 21/3, 2011 at 15:48 Comment(0)
H
1

I would bet anything (almost anything ... maybe a few dollars at least, or a cookie) that the JVM installation your applets are running on is NOT the same as the default JVM installation that is installed on your system.

To find the JVM installation that your browser and applets are using in Windows 7:

1) Close all applications that use the JVM (especially the browser).

2) Open the windows task manager (CTRL+ALT+DELETE->Task Manager), and click on the processes tab.

3) Make sure there are not any java*.exe processes running.

4) Open your browser and go to the applets page, and start the applet up again.

5) Now go back to the Task Manager->Processes tab and look for the java*.exe that is now running (it will most likely be "java.exe *32" literally, as in it will literally have an asteriks in the name of the process. If you don't see that one, then just use whichever one IS running).

6) Right click on that process, and in the context menu select "Open File Location". This should bring you to the "bin" folder location of the installed JVM that your browser is using to run your applets! Are you surprised that it is not the same as what you thought it would be?

To find the task on linux or other systems:

I've only ever had this problem on Windows, but here's how you do it anyhow.

Open a shell, and type the following

ps -e | grep java

And make a note of the pid(s).

Now that you know which JVM your applets are using:

We need to open the Java Console for that partivular installation (as opposed to the default installation we tried to modify before).

To open the Console of the JVM installation that your applets are using, and set the runtime parameters:

1)Open a command prompt (shell or whatever) in the bin folder of the JVM installation. (In windows 7, from the explorer, you can shift+right-click on the bin folder, and select "Open Command Prompt Here").

2) Run the following command to open the console:

    javaws -viewer

This also ends up opening the "Java Cache Viewer" window, which we do not need. Close that window, but keep the "Java Control Panel" window open.

3) You can now go to the Java tab, click on view, and modify the runtime parameters just as you did before:

    -agentlib:jdwp=transport=dt_shmem,address=jdbconn,server=y,suspend=n

4) Click "OK", and then click "Apply" in the main java console window to apply and save all the changes you made.

5) WAIT! There is one last thing that I suggest you do; clear out the java WebStart cache to make sure your applets download fresh using the new parameters:

    javaws -uninstall

Be sure and run this in the bin directory of the JVM installation that your applets are using, since this might not be the same bin directory that is pointed to by your Path (or PATH) system environment variable.

Now start up your applet from your browser, and create another shared memory connection inside your NetBeans IDE! Setup break points in the correct source code you are debugging ("source" tab in NetBeans), and start using your applet. You should now see that Netbeans is breaking on your break points!

At least, I hope so...

Homozygote answered 13/3, 2013 at 20:48 Comment(0)
G
0

When you debug with the shared memory option (transport=dt_shmem), you're using Windows internal shared memory objects to communicate between the debugger and the jvm.

This means that if you're:

a. Not debugging from the same physical machine as your jvm, or

b. Not working on a Windows OS,

You can not debug in this mode.

I'm not sure what would happen if you ran a Window on a VM on a Linux station...Might work and might not.

If both of the above are fine, it would require a deeper investigation to find out the problem, but in the mean time, you could attach with a plain socket.

In the Java run time parameters specify:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y

This tells your jvm to run in debug mode, load the jdwp library, wait for connection to attach in port 8000, and suspend execution until such a connection arrives.

In your IDE set the remote debugger accordingly. I don't know Netbeans, but it would be something like Connector = socket connector, address=8000. When you start your web page, the applet will freeze loading until you connect, and of course you can't connect until it has reached the listening stage.

Good luck!

Globin answered 11/1, 2012 at 8:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.