dynamic-extensions-for-alfresco icon indicating copy to clipboard operation
dynamic-extensions-for-alfresco copied to clipboard

Third Party dependencies are not resolved

Open panzerj opened this issue 4 years ago • 1 comments

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] question

Expected Behavior

Dependencies from the WEB-NIF/lib directory should be resolved so that they can be used in the dynamic extension

Current Behavior

The dependencies are not resolved. For example, if I simply add the line private final static Log log = LogFactory.getLog(SetDescriptionWebScript.class); into the SetDescriptionWebScript in the example project (maven-sdk4), the extension does not start any more:

org.osgi.framework.BundleException: Unable to resolve eu.xenit.de.example-dynamic-extensions-module [7](R 7.0): missing requirement [eu.xenit.de.example-dynamic-extensions-module [7](R 7.0)] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.logging)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[eu.xenit.de.example-dynamic-extensions-module [7](R 7.0)] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.logging)(version>=1.2.0)(!(version>=2.0.0)))]

This behaviour applies also to all other third party libraries I use although they are available in alfresco´s lib folder.

Possible Solution

Steps to Reproduce (for bugs)

  1. check out example-dynamic-extensions-module
  2. add reference do the logger in a webscript. private final static Log log = LogFactory.getLog(SetDescriptionWebScript.class);
  3. run

Context

Your Environment

  • Alfresco version used: 6.1.2-ga
  • DE version used: 2,0.3

panzerj avatar Apr 14 '20 09:04 panzerj

Hi @panzerj , thanks for reporting this issue.

I've been able to reproduce the issue.

Findings after quick first investigation:

  • bundle MANIFEST.MF file seems to contain the correct Import-Package directive: org.apache.commons.logging;version="[1.2,2)"
  • commons-logging-1.2.jar is indeed still available in the Alfresco WEB-INF/lib folder
  • however it looks like DE exposes another version of the org.apache.commons.logging as system package: image
  • hence I think there might be another lib that provides this dependency. Based on the version, I supect one of these:
[root@c6426053d3c2 temp]# ll ../webapps/alfresco/WEB-INF/lib/ | grep 5.1.3
-r--r--r-- 1 root root    33015 Jan 14  2019 jsr305-1.3.9.jar
-r--r--r-- 1 root root   368971 Jan 14  2019 spring-aop-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   671676 Jan 14  2019 spring-beans-5.1.3.RELEASE.jar
-r--r--r-- 1 root root  1099288 Jan 14  2019 spring-context-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   181375 Jan 14  2019 spring-context-support-5.1.3.RELEASE.jar
-r--r--r-- 1 root root  1289362 Jan 14  2019 spring-core-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   280322 Jan 14  2019 spring-expression-5.1.3.RELEASE.jar
-r--r--r-- 1 root root    23624 Jan 14  2019 spring-jcl-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   404662 Jan 14  2019 spring-jdbc-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   259940 Jan 14  2019 spring-jms-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   383411 Jan 14  2019 spring-messaging-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   199365 Jan 14  2019 spring-orm-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   256335 Jan 14  2019 spring-tx-5.1.3.RELEASE.jar
-r--r--r-- 1 root root  1377522 Jan 14  2019 spring-web-5.1.3.RELEASE.jar
-r--r--r-- 1 root root   800371 Jan 14  2019 spring-webmvc-5.1.3.RELEASE.jar
-r--r--r-- 1 root root    91822 Jan 14  2019 xmpcore-5.1.3.jar

I cannot yet propose or create a fix for this issue, since it will require more investigation.

In the meantime, there might be some possible workarounds:

  • use slf4j logger
  • manually fix the <Import-Package>header to remove the org.apache.commons.logging version constraint.

Do you have a reference to other specific packages that cause this issue? (Next to org.apache.commons.logging.*

kerkhofsd avatar Apr 14 '20 10:04 kerkhofsd