#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)
Change History (11)
by , 12 years ago
Attachment: | jars bug.txt added |
---|
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 12 years ago
Priority: | critical → major |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
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 , 12 years ago
@Don-vip: what happens if you update the plugin, will it add the new dependency automatically?
comment:4 by , 12 years ago
Component: | Plugin → Core |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
I don't think so. Need to fix that in core.
comment:5 by , 12 years ago
It will warn you in case a dependency is missing. We have no auto-resolve ATM I think.
comment:7 by , 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
comment:9 by , 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 , 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.
output form console