2012-10-01 37 views
0

我正在实现允许外部人员创建工厂的AbstractFactory模式。我正在从属性文件读取工厂实现名称,加载工厂类并使用它来构造对象。问题是,在什么地方我的工厂实现时,我试图创建一个任务,我得到以下错误的对象:加载类时java.lang.ClassFormatError

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

以下是使用getURL构造,没有什么花哨!

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; 
} 

对这里可能发生的事情有任何反馈? Cross发布here

回答

1

在我使用的类的版本中有一些不匹配。它现在有效。

+0

你的意思是不匹配是什么意思? –

+1

这是一段时间后,但据我记得,我已经编译了类使用一些Java版本,并试图加载它使用另一个版本。 –

相关问题