Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassFormatError while loading class

 
Nev Mehta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!



Any feedback on what might be happening here? Cross posted at http://stackoverflow.com/questions/12667377/java-lang-classformaterror-while-loading-class
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nev Mehta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was some mismatch in the version of classes i was using. It works now. Thanks for your answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic