Re: Exception message from java: MathLink connection was lost.
- To: mathgroup at smc.vnet.net
- Subject: [mg107331] Re: Exception message from java: MathLink connection was lost.
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Tue, 9 Feb 2010 02:46:46 -0500 (EST)
- References: <firstname.lastname@example.org>
Andrey wrote: > Hello, > > I wrote a java program (which runs some calculation on math kernel) > with JLink interface but it crashes regularly and randomly with the > exception: > "Exception message: MathLink connection was lost. > Exception class: com.wolfram.jlink.MathLinkException > Exception cause: null". > > My system: winXP(prof), Mathematica 7.0.1. > > I decided that the problem is with JLinkNativeLibrary.dll (which loads > during JLink load) and I recompile it for my machine (the only > warnings were the followings: > "JLinkNativeLibrary.c: In function > `Java_com_wolfram_jlink_NativeLink_getNativeWindowHandle': > JLinkNativeLibrary.c:1910: warning: cast from pointer to integer of > different size > JLinkNativeLibrary.c: In function > `Java_com_wolfram_jlink_NativeLink_appToFront': > JLinkNativeLibrary.c:1960: warning: cast to pointer from integer of > different size > ...\MINGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: > warning: cannot find entry symbol _DllMainCRTStartup@12; defaulting to > 6bf81000"). > But problem remains. > Then I tried to recompile the JLink.jar (and after that recompile > JLinkNativeLibrary.dll again) with no success. > > Did anybody meet such the problem? > > Or could anybody suggest anything or help? > > > Regards, > > -Andrey > > > I use J/Link a lot, and I have not encountered this problem. The most likely explanation, I think, is that your Java program breaks in some catastrophic way or loops indefinitely. If it is feasible, I would try compiling your Java code with a main method and try to test it as a free-standing Java program. I would also re-install the DLL files from the Mathematica installation disk, just in case your recompilation introduced any further issues. David Bailey http://www.dbaileyconsultancy.co.uk