I am implementing the AbstractFactory pattern allowing outsiders to create Factories. I am reading the factory implementation name from a properties file, loading the factory class and using it to construct objects. Problem is that somewhere in my factory implementation when i'm trying to create an object of a task i get the following error.
Following is the GetUrl constructor, nothing fancy!
Did you perhaps transfer that .class file from another computer using FTP in ASCII mode?
Otherwise maybe you have a non-standard and buggy java compiler?
Or maybe you compiled with a newer version but are trying to run in an older JVM? (I would expect an error explicitly telling you that if this were the case, but maybe if you explicitly load the class yourself, that may not happen?)
Maybe you have some class named String that you wrote yourself that is getting confused with java.lang.String?
All we can tell here is that the ClassLoader considers the class to be corrupt. Without any information about how you compiled the class or what its superclass looks like or how it got to be available to your classloader or how you're loading it, it's hard to say anything definite.
Joined: Jan 09, 2007
There was some mismatch in the version of classes i was using. It works now. Thanks for your answer.
subject: java.lang.ClassFormatError while loading class