Java. Lang. instantiationexception :( instantiation exception)

Source: Internet
Author: User

First, let's take a look at the exception:

Java. Lang. instantiationexception: COM. IBM. msdk. UI. session. View. Actions. simportaction
At java. Lang. Class. newinstance0 (class. Java: 340)
At java. Lang. Class. newinstance (class. Java: 308)
At com. IBM. msdk. UI. session. View. Actions. sviewactionprovider. makeimportaction (sviewactionprovider. Java: 157)
At com. IBM. msdk. UI. session. View. Actions. sviewactionprovider. makeactions (sviewactionprovider. Java: 67)
At com. IBM. msdk. UI. session. View. sessionview. createpartcontrol (sessionview. Java: 446)
At org. Eclipse. UI. Internal. viewreference. createparelper (viewreference. Java: 367)
At org. Eclipse. UI. Internal. viewreference. createpart (view reference. Java: 226)
At org. Eclipse. UI. Internal. workbenchpartreference. getpart (workbenchpartreference. Java: 595)
At org. Eclipse. UI. Internal. workbenchpage $ activationlist. setactive (workbenchpage. Java: 4212)
At org. Eclipse. UI. Internal. workbenchpage $18. runwithexception (workbenchpage. Java: 3271)
At org. Eclipse. UI. Internal. startupthreading $ startuprunnable. Run (startupthreading. Java: 31)

========================================================== ========================

For the above exceptions, it means that an exception is thrown when the object fails to be instantiated. Most of these exceptions occur in abstract classes. When the reflection mechanism is used, since the constructor in the abstract parent class is not public, it is very easy to cause exceptions. You only need to change the corresponding constructor in the class to public.

 

Generally
In the development of rap or RCP, reflection is required when the fragment mechanism is used, which is often used for action and other operations. It should be noted that org. eclipse. jface. action. all constructor methods in action are private. If public is not declared during inheritance, reflection class is used. forname ("com. andy. myaction ")
. Newinstance ();
You cannot call the non-parameter constructor in myaction.

 

Public class myaction extends org. Eclipse. jface. action. Action {

Public

Myaction (){}<---- After modification ---

Protected


Action (){}

 

}

 

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.