• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.ClassFormatError while loading class

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was some mismatch in the version of classes i was using. It works now. Thanks for your answer.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic