Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DE not compatible with Alfresco Records Management #201

Closed
rschev opened this issue Mar 21, 2019 · 6 comments
Closed

DE not compatible with Alfresco Records Management #201

rschev opened this issue Mar 21, 2019 · 6 comments

Comments

@rschev
Copy link
Member

rschev commented Mar 21, 2019

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

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

Expected Behavior

Dynamic Extensions does not interfere with other modules and can start up when Alfresco Records Management is installed

Current Behavior

Dynamic Extensions encounters a fatal error because it can't find the content model of the Records Management module. This prevents the entire Alfresco system from properly starting up.

Possible Solution

Just carry on when you can't find a content model?

Steps to Reproduce (for bugs)

  1. Apply the Records Management amp (org.alfresco:alfresco-rm-enterprise-repo:2.5.3@amp and org.alfresco:alfresco-rm-enterprise-share:2.5.3@amp) to your Alfresco
  2. Boot it up, observe no errors in the log
  3. Apply the Dynamic Extensions 1.7.6 amp to your Alfresco
  4. Boot it up again, observe the stacktrace (see comment)

Context

Delivering a product to a customer that requires DE, they can't install it because they also use records management.

Your Environment

  • Alfresco version used: 5.1.1 Enterprise
  • DE version used: 1.7.5 and 1.7.6
  • Reproduced with our docker and gradle setup
@rschev
Copy link
Member Author

rschev commented Mar 21, 2019

Stacktrace during startup:

[ALFRESCO] 2019-03-21 11:35:49,363  ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
 org.alfresco.error.AlfrescoRuntimeException: 02210003 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:555)
        at org.alfresco.repo.module.ModuleComponentHelper.startModules(ModuleComponentHelper.java:213)
        at org.alfresco.repo.module.ModuleServiceImpl.startModules(ModuleServiceImpl.java:149)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy83.startModules(Unknown Source)
        at org.alfresco.repo.module.ModuleStarter$1.execute(ModuleStarter.java:73)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:352)
        at org.alfresco.repo.module.ModuleStarter$2.doWork(ModuleStarter.java:83)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
        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:214)
        at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:185)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 02210002 A module component 'osgi.container.ModuleComponent' failed to execute: org.alfresco.service.cmr.dictionary.DictionaryException: 02210001 Model '{http://www.alfresco.org/model/rmcustom/1.0}rmcustom' does not exist
        at org.alfresco.error.AlfrescoRuntimeException.create(AlfrescoRuntimeException.java:60)
        at org.alfresco.repo.module.AbstractModuleComponent.execute(AbstractModuleComponent.java:365)
        at org.alfresco.repo.module.ModuleComponentHelper.executeComponent(ModuleComponentHelper.java:736)
        at org.alfresco.repo.module.ModuleComponentHelper.startModule(ModuleComponentHelper.java:647)
        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:464)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:352)
        at org.alfresco.repo.module.ModuleComponentHelper$1.doWork(ModuleComponentHelper.java:284)
        ... 45 more
Caused by: java.lang.RuntimeException: org.alfresco.service.cmr.dictionary.DictionaryException: 02210001 Model '{http://www.alfresco.org/model/rmcustom/1.0}rmcustom' does not exist
        at com.github.dynamicextensionsalfresco.osgi.OsgiContainerModuleComponent.startFramework(OsgiContainerModuleComponent.java:98)
        at com.github.dynamicextensionsalfresco.osgi.OsgiContainerModuleComponent.executeInternal(OsgiContainerModuleComponent.java:56)
        at org.alfresco.repo.module.AbstractModuleComponent.execute(AbstractModuleComponent.java:361)
        ... 52 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 02210001 Model '{http://www.alfresco.org/model/rmcustom/1.0}rmcustom' does not exist
        at org.alfresco.repo.dictionary.AbstractDictionaryRegistry.getModel(AbstractDictionaryRegistry.java:122)
        at org.alfresco.repo.dictionary.DictionaryDAOImpl.getCompiledModel(DictionaryDAOImpl.java:322)
        at org.alfresco.repo.dictionary.DictionaryDAOImpl.getAspects(DictionaryDAOImpl.java:584)
        at org.alfresco.repo.dictionary.DictionaryComponent.getAspects(DictionaryComponent.java:207)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl.initCustomMap(RecordsManagementAdminServiceImpl.java:416)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl.access$000(RecordsManagementAdminServiceImpl.java:93)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl$1$1.execute(RecordsManagementAdminServiceImpl.java:189)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl$1$1.execute(RecordsManagementAdminServiceImpl.java:185)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:333)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl$1.doWork(RecordsManagementAdminServiceImpl.java:193)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl.onApplicationEvent(RecordsManagementAdminServiceImpl.java:180)
        at org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl.onApplicationEvent(RecordsManagementAdminServiceImpl.java:92)
        at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:214)
        at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:194)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at com.github.dynamicextensionsalfresco.osgi.OsgiContainerModuleComponent.initializeOsgiContainerApplicationContext(OsgiContainerModuleComponent.java:109)
        at com.github.dynamicextensionsalfresco.osgi.OsgiContainerModuleComponent.startFramework(OsgiContainerModuleComponent.java:96)
        ... 54 more

