Article ID: 173790 - Last Review: June 14, 2006 - Revision: 4.1 HOWTO: Using DllSurrogate Support for Java/DCOM ServersThis article was previously published under Q173790 On This PageSUMMARY This article explains how to use a Java COM object as a
Distributed COM (DCOM) server using the system surrogate provided by DCOM in
Microsoft Windows 95 and Microsoft Windows NT 4.0 with SP2 or SP3.
MORE INFORMATION DCOM allows COM objects to be activated on remote machines.
It allows clients to create and invoke the methods of objects on other
machines. Java objects can be used remotely using DCOM. One way to remotely use
a Java object is by using the system surrogate support (DllSurrogate) in DCOM
for Windows 95 and Window NT 4.0 with SP2 or SP3 along with the Microsoft
virtual machine (Microsoft VM). JAVAREG is a tool that supports remote access
to a COM class implemented in Java. It is a command-line tool that is used for
registering Java classes as COM components in the registry. In fact, many of
JAVAREG's options are intended for use only with DCOM. The JAVAREG version 1.0 that is included with Microsoft Visual J++ versions 1.0 and 1.1, implemented a surrogate process itself, but it had some bugs that make it difficult to set up Java DCOM servers and clients. For more information about this problem with DCOM in Windows 95, see the "References" section of this article. The DCOM support that is now in Windows 95 and Windows NT 4.0 with SP2 and SP3 supports a surrogate as part of the system, so the surrogate support with JAVAREG 1.0 has been dropped. JAVAREG 2.0 (and later versions) is a new tool that ships with SDK for Java 2.0 and later versions. This tool fixes the bugs that are associated with JAVAREG 1.0 and supports remote access to a Java COM object using the system provided surrogate process. The following steps explain how to set up a Java/COM object as a DCOM server using the new JavaReg2.0 tool. Server Side StepsThe following sample makes use of the AutoIDispatch mechanism where you do not need to create an IDL file for your Java COM object. This method does not require tools like JAVATLB or JACTIVEX that ship with the SDK for Java 2.0x. For more information on the use of the AutoIDispatch mechanism, see the REFERENCES section below.
Client Side Steps
Other TipsWhenever you attempt to get a DCOM solution to work, it is useful to know when processes are starting and stopping on a machine. One very effective way to do this is to enable the "Process Start" and "Process Stop" sounds in the Sounds Control Panel applet. With these sounds enabled (and set to two distinguishable noises), you will be able to tell whenever a process starts or stops on your machine. This is useful in tracking down problems where DCOM's launch security has allowed a client to launch the server process, but access security is disallowing access (you'll hear the process start sound, but the client will get E_ACCESSDENIED from the activation request). Of course, this requires that your server machine have a sound card installed with appropriate drivers.Use OLEVIEW to test that your components are installed and registered correctly. Always test new components first in-process (CLSCTX_INPROC_SERVER checked in OLEVIEW), then cross-process-same-machine (CSLCTX_LOCAL_SERVER), then remotely (CLSCTX_REMOTE_SERVER with no LocalServer32 key). By doing this you reduce the number of variables (things that can go wrong) as you do your testing. REFERENCES For more information about the new SDK for Java, visit the
following Microsoft Web site: http://www.microsoft.com/mscorp/java/
(http://www.microsoft.com/mscorp/java/)
For more information about DCOM for Windows 95, visit the
following Microsoft Web site:http://msdn2.microsoft.com/en-us/library/default.aspx
(http://msdn2.microsoft.com/en-us/library/default.aspx)
For additional information about the issues that are involved
with JAVAREG 1.0's surrogate support, click the following article number to
view the article in the Microsoft Knowledge Base: 162164
(http://support.microsoft.com/kb/162164/EN-US/
)
BUG: Using Java Servers and DCOM
For additional information about the
usage of AutoIDispatch mechanism, click the following article number to view
the article in the Microsoft Knowledge Base: 172202
(http://support.microsoft.com/kb/172202/EN-US/
)
INFO: Implementing Java Automation Objects Using AutoIDispatch
For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:
http://www.microsoft.com/java
(http://www.microsoft.com/java)
| Article Translations
|

Back to the top
