Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 314
Weevie Avatar asked Mar 21 '11 15:03

Weevie


1 Answers

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...

like image 165
Pytry Avatar answered Nov 15 '22 00:11

Pytry