Alfresco/alfresco-sdk

Alfresco sdk 4 - issue with alfresco platform version 6.1.1 onwards

eharper64 opened this issue · 9 comments

(See https://hub.alfresco.com/t5/alfresco-content-services-forum/alfresco-sdk-4-issue-with-alfresco-platform-version-6-1-1/m-p/293697/highlight/false#M16530 for the original reporting of the issue).

Create a new SDK4.0 AIO project with enterprise parent pom.xml settings, and specifying Alfresco 6.1.1 as the version. "./run.sh build_start" fails in the start step when deploying AMPS to the ACS docker container:

11050000 An IO error was encountered during deployment of the AMP into the WAR
ERROR: Service 'zia-test-acs' failed to build: The command '/bin/sh -c java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force' returned a non-zero code: 1

(my project artifactId is "zia-test").

Change the Alfresco version to 6.1.0 or 6.1.0.5 and the problem goes away.

Additional info:
mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T01:58:13-06:00)
Maven home: /Users/eharper/maven/apache-maven-3.5.2
Java version: 11.0.2, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"

$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

$ docker --version
Docker version 19.03.1, build 74b1e89

$ docker-compose -v
docker-compose version 1.24.1, build 4667896b

Since Alfresco 6.1.1, the alfresco-mmt.jar must be run with root user because the alfresco user does not have the necessary file permissions to modify the web application. Earlier images did not have that alfresco user and always ran as root. This change is the result of some Enterprise MNT issue addressing potential security issues with the default images.

The following section contains the critical directives:

COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/

USER root
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \
              $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force
USER alfresco

Unfortunately, the difference in the Alfresco base images means that current SDK 4 cannot be used with Alfresco 6.1.1 / 6.2 and higher, and any SDK that includes this fix cannot be used with Alfresco 6.1 and lower.

OK. Good to know, but SDK 4.1 is not yet in Maven Central, so I can't use it either. Do I need to open a separate issue for that?

SDK 4.1 is still a work-in-progress as far as I can see, so of course it is not yet available in Maven Central. Someone from Alfresco would have to specify what their planned schedule is.

The main README for the SDK says that 4.1 was released in October:
News
2019-10: Alfresco SDK 4.1.0 released

While there is still a 4.1 branch (and 4.0), everything in the 4.1 branch appears to have been merged into master.

But there is no 4.1 tag, no GitHub release for 4.1 yet, and the pom.xml on the master branch still contains the version number 4.1.0-SNAPSHOT. Maybe it was the (original) plan to release 4.1 in October, but from the project state here on GitHub, this is clearly not the case.

There is a jira issue (and an enterprise support case) related to this issue: https://issues.alfresco.com/jira/browse/MNT-21160

thmor commented

Hi,

It's not possible to deploy an amp file stored from "extensions" folder to Docker Container

Image is : alfresco/alfresco-share:6.2.0
Alfrescp SDK 4.1

The DockerFile is the file provided with the SDK

`FROM ${docker.share.image}:${alfresco.share.version}

ARG TOMCAT_DIR=/usr/local/tomcat

Copy Dockerfile to avoid an error if no JARs exist

COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/share/WEB-INF/lib/

Copy Dockerfile to avoid an error if no AMPs exist

COPY Dockerfile extensions/.amp $TOMCAT_DIR/amps_share/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt
.jar install
$TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force

COPY share-config-custom.xml $TOMCAT_DIR/shared/classes/alfresco/web-extension

COPY log4j.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes
COPY hotswap-agent.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes`

The following command is KO

RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \ $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force

The issue is

`Step 5/8 : RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force
---> Running in 6bb6ef235ba2
java.io.FileNotFoundException: /usr/local/tomcat/amps_share/javascript-console-share-0.6.amp/module.properties
at de.schlichtherle.truezip.file.TFileInputStream.newInputStream(TFileInputStream.java:108)
at de.schlichtherle.truezip.file.TFileInputStream.(TFileInputStream.java:81)
at org.alfresco.repo.module.tool.ModuleDetailsHelper.createModuleDetailsFromPropertyLocation(ModuleDetailsHelper.java:105)
at org.alfresco.repo.module.tool.ModuleManagementTool.installModule(ModuleManagementTool.java:229)
at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:172)
at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:155)
at org.alfresco.repo.module.tool.ModuleManagementTool.main(ModuleManagementTool.java:837)
Caused by: java.util.zip.ZipException: ZIP file spanning/splitting is not supported!'

Thanks for your response

`

thmor commented

Hi,

I have an other with the support tool module amp :

Step 5/8 : RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force ---> Running in 8092bd5d3f26 java.io.FileNotFoundException: /usr/local/tomcat/amps_share/support-tools-share.amp/module.properties at de.schlichtherle.truezip.file.TFileInputStream.newInputStream(TFileInputStream.java:108) at de.schlichtherle.truezip.file.TFileInputStream.<init>(TFileInputStream.java:81) at org.alfresco.repo.module.tool.ModuleDetailsHelper.createModuleDetailsFromPropertyLocation(ModuleDetailsHelper.java:105) at org.alfresco.repo.module.tool.ModuleManagementTool.installModule(ModuleManagementTool.java:229) at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:172) at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:155) at org.alfresco.repo.module.tool.ModuleManagementTool.main(ModuleManagementTool.java:837) Caused by: java.io.EOFException

Thierry

I created a project for SDK 4.4.

In Dockerfile for the Share, I have the following code:

Copy Dockerfile to avoid an error if no AMPs exist

COPY Dockerfile add-ons/.amp $TOMCAT_DIR/amps_share/
RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt
.jar install
$TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force

