在RamlValidationService中获取java.lang.NoSuchFieldError:VALUE [英] Getting java.lang.NoSuchFieldError: VALUE in RamlValidationService

查看:263
本文介绍了在RamlValidationService中获取java.lang.NoSuchFieldError:VALUE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个RAML验证器来获取

解决方案

从未见过这个错误。我怀疑你可能仍然会遗漏依赖项。



确实,Java RAML解析器具有比您手动添加的这些少量JAR更多的依赖项。你在 pom 中看到的依赖关系只是冰山一角,也有大量的传递依赖。



所以:为项目使用适当的依赖管理器(如Maven)。它将负责为您带来所有依赖项(直接和传递)。此外,除非这是一个玩具项目,否则无论如何都需要一个合适的构建工具。


I want to create a RAML validator that will get the RAML URLs resturn validation results. For that Im using raml-java-parser. As per its readme file I try to execute below line of code:

String sourceUrl = "http://api.apihub.com/onpositive/api/espn-raml-api/espn.raml";
List<ValidationResult> results = RamlValidationService.createDefault().validate(sourceUrl);

And get below error message:

java.lang.NoSuchFieldError: VALUE

Why I'm getting this error? Before that I got some class not found exceptions therefore I have applied below jar libraries manually.

> juniversalchardet_1.0.3_1.0.0.jar 
> raml_parser_0.8.11_1.0.0.jar
> rhino_1.7R4_1.0.0.jar 
> snakeyaml-1.16.jar
> jackson_databind_2.4.4_1.0.0.jar

I have tried below stuff as well. inputStream is the RAML content that I parsed through ByteArrayInputStream. But this is not a invalid RAML therefore I might doing something wrong.

解决方案

Never seen this error. I suspect you may still miss dependencies.

Indeed, the Java RAML parser has more dependencies than these few JARs you've manually added. And the dependencies you see in the pom are just the tip of the iceberg, there are tons of transitive dependencies as well.

So: use a proper dependency manager (like Maven) for your project. It will take care of bringing all the dependencies (direct and transitive) for you. Besides, unless this is a toy project, you will need a proper build tool anyway.

这篇关于在RamlValidationService中获取java.lang.NoSuchFieldError:VALUE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