Last active
March 12, 2024 10:51
-
-
Save aitseitz/89fbd80bb63fa38c3f13449f3df15ec3 to your computer and use it in GitHub Desktop.
ACS: How to downgrade an AMP-Module like alfresco-aos-module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on Tech Article: | |
// https://community.hyland.com/tskb/000013140-how-to-downgrade-the-outlook-integration-module-after-installing-unsupported-amp-version | |
// the correct uuid for the amp module needs to be identified via the node browser inside the system://system Store | |
var sysNodeUUID = "system://system/8b6df670-9bb3-462b-8483-9b156e2621fd"; | |
var newVersionString = "1.0.0"; | |
/** | |
* Searches for the target node and sets a fix Version for "module:currentVersion" | |
* @param sysNodeUUID {String} module node string e.g. "system://system/uuid" | |
* @param newVersionString {String} the version which will be set for the target node | |
*/ | |
function setFixModuleVersion(sysNodeUUID, newVersionString) { | |
var targetNode = search.findNode(sysNodeUUID); | |
if (targetNode) { | |
logger.log("Fixing Module Version for '" + targetNode.properties["cm:name"] + "':"); | |
logger.log("Module '" + targetNode.properties["cm:name"] + "' (before change) Version = " + targetNode.properties["module:currentVersion"]); | |
targetNode.properties["module:currentVersion"] = newVersionString; | |
targetNode.save(); | |
logger.log("Module '" + targetNode.properties["cm:name"] + "' (after change) Version = " + targetNode.properties["module:currentVersion"]); | |
} else { | |
logger.error("Target Node not found in for " + sysNodeUUID); | |
} | |
} | |
setFixModuleVersion(sysNodeUUID, newVersionString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR [org.springframework.web.context.ContextLoader] [localhost-startStop-1] Context initialization failed | |
org.alfresco.error.AlfrescoRuntimeException: 06060023 Failed to start modules | |
at org.alfresco.repo.module.ModuleComponentHelper$1.doWork(ModuleComponentHelper.java:326) | |
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:602) | |
at org.alfresco.repo.module.ModuleComponentHelper.startModules(ModuleComponentHelper.java:213) | |
at org.alfresco.repo.module.ModuleServiceImpl.startModules(ModuleServiceImpl.java:149) | |
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) | |
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.base/java.lang.reflect.Method.invoke(Method.java:566) | |
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) | |
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) | |
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) | |
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) | |
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) | |
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) | |
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) | |
at com.sun.proxy.$Proxy154.startModules(Unknown Source) | |
at org.alfresco.repo.module.ModuleStarter$1.execute(ModuleStarter.java:73) | |
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450) | |
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:338) | |
at org.alfresco.repo.module.ModuleStarter$2.doWork(ModuleStarter.java:83) | |
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:602) | |
at org.alfresco.repo.module.ModuleStarter.onBootstrap(ModuleStarter.java:78) | |
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56) | |
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:221) | |
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:186) | |
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:206) | |
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) | |
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) | |
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) | |
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) | |
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) | |
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) | |
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) | |
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70) | |
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4705) | |
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5168) | |
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) | |
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743) | |
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719) | |
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) | |
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672) | |
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1873) | |
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) | |
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) | |
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) | |
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) | |
at java.base/java.lang.Thread.run(Thread.java:829) | |
Caused by: org.alfresco.error.AlfrescoRuntimeException: 06060022 | |
Downgrading of modules is not supported. | |
Module 'alfresco-aos-module' version 1.3.2.1 is currently installed and must be uninstalled before version 1.3.0 can be installed. | |
at org.alfresco.error.AlfrescoRuntimeException.create(AlfrescoRuntimeException.java:52) | |
at org.alfresco.repo.module.ModuleComponentHelper.startModule(ModuleComponentHelper.java:633) | |
at org.alfresco.repo.module.ModuleComponentHelper.access$5(ModuleComponentHelper.java:530) | |
at org.alfresco.repo.module.ModuleComponentHelper$1$1.execute(ModuleComponentHelper.java:263) | |
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450) | |
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:338) | |
at org.alfresco.repo.module.ModuleComponentHelper$1.doWork(ModuleComponentHelper.java:284) | |
... 46 more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Alternative solution --> Delete AMP Module row from DB: | |
-- Select AOS Module Row | |
SELECT * FROM | |
alf_node_properties prop, | |
alf_qname qname, | |
alf_namespace ns, | |
alf_node_properties prop2 | |
WHERE | |
prop.qname_id = qname.id | |
and qname.ns_id = ns.id | |
and prop2.node_id = prop.node_id | |
and qname.local_name='currentVersion' | |
and ns.uri='http://www.alfresco.org/system/modules/1.0' | |
and prop2.string_value='alfresco-aos-module' | |
-- Delete AOS AMP row from PostgreSQL Database | |
DELETE FROM | |
alf_node_properties prop | |
USING | |
alf_qname qname, | |
alf_namespace ns, | |
alf_node_properties prop2 | |
where | |
prop.qname_id = qname.id | |
and qname.ns_id = ns.id | |
and prop2.node_id = prop.node_id | |
and qname.local_name='currentVersion' | |
and ns.uri='http://www.alfresco.org/system/modules/1.0' | |
and prop2.string_value='alfresco-aos-module' |
easier approach: use the node browser from the admin console (not share) and just delete the module registration. It will be recreated once alfresco restarts.
You could do this also by a javascript like:
var searchString = "/sys:system-registry/module:modules/*"; // XPath search string
var store = "system://system";
var nodes = search.selectNodes(store, searchString);
for each (var node in nodes) {
logger.log("removing entry for module: " + node.name);
node.addAspect("sys:temporary");
node.remove();
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resetting an AMP Guide as workaround for MNT-22303
This knowledge article describes one option to reset the version of on installed AMP. This only works if the AMP itself does not have incremental model changes!
In the latest AOS v1.3.2 for ACS 6.2.2 exists a bug which prevents users to create files over network drive:

--> https://alfresco.atlassian.net/browse/MNT-22303
Prefered Solution:
--> Upgrade to AOS v.1.3.3 or higher
At the time of writing this article, the bugfixed version v.1.3.3 from Alfresco is in pipe and not yet available at the time of writing this article.
Current Workaround:
--> Downgrade to AOS v1.3.0 or AOS v1.3.1
(AOS 1.3.1 is only available via Nexus, not via hyland support portal)
When you downgrade to AOS v.1.3.0 you'll end up getting this error in the alfresco.log
How to reset AOS AMP Module Version (via Share)
Info: the steps describes are based on technical article
https://community.hyland.com/tskb/000013140-how-to-downgrade-the-outlook-integration-module-after-installing-unsupported-amp-version
Prequirements:
Java-Script Console Plugin should be installed in share https://github.com/share-extras/js-console
Stop ACS
For exmple:
Uninstall the current version of the alfresco-aos-module via alfresco-mmt.jar:
Start ACS you'll see the following output in alfresco.log:
Navigate to the Module Registry via NodeBrowser (System://System Store)

Locate the module:alfresco-aos-module in /sys:system-registry/module:modules
The "module:currentVersion" property specifies the version of the module against which the new installed version is compared at system startup.

Copy the full system UUID of the module
In our case that's
"system://system/76c99fa4-675e-46e0-93e4-6d2239ec91a9"
Insert the system UUID into the [acs_downgrade_amp_module.js]
--> Reset AMP Version String to something lower then 1.3.2
(https://gist.github.com/aitseitz/89fbd80bb63fa38c3f13449f3df15ec3#file-acs_downgrade_amp_module-js)
Execute the acs_downgrade_amp_module.js in the Java-Script Console

Verify the change in NodeBrowser:

Stop ACS
Install the AOS v.1.3.0 with apply_amps.sh or directly via alfresco-mmt.jar
Details see: https://docs.alfresco.com/content-services/6.2/develop/extension-packaging/#using-the-module-management-tool-mmt
How to reset AMP Module Version (via SQL):
Alternative solution is to remove the whole AMP Module row from the DB with the following SQL (for PostgreSQL):
removeAMPVersionString.sql
The difference is that manually deleting rows in the db can be be a higher risk (so make a backup befor you do so). After the amp row was deleted and you boot up acs again in the alfresco.log the information that a previous module version was installed is missing...