Search code examples
classloaderabstract-factoryclassformaterror

java.lang.ClassFormatError while loading class


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:

Exception in thread "Thread-1" java.lang.ClassFormatError: Code segment has wrong length in class file com/testsuite/loadperformancetesterusage/tasks/GetUrl

Following is the GetUrl constructor, nothing fancy!

public GetUrl( String protocol, String port, String hostname, String path, String producerClassName ) {
    super(producerClassName);
    this.protocol = protocol;
    this.hostname = hostname;
    this.port = port;
    this.path = path;
}

Any feedback on what might be happening here? Cross posted here


Solution

  • There was some mismatch in the version of classes i was using. It works now.