SAP Knowledge Base Article - Public

1256655 - How to trace Java Bean Connectivity error " java.lang.reflect.InvocationTargetException" occuring from Crystal Report Designer

Symptom

  • We may get error " java.lang.reflect.InvocationTargetException " from Crystal Report designer at the time of creating Java Bean connectivity as shown in the file screenshot below.
  • Since it is very difficult to debug this error from designer due to its inadequate stack trace, we need some utility which can give us exact reason behind this error.
  • Utility described in this article will give you the required tool to get more information about the error.

error.png

Reproducing the Issue

  • Write a Java code to make Java Bean connectivity.
  • Intentionally make such a mistake in your code which will allow your code to get compiled but will throw run time error. 
  • Since there is mistake in our code, at run time, when we click on JavaBean options in Crystal Designer, we can see the compilied class.
  • However after clicking on that class, designer will throw some error.
  • Our aim is to find out exact location of that error in our code.

Cause

  • As the developer might have done some mistake in the code for JavaBean Connectivity, since error is not caught by compiler at compile time, we were successfully compiled code and made .class file.
  • However crystal report engine will throw this error at run time as it will not get correct resultset from database

Resolution

  • In order to trace such error, we are going to use utility named as "Java Server".
  • Java Server is simple executable batch file which needs to be executed. Go through Instructions.txt file in the JavaServerUtlity folder before executing this utility.

Follow following steps to run Java Server utility:

  1. Open the blank crystal report in which you are going to make JavaBean connectivity.
  2. Click Control+Alt+Delete and click on Task Manager.
  3. In Windows Task Manager, click on View-->Select Columns.
  4. Select PID(Process Identifier) option and click on ok.
  5. Locate crw32.exe file by clicking on Processes option and note down the PID.
  6. Close task manager window.
  7. In the services, click on View > Add/Remove Columns.
  8. Open the folder JavaServerUtility.
  9. Right click on runJS.bat and select edit option. This will open the bat file in notepad.
  10. Edit the line:
    1. Set libpath=C:\Program Files\Common Files\Business Objects\3.0\java\lib
    2. Give correct path where you have installed Business Objects software on your drive. The path will be up to lib folder as mentioned in the above line.
  11. Edit the line:
    1. Set iorfile=3988.ior
    2. Replace the number 3988 with your PID for crw32.exe which we have already noted.
  12. Save this changes in bat file and double click on it. You will notice command prompt in the background window.
  13. Make your Java Beans connectivity in designer window and go to the step where you will get error prompt.
  14. Once you get this error prompt, go to the location:
    1. C:\work\API_logs\JavaServerLogs, where you will get detailed stack trace of the cause behind this error.
  15. This stack trace may be descriptive enough to find out mistake in a code.
  16. You may also attach a remote debug session to the JavaServer, using the address specified in the runJS.bat file, in the last line.  The default debug port is set to 6770 (in the line -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=6770

 

Keywords

  • java.lang.reflect.InvocationTargetException
  • JavaBean Connectivity error from Crystal report designer
, KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2

Attachments

JavaServerUtlity.zip