Java and COM Interop on Windows 2003 Server

Did you know that Java does COM Interop? Well using the MSJVM it can. Recently I deployed a project where a .Net Windows Service uses an externally supplied Java COM dll + associated jar file to communicate with IBM MQ. This is wonderful; Microsoft, Sun and IBM technologies playing together – a beautiful Interop example.

After several mock deployments to ensure no hiccups, go-live day arrived and it was a little shocking to notice the client’s machine was 2003 Server. All testing was done on Windows 2000!

You have guessed it already. The install did not take the expected 20 minutes, giving an error similar to this:



  COM object with CLSID {……} is either not valid or not registered


Unflustered, regsvr32.exe was used to manually install the dll – it was no help. Searching the registry proved the COM dll was registered. Thoughts of an all nighter then set in. Unfortunately the original developer abandoned this code two weeks before go-live, so I was mostly in the dark about how the software worked. Luckily I remembered that it used some Java, and I once read an MSDN Article discussing the end of the MSJVM.

Due to legal issues Microsoft no longer distributes the MSJVM, but ships Sun’s own JVM with Windows 2003 Server. Unsurprisingly Sun’s JVM does not do COM interop. This is all fair-enough but:


1. The original error message was very misleading

2. Finding a copy of the MSJVM was not easy


If Microsoft or Sun really are concerned about interop both of these would be non-issues. The error message would have said ‘Installed JVM cannot perform COM Interop, you should use the Microsoft JVM’ + the MSJVM would be on Microsoft’s AND Sun’s JVM download page instead of neither. I thought the whole point of publicly swapping smelly sports jerseys was to show they understood the industry’s frustration with Interop issues?



Conclusion:
Interop is fraught with gotchas. Interop is unlikely to be well tested or well supported by vendors. Well known names like Ted Neward tell us to communicate through common and solid technologies such as databases, or even the file system when possible. I concur, even for message queuing I shun technologies like MSMQ if possible and queue to a database table. When Window Server 2006 arrives the table based solution will still work, who knows what will break in MSMQ or even if MSMQ will be there then because of Indigo.

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Java and COM Interop on Windows 2003 Server

  1. Ryan says:

    What a nightmare. I’ve never had to make different systems talk to each other on the same machine, but worked with a client to make programatic interfaces. We made the poor choice to use stored procedures as the communication means, which should hopefully be replaced with web services soon. Web services are easy as anything, but I don’t know if that would be practical for two programs communicating on the same box.

  2. Pooh Bear says:

    Bah Humbug

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s