@rschev
Copy link
Member Author

rschev commented Mar 21, 2019

The problem seems to be avoided (I don't dare say fixed) with an empty catch:

diff --git a/alfresco-integration/shared/src/main/java/com/github/dynamicextensionsalfresco/osgi/OsgiContainerModuleComponent.java b/alfresco-integration/shared/src/main/java/com/github/dynamicextensionsalfresco/osgi/OsgiContainerModuleComponent.java
index ab82ecb..eb40cfe 100644
--- a/alfresco-integration/shared/src/main/java/com/github/dynamicextensionsalfresco/osgi/OsgiContainerModuleComponent.java
+++ b/alfresco-integration/shared/src/main/java/com/github/dynamicextensionsalfresco/osgi/OsgiContainerModuleComponent.java
@@ -5,6 +5,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
 import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
 import org.alfresco.repo.transaction.RetryingTransactionHelper;
 import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
+import org.alfresco.service.cmr.dictionary.DictionaryException;
 import org.alfresco.service.transaction.TransactionService;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -94,6 +95,8 @@ public class OsgiContainerModuleComponent extends AbstractModuleComponent implem
                if (childApplicationContext == null) {
                        try {
                                initializeOsgiContainerApplicationContext();
+                       } catch (DictionaryException d ) {
+                               // explicitly do nothing
                        } catch (final Exception e) {
                                throw new RuntimeException(e);
                        }

This allows the Alfresco to start up, and both modules seem to work correctly.

@al-sabr
Copy link
Contributor

al-sabr commented May 12, 2019

If Alfresco Records Management is a new service or module it should be added in the DE so that it gets listed by the OSGi runtime and can be used inside of OSGi Bundle.

Look inside of the /META-INF/spring/osgi-container/services/alfresco-services.txt and classpath:/META-INF/spring/osgi-container/services/osgi-container-services.txt to validate that ARManager is in there maybe ?

This is where it is located :

<value>classpath:/META-INF/spring/osgi-container/services/alfresco-services.txt</value>

@kerkhofsd
Copy link
Contributor

kerkhofsd commented Jan 3, 2020

The problem is that the recordsCustomModel.xml is loaded as a cm:dictionaryModel via content bootstrapping. (See RMDataDicationaryBootstrap.xml).
When the DE framework is starting, it publishes an ContextRefreshedEvent and apparently the content bootstrapping is not yet done at the time the Records Management module handels this event (See RecordsManagementAdminServiceImpl#onApplicationEvent)

@kerkhofsd
Copy link
Contributor

Interesting observations:

  • Alfresco class: ChildApplicationContextFactory#ChildApplicationContext#publishEvent(ApplicationEvent event)
        @Override
        public void publishEvent(ApplicationEvent event)
        {
            Assert.notNull(event, "Event must not be null");
            if (logger.isTraceEnabled())
            {
                logger.trace("Publishing event in " + getDisplayName() + ": " + event);
            }
            ((ApplicationEventMulticaster) getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)).multicastEvent(event);

            if (!(getParent() == null || event instanceof ContextRefreshedEvent || event instanceof ContextClosedEvent))
            {
                getParent().publishEvent(event);
            }
        }

-> Seems like Alfresco doesn't want the ContextRefreshedEvent being propagated to the main application context either...

@kerkhofsd
Copy link
Contributor

Closed via #299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants