Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8209 closed defect (fixed)

External jar for plugins. Log4j in two plugins cause crash.

Reported by: kendzi Owned by: Don-vip
Priority: major Milestone:
Component: Core Version:
Keywords: ImportImagePlugin, kendzi3d, log4j Cc:

Description

I just updated plug-in ImportImagePlugin and my plugin Kendzi3d stop working. After short analysis I find out that ImportImagePlugin add log4j jar and now both plug-ins try to load this library. When my plug-in starts and try to use log4j I get:

Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name "org/apache/log4j/Category"
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)

Error stop occurring after I removed plug-in ImportImagePlugin. Any idea how to share same jar in different plug-ins?

Attachments (1)

jars bug.txt (24.8 KB) - added by kendzi 10 years ago.
output form console

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by kendzi

Attachment: jars bug.txt added

output form console

comment:1 Changed 10 years ago by Don-vip

Owner: changed from team to Don-vip
Status: newassigned

comment:2 Changed 10 years ago by Don-vip

Priority: criticalmajor
Resolution: fixed
Status: assignedclosed

Fixed. I have created a new log4j plugin to share the jar between all other plugins (ImportImage, routing, videomapping, yours).

You need to add this line in your build.xml in order to change your manifest and publish the plugin again (without log4j classes, of course):

                <attribute name="Plugin-Requires" value="log4j"/>

Please note I have setup this plugin to stage 5.

comment:3 Changed 10 years ago by bastiK

@Don-vip: what happens if you update the plugin, will it add the new dependency automatically?

comment:4 Changed 10 years ago by Don-vip

Component: PluginCore
Resolution: fixed
Status: closedreopened

I don't think so. Need to fix that in core.

comment:5 Changed 10 years ago by stoecker

It will warn you in case a dependency is missing. We have no auto-resolve ATM I think.

comment:6 Changed 10 years ago by kendzi

what mean Plugin-Stage: 5?

comment:7 Changed 10 years ago by Don-vip

It means it will be among the first loaded plugins.
The plugins are loaded according to their stage value in increasing order. Default value is 50 if not set.
I have set low values for these "library plugins":

  • log4j: 5
  • jts: 10
  • geotools: 20
Last edited 10 years ago by Don-vip (previous) (diff)

comment:8 Changed 10 years ago by Don-vip

Resolution: fixed
Status: reopenedclosed

In 5601/josm:

fix #7680, fix #8209 - Better handling of plugin automatic updates (automatic dependencies resolution + version number update)

comment:9 Changed 10 years ago by bastiK

Great! Then I can move the jna lib to a separate plugin which is used by videomapping and native password manager.

comment:10 Changed 10 years ago by Don-vip

Be careful with the JNA version. Videomapping uses it because of vlcj and I'm not sure the current stable version of vlcj works well with latest version of JNA.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.