本文介绍了加载类时出现java.lang.ClassFormatError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现AbstractFactory模式,允许外部人员创建工厂。我正在从属性文件中读取工厂实现名称,加载工厂类并使用它来构造对象。问题是,当我尝试创建任务的对象时,在工厂实现中的某个地方出现以下错误:

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:

下面是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

推荐答案

我使用的类的版本不匹配。现在可以使用。

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

这篇关于加载类时出现java.lang.ClassFormatError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 09:16
查看更多