Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 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 12 years ago.
output form console

Download all attachments as: .zip

Change History (11)

by kendzi, 12 years ago

Attachment: jars bug.txt added

output form console

comment:1 by Don-vip, 12 years ago

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

comment:2 by Don-vip, 12 years ago

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 by bastiK, 12 years ago

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

comment:4 by Don-vip, 12 years ago

Component: PluginCore
Resolution: fixed
Status: closedreopened

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

comment:5 by stoecker, 12 years ago

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

comment:6 by kendzi, 12 years ago

what mean Plugin-Stage: 5?

comment:7 by Don-vip, 12 years ago

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 12 years ago by Don-vip (previous) (diff)

comment:8 by Don-vip, 12 years ago

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 by bastiK, 12 years ago

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

comment:10 by Don-vip, 12 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.