4 Replies Latest reply: Dec 29, 2008 12:16 AM by 807557 RSS

    ITC Error by using Preinitialization list at command line

    807557
      Hello

      I am using ITC Compilation options for my real time application ...........When i provide the preinit list of classes at command options and starts my application it gives [ITC Error] ie unable to initialize the class........but it initializes the all other classes in the list as it gives error for two or three classes .... i m unable to debug why it gives such error during start...... when i trace which classes are loaded same classes are shows as loaded also but still gives the [ITC Error] .........This causes my application to halt as it gives exception of class not found during the excution........ But the class are present in the given path.........

      Why ITC Error occur .....one is if class file is not present in the path.... any other reason???????
      How to check why this is occuring ???????
      How to correct........ ie any proper way to give option at start ?????????
      Tell me if any specific data structure which is not supported by the RTSJ during preinitialization....???????

      Another One thing when i removed that particular class name from the preinitialization list my application runs absolutely fine.....List that i m providing is generated automaticatically by application by using command option (BuildPreInitializationList)


      Thanks
        • 1. Re: ITC Error by using Preinitialization list at command line
          807557
          We recently discovered that there can be a problem with the order of classes listed in the preinit list. This can lead to initialization failures as dependencies are not met. The case we are aware of is java.net.SocketInputStream which is a non-public class that when initialized assumes that certain library initialization has been done - ie load a native library - which is only performed by certain other classes. If this has not happened then the initialization will fail with UnsatisfiedLinkError.

          The solution for the SocketInputStream case is to edit the preinit list and place the class java.net.PlainSocketImpl above the class java.net.SocketInputStream.

          If this is not one of the classes you are having problems with please advise the classes involved and we will see if we can determine the necessary precedence order.

          David Holmes
          • 2. Re: ITC Error by using Preinitialization list at command line
            807557
            Forgot to answer this
            qasdkja wrote:
            Another One thing when i removed that particular class name from the preinitialization list my application runs absolutely fine.....List that i m providing is generated automaticatically by application by using command option (BuildPreInitializationList)
            Yes. If the class is not in the preinit list then classes will always be loaded in the correct order as determined by their usage in the program and so no initialization errors will occur. Of course in this case you will experience jitter due to the runtime initialization and compilation of that class.

            David Holmes
            • 3. Re: ITC Error by using Preinitialization list at command line
              807557
              We recently discovered that there can be a problem with the order of classes listed in the preinit list. This can lead to initialization failures as dependencies are not met. The case we are aware of is java.net.SocketInputStream which is a non-public class that when initialized assumes that certain library initialization has been done - ie load a native library - which is only performed by certain other classes. If this has not happened then the initialization will fail with UnsatisfiedLinkError.

              Hello David

              preinit list is automaticatically generated by command options so i preassume that list generated is in serial ordered list of initialized classes..... if every time we have to edit the file that this is a problem .. is there is any other solution for this.... because we have thousand of classes and we dont know which class or native library is required for each class ... also this problem can occur in future for any case which is yet to be tested.......

              suggest me the solution for this so that we dont have to edit the file.... Also in my problem class which is failed to initialized is written by us...Due to this reason i asked for specific data structure which is not supported during initialization..( In my class it extends one class and implements one interface ....Class which is extended is in same package but interface which it implements is in other package....)

              Thanks
              • 4. Re: ITC Error by using Preinitialization list at command line
                807557
                The problem occurs when a list generated on one run is used on the next and the list re-generated - this can lead to the out-of-order listing. So if you can generate a correct list in a single run you can avoid the problem. Otherwise there is no choice but to edit the file. You should only need to re-edit if you regenerate the list because new classes are being used in the application - and if the new class set is small then you can deal with it by editing the list instead of regenerating it.

                For working out the correct order for your classes see if the problem class appears in a freshly generated list. If so then use that order in your real pre-init file (filter out your packages). It may be that the class author can tell you what the necessary initialization order is.

                A possible way of minimising the editing of the file would be to create a helper class that you ensure is the first application class to be initialized (by editing the list) and in that class's initialization code you explicitly initialize (using Class.forName) the problematic classes and their dependencies in the necessary order.

                David Holmes