Home : Common Java Exceptions
Q30337 - ERRMSG: Common Java Exceptions

Common Java Exceptions

This article discusses the solutions to these common Java exceptions:

  1. AutomationException: 0x80070005 - General access denied error
    AutomationException: 0x5 - Access is denied
  2. Can't find class com/linar/java2com/Main Package com.linar.jintegra not found in import java.lang.NoClassDefFoundError: com/linar/jintact/Helper
  3. java.lang.ClassCastException
  4. AutomationException: 0x80080005
  5. AutomationException: 0x80010001 - Call was rejected by callee. in 'Invoke'
  6. java.lang.RuntimeException: Attempt to invoke a non-dispatch method on an object that only supports IDispatch
  7. AutomationException: 0x80020003 - Member not found in 'IDispatch::invoke'
  8. java.io.IOException: Unable to establish RPC Connection to DCOM SCM on HOSTNAME (Bind returned Bind_NAK)
  9. java.lang.ClassNotFoundException
  10. AutomationException: 0x?
  11. java.lang.NullPointerException
  12. AutomationException: 0xc00e0007 - An invalid handle was passed to a function
  13. AutomationException: 0x800706f8
  14. Catching AutomationExceptions in Your Java Code

1. AutomationException: 0x80070005 - General access denied error
AutomationException: 0x5 - Access is denied

This error typically indicates at least one of the following:

  1. DCOM has not been configured correctly. Please see Configuring DCOM for Remote Access for the correct settings.
  2. The parameters passed (domain, username, password) in the DCOM authentication call (AuthInfo.setDefault) are incorrect. Please ensure that valid values are being passed for the domain, username, and password.

2. Can't find class com/linar/java2com/Main
Package com.linar.jintegra not found in import
java.lang.NoClassDefFoundError: com/linar/jintact/Helper

Your CLASSPATH environment variable does not include the J-Integra runtime (jintegra.jar).

3. java.lang.ClassCastException

You may be attempting to access a COM object through a specific COM interface:

mypkg.IAnInterface aComObject = (mypkg.IInterface)anotherComObject.getAnObject();

You must instead use the generated interface proxy to wrap the object (in one of two ways):

(1) mypkg.IAnInterface aComObject = new mypkg.IAnInterfaceProxy(anotherComObject.getAnObject());
(2) mypkg.SomeClass aComObject = new mypkg.SomeClass(anotherComObject.getAnObject());

Do this if you know that a COM object implements a specific COM interface.

4. AutomationException: 0x80080005 Server execution failed.

This error can be thrown for a number of reasons. Some of the more common ones include:

  1. Note that Windows 95 does not support automatic launch of a server, it must be running already.

    You may see this error message if using Windows 9X and you try to access a COM application which is already running. Windows 9X does not support the automatic launch of a COM server. If you are using Windows 9X you must manually start the COM server you are accessing.

  2. When using Terminal Services to log on to a Windows Server and start a Java process, the process will have limited permissions and this exception may be thrown by the process when trying to access a COM component. The solution is to specify This User under the Identity tab in DCOMCNFG when adjusting the DCOM settings for the COM application. The user you specify must have permission to access/launch the COM application you wish to connect to.

  3. Check the event log (Start > Programs > Adminstrative Tools > Event Viewer), as it may give you the reason for the launch failure.

  4. A typical cause of this error is that something is incorrect in the registry entries for the COM application. You may need to reinstall the COM application to correct the registry entries.

  5. There are also a couple of bugs which can cause this error:

  6. This exception may be caused by using Microsoft Office applications for server-side automation:

5. AutomationException: 0x80010001 - Call was rejected by callee. in 'Invoke'

You may get this when running Excel. From one of the Microsoft support answers: "This error usually occurs when the server application is too busy to respond to the client."

The 'com2java' tool has an option (Generate retry code...) in the Options dialog box which causes the J-Integra code to retry if this error occurs. Check that option and regenerate the proxies.

6. java.lang.RuntimeException: Attempt to invoke a non-dispatch method on an object that only supports IDispatch

You are probably invoking a method on a VB COM object from a Java client, and you have rebuilt the VB EXE/DLL without also regenerating the Java proxies using 'com2java'.

