java.lang.reflect.InaccessibleObjectException:无法使字段私有最终字节[] java.lang.String.value 可访问:568

问题描述

我正在尝试使用 jbehave 测试一些 API。在尝试配置我的 Jbehave 故事时,我遇到了以下错误(附在下面): 我什至尝试使用 --illegal-access=permit。我在 Windows 命令提示符下使用了命令 java -cp out com.example.prederiq.PrederaAiq.StoryConfiguration(其中 com.example.prederiq.PrederaAiq 是我的包名,StoryConfiguration 是我要配置的类名),但它抛出了 classNotFoundException。我什至使用 cd ubuntu 命令导航到我的配置文件所在的文件夹并尝试使用此命令,但它仍然不起作用。

Full error

我的故事配置类:

public class StoryConfiguration extends JUnitStories {

    @Override
    public Configuration configuration() {
        return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(new StoryReporterBuilder().withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass())).withDefaultFormats().withFormats(StoryReporterBuilder.Format.CONSOLE,StoryReporterBuilder.Format.HTML));
    }

    @Override
    public InjectableStepsFactory stepsFactory() {
        return new InstanceStepsFactory(configuration(),new PrederaAiqApplicationTests());
    }

    @Override
    public List<String> storyPaths() {
       return Arrays.asList("com/example/prederiq/PrederaAiq/test.story");
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)