This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How do I create a COM+ object with Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How do I create a COM+ object with Java?" Watch "How do I create a COM+ object with Java?" New topic
Author

How do I create a COM+ object with Java?

Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
I currently have an application which was originally written in Visual Basic using COM+. Eventually I will replace the application with a pure Java solution but for now I want to extend the application using Java and use the Java code as a COM+ object. I stumbled across the Sun ActiveX Bridge, however it did not provide example code on how to communicate between the various Java/COM objects that I will have.

For example I have an ASP page which calls a COM object, the COM object needs to communicate to another COM object how do I do that? The ActiveX Bridge Developer Guide basically states that I write a Javabean, then I jar the bean files and run packager.exe (part of the Sun JRE) to generate a DLL. Then it states that I place the DLL in a directory (for instance; COM_Bean\bin) and place the jar file into another directory (for instance; COM_Bean\lib) and register the DLL.

Can anyone help?
Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
I have seen lots of examples on how to invoke COM objects from within Java and know that some vendors such as BEA have tools that support using COM objects in a Java environment. I want to be able to utilize my investment in the Java components to add functionality to a legacy COM+ application while I redesign the application.

Current configuration:
Windows 2000
256 Meg RAM
AMD 600Mhz processor
Oracle 8i database
IIS 5.0
JRE 1.4.2_07
IE 6.0
11 COM components
ODBC

Future Configuration:
Lindows
256 Meg RAM
AMD 600 Mhz processor
Oracle 8i database
JDBC
Tomcat
Netscape 7.2
JRE 1.4.2_07
J2EE
25 Javabeans (most likely will be EJBs)

I would appreciate any explanation on how to make my Java class files run as COM+ components would be helpful. I have heard of several tools to do this, however most of them were designed to run COM components in Java applications and not the other way around. JIntegra looks like it might be useful, however for my current needs it is not a cost effective solution.

SOMEBODY PLEASE HELP!!!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Google for Java Com Bridge. There are a handful of expensive commercial solutions and a few open source and free ones. If you have the C++ chops you might want to make your own object-specific JNI interface.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
I have looked at many of the so-called Java-COM bridges, and most of them are too expensive for the need (who can afford to spend $2000 (server license) for something that will only be needed for 6 months), do not perform in the manner I need (many are designed to allow COM objects to run in a Java container, I need to run Java objects in a COM+ environment), or they are really Java-to-Socket layers that require you to write a COM-to-Socket object to communicate.

COM+ is supposed to be language independent, however the only Java version that works with COM as far as I can tell is the Microsoft version & VM. I do not use Visual J++, nor do I wish to try to purchase a copy since Microsoft no longer supports it (which means getting them to answer any questions is impossible).

I have experience in writing JNI, I wrote a tool four years ago called JNIBuilder that would create Java/JNI code and create the C++ headers but that does not solve the problem as I would still have to write additional support code.

As I have stated I already have Java code (Javabeans) that already have the functionality that I need to add to my existing COM-based application. The objective is to be able to take the code and generate the TLB and DLL files from the Java code and get them to be able to communicate with the existing COM objects in the appropriate context. The Sun website referenced an ActiveX Bridge, but the documentation did not go into enough detail and when I followed the instructions, several of the COM object properties were not registered (such as MTS enabled, MultiUse, and Multi-Threaded Apartment). Even when I modified the registry entries with those properties I was unable to get the functionality to work. It is my understanding that the ActiveX Bridge was designed for what I am attempting to do, but I am unable to utilize it properly for eny true interfaces (I was able to get the HelloWorld example to work, but not able to get my credit-check code to work). The credit-check Javabean works fine in my Java application and in my JSP/Servlet application so I know the problem is not the Java code.

The way that particular module works is I call the credit check interface with the SSN, FirstName, Lastname and several other parameters and it calls a Web Service to communicate the data to the appropriate Credit Bureau Service, the interface will return an CreditScore object that gets passed back to the UI informing the user of the credit score.

From what I can tell, my ASP pages make the COM+ calls but I do not seem to get any interaction with the Java code. The process times out and the Java code did not log anything. I can take the same Java code and call it directly through a JSP page and I receive the credit score as well as the logging of each interaction.
Tim Struppi
Greenhorn

Joined: Aug 25, 2004
Posts: 5
Hi,

very intresting your writing, but I'm new at this area and can't help you at the moment.
May be that you can give me a short tip for my problem:
I have a java and a VB6 Program. The VB should invoke functions of Java and the other way round.
I have both Sourcecodes.

Is this possible and what would be a good solution for this.
(With JavaBeans or COM+ or CORBA...??)
Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
I have a java and a VB6 Program. The VB should invoke functions of Java and the other way round. I have both Sourcecodes.
Is this possible and what would be a good solution for this.
(With JavaBeans or COM+ or CORBA...??)


Most of the tools that I have run into allow COM objects to run within the Java Application Server. I personally try to stay away from CORBA, early versions of CORBA between different languages were not always compatible and made communication unreliable. I tend to prefer using serial connections or Web services when communicating between unlike languages, but both of those add the overhead of parsing the message before processing it.
Tim Struppi
Greenhorn

Joined: Aug 25, 2004
Posts: 5
You mean that I should use something like SOAP?
Is this the easiest way also when both programs runs at the same time on the same mashine?
The performance is no problem because I send only some data (maybe 500 Byte) and want to start methods.
Have I a security problem using SOAP?
Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
Originally posted by Tim Struppi:
You mean that I should use something like SOAP?
Is this the easiest way also when both programs runs at the same time on the same mashine?
The performance is no problem because I send only some data (maybe 500 Byte) and want to start methods.
Have I a security problem using SOAP?


I mean that I prefer to use SOAP or a custom serial interface. You should not have a security problem with SOAP on the same system, and if you were using SOAP between multiple systems I would encrypt the data.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

I have used JACOB for simple Java-COM but I don't know if it does what you want. It must be worth a look.

http://danadler.com/jacob/


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
 
wood burning stoves
 
subject: How do I create a COM+ object with Java?
 
Similar Threads
Calling ActiveX OCX from Java
Question on creating dll
ActiveX in a Java application
Activex controls with Java
Callig Java Methods from Visual Basic