[forge-users] Problem with json-parser
George Gastaldi
ggastald at redhat.com
Mon Oct 12 00:16:46 EDT 2015
Hi Rafael,
It seems that the following dependency needs to be removed:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
</dependency>
Let me know how it goes.
Em 12/10/2015 01:13, "Rafael Pestano" <rmpestano at gmail.com> escreveu:
> Hi everyone,
>
> I'm trying to manipulate json files using parser-json addon. I can save
> files but when I try to read them I receive a (classpath?) error:
>
> Caused by: java.lang.LinkageError: loader constraint violation: when
> resolving interface method
> "org.jboss.forge.addon.parser.json.resource.JsonResource.getJsonObject()Ljavax/json/JsonObject;"
> the class loader (instance of org/jboss/modules/ModuleClassLoader) of the
> current class, com/github/forge/addon/music/PlaylistManager, and the class
> loader (instance of org/jboss/modules/ModuleClassLoader) for the method's
> defining class, org/jboss/forge/addon/parser/json/resource/JsonResource,
> have different Class objects for the type javax/json/JsonObject used in the
> signature
> at
> com.github.forge.addon.music.PlaylistManager.getAllPlaylists(PlaylistManager.java:178)
> at
> com.github.forge.addon.music.PlaylistManager.initPlayLists(PlaylistManager.java:57)
>
> Here is the method which throws the exception:
>
> public List<JsonObject> getAllPlaylists() {
> List<JsonObject> playListsObject = new ArrayList<>();
> List<Resource<?>> playListsFound = getPlayListHomeDir().listResources(new ResourceFilter() {
> @Override
> public boolean accept(Resource<?> resource) {
> return resource instanceof FileResource && resource.getName().endsWith(".json");
> }
> });
> for (Resource<?> resource : playListsFound) {
> JsonResource jsonResource = resource.reify(JsonResource.class);
> JsonObject jsonObject = jsonResource.getJsonObject();
> playListsObject.add(jsonObject);
> }
> return playListsObject;
> }
>
>
> The exception is thrown in jsonResource.getJsonObject();
>
> The code is here: https://github.com/rmpestano/music-addon and there is a
> test that reproduces the error.
>
> Any help is appreciated, thanks in advance.
>
> --
> <http://www.advancedit.com.br/>Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> http://rpestano.wordpress.com/
> @realpestano <https://twitter.com/realpestano>
>
> _______________________________________________
> forge-users mailing list
> forge-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-users/attachments/20151012/5b5b54ec/attachment.html
More information about the forge-users
mailing list