Surely the exception message gives you some hint as to what the reason might be... did you check that out, and if so, can you tell us? Also, did you think to look in the javadoc for the exception? It states "Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated because it is an interface or is an abstract class.". Is this the case?
Joined: Feb 10, 2001
Hi Peter, Thanx a bunch for your reply. The class im trying to instantiate is normal (final) class,but its parent class is abstract I could find only following details when running it thru my web application
java.lang.InstantiationException: com.x.olb3.process.finance.payment.AllocateFunds at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Unknown Source) ..... ... ... ..
But when I tried to execute this thru simple java program I got following error...
Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at Test.main(Test.java:7) Caused by: java.lang.NullPointerException at com.x.olb3.process.Parent.<clinit>(Unknown Source) ... 3 more
But Strange thing is ..all other classes are subclass of this class and they are instansitated normally (in web app no thru java program)