If your application randomly fails because with this error:

  • java.net.SocketException: Software caused connection abort: recv failed

chances are reading this article will help you diagnosing and fixing it.If that’s not the case, i’m sure you’ll learn something useful. 

Advertisements

Probably you have a Java Application that uses jacob library to call a method inside a Windows COM object.

objActiveXComponent = new ActiveXComponent("randomCOMObjectName");
result = Dispatch.call(objActiveXComponent, "myMethod", input);

When executing the above code, you may run into this error:

com.jacob.com.ComFailException: Can’t co-create object
at com.jacob.com.Dispatch.createInstance(Native Method)

First, a little bit of theory.

Intro on COM objects

A COM object exposes a piece of functionality. For example if you want to manipulate Excel, there is a COM object that encapsulates all the methods needed to do pretty much anything you want (create charts, Pivot Tables, etc). Each COM object can be uniquely identified via a 128-bit number, e.g. {0EA22763-9933-11D0-A535-00C04AEV3F} called or CLSID ,or GUID

  • All objects available in your system can be seen using regedit.exe. Open it and go to HKEY_CLASSES_ROOT\CLSID.

Nobody wants to remember a 128 bit number, so an additional level of abstraction exists for identifying COM objects, called ProgID which is basically an alias.

  • The GUID – ProgID mapping is also stored in the Windows Registry. Open regedit and browse to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Application\CLSID  to view the CLSID of the COM object that allows you manipulating the Word application.

Functionality offered by a COM object is exposed through interfaces, which contain one or more methods. Each interface is uniquely identifiable via a CLSID as well.

  • For example, Excel.Application COM object exposes the Charts interface, which contains the Add method.

Object Browser in Visual Studio can be used for browsing the
COM objects and the interfaces exposed by them: Click on View->Object Browser.  From the Browse select list, choose Edit Custom Component Set Switch to the COM tab

Using a COM object

Before using a COM object, it must be registered to the system (e.g. it’s CLSID or ProgID must exist in Windows Registry). If it’s not registered, regasm.exe utility can be used to do that:

%systemroom%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe /verbose /nologo /codebase C:\temp\myCOMObject.dll

Once it’s registered  CoCreateInstance() API method can be used to obtain a reference to an interface exposed by the object and call its methods.

Troubleshooting the jacob error

Under the hood, jacob will do the following:

  1. Obtain the CLSID of the ProgId supplied in the ActiveXComponent constructor
  2. Call CoCreateInstance to get a reference to the object
  3. CoCreateInstance fails and the error is thrown back in Java.

Resolution

  1. Either your object is not registered (use RegAsm.exe to register it)
  2. Jacob attempts to get a reference to a 32 bit COM object from a 64 bit environment, e.g.  Java application running inside a JRE 64 (this was my case)
    1. Unregister the 32 bit version
      • %systemroom%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe /unregister C:\temp\myCOMObject.dll
    2. register again the object using the 64 bit version of regasm
      • %systemroom%\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe /verbose /nologo /codebase C:\temp\myCOMObject.dll

Having all this info, hopefully you can fix your applications as well. If you have found a different cause for this error, leave it in the comments and I’ll update the post.

UPDATE: Use OLE /COM Object viewer to manage COM objects registered in your system:


When integrating the PayPal API you might get the following error returned:

array(9) {
  ["TIMESTAMP"] => string(20) "2010-04-05T09:10:07Z"
  ["CORRELATIONID"] => string(12) "928a82db523e"
  ["ACK"] => string(7) "Failure"
  ["VERSION"] => string(2) "56"
  ["BUILD"] => string(7) "1236498"
  ["L_ERRORCODE0"] => string(5) "10002"
  ["L_SHORTMESSAGE0"] => string(14) "Security error"
  ["L_LONGMESSAGE0"] => string(28) "Security header is not valid"
  ["L_SEVERITYCODE0"] => string(5) "Error"
}

This might have two possible causes:

  1. you are using the wrong credentials (trying to connect to the Sandbox API URL using the Live credentials or vice versa)
  2. you are missing a & character in the NVP string, after the SIGNATURE, PWD or USER keys.

Piece a crap! I’ve spent half a day debugging this error..

So you are trying to convert some avi movies into flv and get rich with your video uploading website.. You’ve tested you upload video functionality and it works flawless, untill some guy comes and say: hey i’ve tried to upload this video and it didn’t work. You run to the Linux console do a log print and you receive this beautiful error:

FFmpeg version SVN-r10964, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-libmp3lame --enable-shared --prefix=/usr --enable-libogg --enable-libvorbis
libavutil version: 49.5.0
libavcodec version: 51.48.0
libavformat version: 51.18.0
built on Nov 8 2007 14:12:36, gcc: 4.1.1 20061011 (Red Hat 4.1.1-30)
Input #0, avi, from 'files/3635634.avi':
Duration: 00:00:18.1, start: 0.000000, bitrate: 660 kb/s
Stream #0.0: Video: mjpeg, yuvj422p, 320x240 [PAR 0:1 DAR 0:1], 15.00 fps(r)
Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, 88 kb/s
Output #0, flv, to 'files/3635634.flv':
Stream #0.0: Video: flv, yuv420p, 320x240 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 15.00 fps(c)
Stream #0.1: Audio: libmp3lame, 11024 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
[flv @ 0x7c77d0]removing common factors from framerate
Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

You run manually the command :

ffmpeg -y -i input_video.avi -f flv output_video.flv

...and the error doesn't dissapear

After googling around reading ffmpeg documentation i found the solution. You need to manually set the sampling frequency like this:

ffmpeg -y -i files/input_file.avi -ar 22050 -f flv files/output_file.flv

Later edit: Post has been updated . Thanks to Peter


This usually happens when you do a fresh install of your system and reinstall LAMP.. then you copy/paste your backup configuration files. If you use vhosts (virtual hosts) you may get this error in Event viewer.

It happens because apache tries to access a file in a folder which doesn’t exists. For example,i had setup a virtual host with a custom error log files in a new folder called _logs. After I copied the backup site in the new location I thought I don’t need anymore the old log files so I deleted the whole _logs directory. After a restart I noticed apache wasn’t starting anymore.


A “net headache” as the name implies is a condition of pain in the head resulted from an annoying error that you read on the computer monitor. This type of headache mostly installs when you do a thing 1000+ times and it worked perfectly and when you do it once more you are served with a stupid error.. You start cursing, your blood pressure increases, you start sweating and you wondering : where da fuck did that come from? At least, this has happened to me right now, after I installed the Apache web server a hundred times before and now it just won’t work..

The “net headache” is even more intense when you are a software engineer, have BS degree and everybody knows you as “the guy who knows computers well” and you have the idea the everything makes sense and there is not reason why it shouldn’t work

Unfortunately there is no pill for this kind of headache.. But there are some solutions. Here is what you can do:

  • shutdown the damn PC (usually by unplugging) and go to sleep – if you are a true computer addicted , you never do this
  • grab the monitor and smash it in a wall or something – if you are a true computer addicted, you must’ve done this at least once
  • do a career turn and start selling brownies

or you can read my blog and look here for solutions for your “net headaches”.