To avoid having to rerun com2java every time you recompile your VB EXE/DLL, you can set the version compatability flag in the VB IDE. First, compile the VB component and save this copy in another directory. Next, select Menu->Project->Properties->Component and set Binary Compatibility to your saved copy. Now the component will remain compatible between compilations, as long as the signatures of the exposed functions do not change. The only time you will have to rerun com2java is if you have to change the signatures of the functions (or add new functions). In this case, just recompile a new version of the component to serve as the reference.

7. AutomationException: 0x80020003 - Member not found in 'IDispatch::invoke'

If you are using 'ocxhost' and attempting to load an ActiveX Control, then it is likely that the prog ID you are specifying is incorrect, or the control has not been properly registered on your machine. You can find the correct progid by using the 'checkconfig' command and looking in the generated config.log file:

checkconfig /typelib config.log

8. java.io.IOException: Unable to establish RPC Connection to DCOM SCM on HOSTNAME (Bind returned Bind_NAK)

You will get this error if DCOM access has not been enabled on HOSTNAME. DCOM is shipped as part of Windows 98 and Windows NT. If running Windows 95 and DCOM isn't already installed, you will have to download and install DCOM and DCOMCNFG from Microsoft's website.

Start DCOMCNFG (Start|Run|"dcomcnfg"), and check that "Enable Distributed COM on this computer" is checked on the "Default Properties" pane. If running Windows 95/98 check also that "Enable remote connection" is checked on the "Default Security" pane. Reboot after changing these settings.

9. java.lang.ClassNotFoundException

Doublecheck that your CLASSPATH is defined correctly. If you are using a Servlet environment or other environment which loads classes in different class loaders, you should ensure that your generated proxies and the jintegra.jar file are loaded by the same class loader.

10. AutomationException: 0x? -

If there is no error message related to the error code, in the case an AutomationException, you can look up the error code in the Microsoft Developer Network documentation. If you have Visual C++ installed, the file winerr.h or the utility error lookup may help.

11. java.lang.NullPointerException

If your Java client does not embed the ActiveX Control in a Java frame, make sure the option "Generate Java AWT classes" is not selected when generating Java proxies for the COM component. Otherwise a java.lang.NullPointerException will likely be caused.

12. AutomationException: 0xc00e0007 - An invalid handle was passed to a function

You may get this exception if you created two dependent COM objects on different machine by a mistake. For example, in a Java accessing MSMQ example:

...
MSMQQueueInfo qInfo = new MSMQQueueInfo("123.45.6.78");
MSMQMessage message = new MSMQMessage();
...
IMSMQQueue msQueue = qinfo.open(MQACCESS.MQ_SEND_ACCESS, MQSHARE.MQ_DENY_NONE);
...
message.send(msQueue, new Integer(
isTransactional ? MQTRANSACTION.MQ_SINGLE_MESSAGE
: MQTRANSACTION.MQ_NO_TRANSACTION)
);


The above code shows that message is sent through qInfo. However qInfo is created on machine "123.45.6.78", and message is created on the local machine by a mistake. Therefore message.send will generate a 0xc00e0007 exception. The correct code should be:

MSMQQueueInfo qInfo = new MSMQQueueInfo("123.45.6.78");
MSMQMessage message = new MSMQMessage("123.45.6.78");
...

13. AutomationException: 0x800706f8

You may get this exception if you passed machine name instead of domain name to com.linar.jintegra.AuthInfo.setDefault(domain, user, password); by a mistake.

14. Catching AutomationExceptions in Your Java Code

You can use AutomationException.getCode() to get the specific code of an AutomationException and then handle it in the catch clause. For example:

try {
...
} catch (com.linar.jintegra.AutomationException e) {
if (e.getCode()==0x80070005L) {
System.out.println("Access Denied:");
System.out.println("Use DCOMCNFG or run the Java client in native mode.");
}
...
} catch (Exception e) {
e.printStackTrace();
}
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/23/2006.
Last Modified on 6/3/2008.
Last Modified by J-Integra KB Admin.
Article has been viewed 32567 times.
Rated 5 out of 10 based on 28 votes.
Print Article
Email Article