Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Create WAR - found duplicate org.json objects
Create WAR - found duplicate org.json objects [message #1848579] Wed, 08 December 2021 14:21 Go to next message
Miloslav Frajdl is currently offline Miloslav FrajdlFriend
Messages: 48
Registered: June 2018
Member
Hi.

In my project "tracetickets" I use the org.json library to parse text in json format.

By creating war I receive this error message:

[INFO] --- duplicate-finder-maven-plugin:1.4.0:check (default) @ tracetickets.ui.html ---
[INFO] Checking compile classpath
[INFO] Checking runtime classpath
[INFO] Checking test classpath
[WARNING] Found duplicate and different classes in [org.eclipse.scout.rt:org.eclipse.scout.json:11.0.36, org.json:json:20210307]:
[WARNING]   org.json.JSONArray
[WARNING]   org.json.JSONException
[WARNING]   org.json.JSONObject
[WARNING]   org.json.JSONStringer
[WARNING]   org.json.JSONTokener
[WARNING] Found duplicate classes/resources in compile classpath.
[WARNING] Found duplicate and different classes in [org.eclipse.scout.rt:org.eclipse.scout.json:11.0.36, org.json:json:20210307]:
[WARNING]   org.json.JSONArray
[WARNING]   org.json.JSONException
[WARNING]   org.json.JSONObject
[WARNING]   org.json.JSONStringer
[WARNING]   org.json.JSONTokener
[WARNING] Found duplicate classes/resources in runtime classpath.
[WARNING] Found duplicate and different classes in [org.eclipse.scout.rt:org.eclipse.scout.json:11.0.36, org.json:json:20210307]:
[WARNING]   org.json.JSONArray
[WARNING]   org.json.JSONException
[WARNING]   org.json.JSONObject
[WARNING]   org.json.JSONStringer
[WARNING]   org.json.JSONTokener
[WARNING] Found duplicate classes/resources in test classpath.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] TraceTickets Parent Module ......................... SUCCESS [ 27.910 s]
[INFO] TraceTickets Shared ................................ SUCCESS [ 15.339 s]
[INFO] TraceTickets Server ................................ SUCCESS [  4.704 s]
[INFO] TraceTickets Client ................................ SUCCESS [ 18.465 s]
[INFO] TraceTickets Server Application .................... SUCCESS [  4.487 s]
[INFO] TraceTickets Server Application (Development) ...... SUCCESS [  5.019 s]
[INFO] TraceTickets HTML UI ............................... FAILURE [03:32 min]
[INFO] TraceTickets HTML UI Application ................... SKIPPED
[INFO] TraceTickets HTML UI Application (Development) ..... SKIPPED
[INFO] TraceTickets ROOT Module 1.0.0-SNAPSHOT ............ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:49 min
[INFO] Finished at: 2021-12-08T15:20:09+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.4.0:check (default) on project tracetickets.ui.html: Found duplicate classes/resources! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.4.0:check (default) on project tracetickets.ui.html: Found duplicate classes/resources!


I tried to edit "tracetickets/pom.xml":
<dependencyManagement>
    <dependencies>
      ..........
      <dependency>
        <groupId>org.eclipse.scout.rt</groupId>
        <artifactId>org.eclipse.scout.rt</artifactId>
        <version>${org.eclipse.scout.rt.version}</version>
        <type>pom</type>
        <scope>import</scope>
         <exclusions>
        	<exclusion>
    	    	<groupId>org.json</groupId>
			    <artifactId>json</artifactId>
        	</exclusion>
        </exclusions>
     </dependency>


But this has no effect.

Can anyone please advise me where I am making a mistake?

Thank you.

[Updated on: Wed, 08 December 2021 14:23]

Report message to a moderator

Re: Create WAR - found duplicate org.json objects [message #1848583 is a reply to message #1848579] Wed, 08 December 2021 16:41 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Miloslav

Excluding one of the duplicates is the right approach.
But you don't have to declare the exclusion in the dependency import.

Such an import actually does not declare a real dependency. It only imports the dependency-management from scout so that all the versions of the scout dependencies are already defined. So it won't help if you place your exclusion there.

Instead you have to track down the dependency in one of your poms that introduces (contributes) org.json:json. You can e.g. do that by computing the dependency tree for the affected module. There you can see from where the org.json:json dependency is coming. And at the place this root dependency is declared in your poms you have to add your exclusion.

Hope this helps
Mat
Re: Create WAR - found duplicate org.json objects [message #1848625 is a reply to message #1848579] Fri, 10 December 2021 08:26 Go to previous message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 207
Registered: November 2010
Senior Member
Just a quick addendum:

The org.json classes are used by the Scout UI layer as a lightweight way to parse and serialize JSON messages between the browser and the UI server. Since the license of the original org.json implementation is somewhat unclear and is generally considered "non-free", we replaced it with a clean room re-implementation done by the Google Android team. It is released under the Apache License and can therefore safely be used by Eclipse Scout. The re-implementation is mostly compatible with the original library. Because Google did not build a separate library we took the relevant files and bundled them in a separate maven module.

You can find more information in the readme file:
https://github.com/eclipse-scout/scout.rt/tree/releases/11.0/org.eclipse.scout.json

Regards,
Beat
Previous Topic:NullPointer Exception at ServiceTunnelResponse
Next Topic:Scout Application very Slow when 10+ Users are logged in
Goto Forum:
  


Current Time: Wed May 08 03:32:34 GMT 2024

Powered by FUDForum. Page generated in 0.03683 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top