Inside add-ons folder I put the AMP file: aps-action-share-7.0.0.amp

I tried to install other AMP files but I have always faced the same problem.

When I run the command ./run.sh build_start I have the exception that is mentioned above:

java.io.FileNotFoundException: /usr/local/tomcat/amps_share/aps-action-share-7.0.0.amp/module.properties at de.schlichtherle.truezip.file.TFileInputStream.newInputStream(TFileInputStream.java:108) at de.schlichtherle.truezip.file.TFileInputStream.<init>(TFileInputStream.java:81) at org.alfresco.repo.module.tool.ModuleDetailsHelper.createModuleDetailsFromPropertyLocation(ModuleDetailsHelper.java:105) at org.alfresco.repo.module.tool.ModuleManagementTool.installModule(ModuleManagementTool.java:229) at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:172) at org.alfresco.repo.module.tool.ModuleManagementTool.installModules(ModuleManagementTool.java:155) at org.alfresco.repo.module.tool.ModuleManagementTool.main(ModuleManagementTool.java:837) Caused by: java.io.IOException: File pointer must not be negative! at de.schlichtherle.truezip.rof.BufferedReadOnlyFile.seek(BufferedReadOnlyFile.java:237) at de.schlichtherle.truezip.zip.RawZipFile.findCentralDirectory(RawZipFile.java:269) at de.schlichtherle.truezip.zip.RawZipFile.<init>(RawZipFile.java:149) at de.schlichtherle.truezip.zip.RawZipFile.<init>(RawZipFile.java:129) at de.schlichtherle.truezip.fs.archive.zip.ZipInputShop.<init>(ZipInputShop.java:45) at de.schlichtherle.truezip.fs.archive.zip.ZipDriver.newInputShop(ZipDriver.java:498) at de.schlichtherle.truezip.fs.archive.zip.ZipDriver.newInputShop(ZipDriver.java:481) at de.schlichtherle.truezip.fs.FsTargetArchiveController.mount0(FsTargetArchiveController.java:197) at de.schlichtherle.truezip.fs.FsTargetArchiveController.mount(FsTargetArchiveController.java:155) at de.schlichtherle.truezip.fs.FsFileSystemArchiveController$ResetFileSystem.autoMount(FsFileSystemArchiveController.java:85) at de.schlichtherle.truezip.fs.FsFileSystemArchiveController.autoMount(FsFileSystemArchiveController.java:37) at de.schlichtherle.truezip.fs.FsBasicArchiveController.autoMount(FsBasicArchiveController.java:113) at de.schlichtherle.truezip.fs.FsBasicArchiveController$1Input.getLocalTarget(FsBasicArchiveController.java:185) at de.schlichtherle.truezip.fs.FsBasicArchiveController$1Input.getDelegate(FsBasicArchiveController.java:200) at de.schlichtherle.truezip.socket.DelegatingInputSocket.getBoundSocket(DelegatingInputSocket.java:43) at de.schlichtherle.truezip.socket.DelegatingInputSocket.newInputStream(DelegatingInputSocket.java:63) at de.schlichtherle.truezip.fs.FsContextController$Input.newInputStream(FsContextController.java:273) at de.schlichtherle.truezip.fs.FsResourceController$Input.newInputStream(FsResourceController.java:252) at de.schlichtherle.truezip.socket.DelegatingInputSocket.newInputStream(DelegatingInputSocket.java:63) at de.schlichtherle.truezip.fs.FsSyncController$Input.newInputStream(FsSyncController.java:400) at de.schlichtherle.truezip.fs.FsLockController$Input$1NewInputStream.call(FsLockController.java:455) at de.schlichtherle.truezip.fs.FsLockController$Input$1NewInputStream.call(FsLockController.java:452) at de.schlichtherle.truezip.fs.FsLockController.locked(FsLockController.java:328) at de.schlichtherle.truezip.fs.FsLockController.writeLocked(FsLockController.java:268) at de.schlichtherle.truezip.fs.FsLockController$Input.newInputStream(FsLockController.java:459) at de.schlichtherle.truezip.fs.FsFinalizeController$Input.newInputStream(FsFinalizeController.java:177) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Input$NewInputStream.call(FsFalsePositiveArchiveController.java:333) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Input$NewInputStream.call(FsFalsePositiveArchiveController.java:326) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$TryChild.call(FsFalsePositiveArchiveController.java:507) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.call(FsFalsePositiveArchiveController.java:104) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Input.newInputStream(FsFalsePositiveArchiveController.java:323) at de.schlichtherle.truezip.file.TFileInputStream.newInputStream(TFileInputStream.java:104) ... 6 more Suppressed: java.nio.file.FileSystemException: /usr/local/tomcat/amps_share/aps-action-share-7.0.0.amp/module.properties: Not a directory at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) at java.base/java.nio.file.Files.newByteChannel(Files.java:371) at java.base/java.nio.file.Files.newByteChannel(Files.java:422) at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420) at java.base/java.nio.file.Files.newInputStream(Files.java:156) at de.schlichtherle.truezip.fs.nio.file.FileInputSocket.newInputStream(FileInputSocket.java:51) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Input$NewInputStream.call(FsFalsePositiveArchiveController.java:333) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Input$NewInputStream.call(FsFalsePositiveArchiveController.java:326) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$UseParent.call(FsFalsePositiveArchiveController.java:524) at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.call(FsFalsePositiveArchiveController.java:107) ... 8 more 07050001 An error was encountered during deployment of the AMP into the WAR: 07050000 Unable to load module details from property file. File Not Found, /usr/local/tomcat/amps_share/aps-action-share-7.0.0.amp/module.properties The command '/bin/sh -c java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force' returned a non-zero code: 1