JNI function not getting invoked - c++

I need to debug JNI issue of a team member. The problem is in a Java app interfacing a USB connected hardware using JNI. He mentions that JNI functions implemented in a C++ dll are not getting called by Java app. Also he specifically mentioned that it is a not an unsatisified link error problem, which was the first thing I would suspect.
The strange thing is that the Java App works fine on his development system and the JNI calls are being made properly. However on the target machine of the QA team, the Java app does not seem to work.
The DLL (32-bit) was generated using VS2010 and the target machine was WinXP/Win 7 32-bit system. I would rule out DLL method signature issue since DLL was recognised on the development system. As mentioned, it was not link issue.
What could be the issue in JNI methods not getting invoked at all? Could this be a problem with redistributables? How to debug (using JVM options) and ascertain the problem?

Standard debugging procedure:
set breakpoint in Java
run to breakpoint
attach debugger to java executable (visual studio attach by process ID)
set breakpoint in JNI.
continue Java program.

Related

JNI c++ Netbeans Debugging

I have a java application that communicates with JNI C++ application. My java application is in eclipse while I am using netbeans for C++ with mingw64 bit compiler. I can not seem to debug JNI part of the application.
I load dll in java application. From netbeans I go to Debug->Attach Debugger select javaw.exe that makes my eclipse stuck and I get exception in eclipse IDE:
org.eclipse.jdi.TimeoutException. Timeout occurred while waiting for packet. occurred creating step request
Is my debugging procedure correct? How does one configure netbeans to debug a JNI application.
This could be because your debugger is stopping all your threads when attaching, and not letting them resume properly afterwards (Not sure why this happens. It seems to only happen on some computers, and work fine on others).
A way to around this that worked for me is - In your C++ debugger configurations, in the debugger tab, tick the "Non-stop mode" checkbox. This will stop your debugger from stopping your threads, and the timeout should stop happening.

Problems with running the application using OpenSSL

Good day, colleagues. I'm building an application using OpenSSL - the application crashes with an error code: 0xc0000142.
The standard application openssl.exe also crashes with this error code. What could be the trouble?
According to Microsoft Support in KB 2701373:
This issue is caused by an error in the
Microsoft.powershell.consolehost.dll file. When a Windows PowerShell
script calls the Console.Write method, or when you run an executable
file for an application from a Windows PowerShell session, values are
written into the PowerShell console. Additionally, a corresponding
console handle is created. When many console handles are created, the
console handles leak, and the issue that is described in the
"Symptoms" section occurs.
There's also a question in the Microsoft Communities, CMD.EXE error 0xc0000142, and the answer appear to be "reinstall your application".
I'm not sure how MinGW affects the problem. Since MinGW is abandoned, I'm guessing its the problem and you likely won't be able to fix it. Its probably providing an old, buggy version of something with ABI problems.
Maybe you can use Cygwin for Linux on Windows. Cygwin is still actively developed and maintained.

Using c++ dll in asp.net - Exception:Could not load file or assembly

I am using a already developed C++ dll in my asp.net code to make compression/decompression of the data. It works well on my developer machine and some other machines too. I have a client machine which is fresh(No fancy installation of various tools) and When it tries to call that dll it generates an exception.
Exception:Could not load file or assembly 'dllcode, Version=1.0.5754.25819, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I would like to know that which dependencies are missing on Client fresh machine?
Note: I am trying to call C++ dll in a windows service which is having asp.net 4.0 framework. This call is executing perfectly on my developer machine but generates above exception on my client machine.I do not have deep knowledge about c++ library and it's dll. From basic troubleshooting I tried to install various combinations of "microsoft visual c++ 2010 runtime" but it did not help.
Update: Somehow I find source code of this C++ dll and now I am trying to check if I can build this dll any version specific.
I got this resolved. What I did is, I had to create separate setups(32-Bit & 64-Bit). Also VC++ run time was needed on server. So I installed them and it worked.
Hope this help to any one if he faces the same issue.

Deployed C++ AMP application stops responding

Im trying to deploy a C++ AMP application to another Windows 7 machine.
I have tried to include the vcamp110.dll in the same folder, and also compiled with /MT do get rid of dependency on msvcp110.dll and msvcr110.dll.
Also tried both x64 and win32 release of the application.
On the computers i have tried it on whitout VS11 installed, the program stops responding.
I tried to do a simple test with the hello world application and i have the same problems there.
The files can be downloaded from here http://www.2shared.com/file/IofZlrJs/amptest.html (source, binary and the dll).
Any suggestions to how this can be fixed?
Deployments like the one you tried are definitely supported – full details here:
http://blogs.msdn.com/b/nativeconcurrency/archive/2012/03/12/deploying-apps-built-with-c-amp.aspx
There are a few things you can do to diagnose the issue you are facing yourself:
The bitness of vcamp110.dll has to match the bitness of your app, so 32bit for one means 32bit for the other.
Ensure that there are no other instances of vcamp110.dll in some central location (e.g. system32)
Attach a debugger and see what DLLs are loaded and what exception gets thrown.
Most important of all, for all your apps, surround your parallel_for_each call with try…catch to see what runtime_exception you are getting. More on C++ AMP exceptions can be found here: http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/01/c-amp-runtime-exceptions.aspx
For the specific repro you shared, we tried that under the debugger on a clean Windows 7 machine and indeed a rutime_exception is being thrown: “The binary for the parallel_for_each is incompatible with this version of runtime.”, which indicates a mismatched runtime version (either mixing bitness or mixing Developer Preview with Beta or something like that).

0xE0434F4D Error

all, I have a rather frustrating issue. The application in question has an MFC GUI that uses the classes available in the MFC Featurepack. This GUI uses an DLL that is developed in C++\CLI. Our company uses Cruise Control. NET (1.4.4 SP1) on Windows Server 2008 SP2 for continuous integration. Cruise Control is setup to use the version of MSBuild that comes with the 3.5 version on the framework.
The issue in question is that if I use the build that Cruise Controls creates, I receive the following error: "Unhandled exception at 0x7642fbae (kernel32.dll) in FormView.exe: 0xE0434F4D: 0xe0434f4d." After some digging, the issue seems to be that the GUI doesn't like the C++\CLI assembly.
The "gotcha" is that if I log on to the server, and, using PowerShell, execute the same MSBuild command, the build works. Any one have ideas?
The issue was how I was building the installer. It was a separate solution from the project's main solution, and was thus a separate task from the primary build. Therefore, the output assemblies got signed twice, and loader complained because the one the application wanted was no longer valid.
you could try and attach the process to the visual studio debugger.