In a previous blog, I mentioned an issue that I faced when upgrading an Alfresco Content Services 5.2 to 6.1 on a VM with no internet access. The solution was simply to change one of the schema “URL” so that it can fallback to local references, meaning that it will try to check and find the schema definition inside the jar files present in the classpath. When upgrading this exact same VM from 6.1 to 7.1, I had, again, the same error:
29-Nov-2021 08:19:07.891 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 29-Nov-2021 08:19:07.892 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.55] 29-Nov-2021 08:19:07.922 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying deployment descriptor [alfresco/alfresco-7.1.0.1/tomcat/conf/Catalina/localhost/share.xml] 2021-11-29 08:19:19,024 WARN [factory.xml.XmlBeanDefinitionReader] [main] Ignored XML validation warning org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 92; schema_reference.4: Failed to read schema document 'http://www.hazelcast.com/schema/spring/hazelcast-spring-2.4.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:100) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306) at java.xml/com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4257) ... Caused by: java.net.ConnectException: Connection refused (Connection refused) ... 2021-11-29 08:19:19,061 ERROR [web.context.ContextLoader] [main] Context initialization failed org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [surf-config.xml] Offending resource: class path resource [web-application-config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:alfresco/web-extension/*-context.xml] Offending resource: class path resource [surf-config.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 19 in XML document from file [alfresco/alfresco-7.1.0.1/tomcat/shared/classes/alfresco/web-extension/custom-slingshot-application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 92; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hz:topic'. at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:119) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:104) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:266) ... Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:alfresco/web-extension/*-context.xml] ... 29-Nov-2021 08:19:19.074 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file 29-Nov-2021 08:19:19.077 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Context [/share] startup failed due to previous errors
The first thing I checked was obviously if there were any differences between the previous and the new versions of the custom-slingshot-application-context.xml files. There was none, so it is not exactly the same issue, but it has the same consequences:
alfresco@alfvm01:alfresco$ ll total 16 drwxr-x--- 4 alfresco alfresco 4096 Nov 26 09:15 ./ drwxr-xr-x 10 alfresco alfresco 4096 Nov 26 10:09 ../ drwxr-x--- 8 alfresco alfresco 4096 Nov 29 08:11 alfresco-6.1.1.3/ drwxr-x--- 8 alfresco alfresco 4096 Nov 29 14:44 alfresco-7.1.0.1/ alfresco@alfvm01:alfresco$ alfresco@alfvm01:alfresco$ diff alfresco-*/tomcat/shared/classes/alfresco/web-extension/custom-slingshot-application-context.xml alfresco@alfvm01:alfresco$
Since the file should normally be fine and able to fetch classpath definitions, then the issue would most probably be that either there are no jar files present anymore or the specific version that Share is looking for (as written in the log file: hazelcast-spring-2.4.xsd) doesn’t exist/isn’t found. So that’s what I looked into then:
alfresco@alfvm01:alfresco$ find alfresco-*/tomcat/webapps/share/ -name "*hazelcast*jar*" alfresco-6.1.1.3/tomcat/webapps/share/WEB-INF/lib/hazelcast-2.4.jar alfresco-6.1.1.3/tomcat/webapps/share/WEB-INF/lib/hazelcast-spring-2.4.jar alfresco-7.1.0.1/tomcat/webapps/share/WEB-INF/lib/hazelcast-3.12.6.jar alfresco-7.1.0.1/tomcat/webapps/share/WEB-INF/lib/hazelcast-spring-3.12.6.jar alfresco@alfvm01:alfresco$
As you can see, the version of Hazelcast has been upgraded from 2.4 to 3.12. So, it’s probably a version mismatch since the jar files are present properly. Therefore, looking for the 2.4 XSD definition file inside the jar file is the next step:
alfresco@alfvm01:alfresco$ jar -tvf alfresco-6.1.1.3/tomcat/webapps/share/WEB-INF/lib/hazelcast-spring-2.4.jar | grep 'hazelcast-spring.*xsd' 44024 Wed Oct 17 17:51:56 CEST 2012 hazelcast-spring-2.4.xsd alfresco@alfvm01:alfresco$ alfresco@alfvm01:alfresco$ jar -tvf alfresco-7.1.0.1/tomcat/webapps/share/WEB-INF/lib/hazelcast-spring-3.12.6.jar | grep 'hazelcast-spring.*xsd' 178900 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.8.xsd 106805 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.4.xsd 56119 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.2.xsd 190415 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.9.xsd 52802 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.1.xsd 294159 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.12.xsd 148564 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.6.xsd 50037 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.0.xsd 262083 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.11.xsd 62043 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.3.xsd 157063 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.7.xsd 129308 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.5.xsd 236019 Thu Jan 30 20:44:00 CET 2020 hazelcast-spring-3.10.xsd alfresco@alfvm01:alfresco$
As seen, the 2.4 XSD definition isn’t available in the new jar file, which would therefore be the culprit. The solution should then be to use the correct XSD definition version (switch from 2.4 to 3.12) in the custom-slingshot-application-context.xml file:
alfresco@alfvm01:alfresco$ sed -i 's,2.4,3.12,' alfresco-7.1.0.1/tomcat/shared/classes/alfresco/web-extension/custom-slingshot-application-context.xml alfresco@alfvm01:alfresco$ alfresco@alfvm01:alfresco$ diff alfresco-*/tomcat/shared/classes/alfresco/web-extension/custom-slingshot-application-context.xml 8c8 < http://www.hazelcast.com/schema/spring/hazelcast-spring-2.4.xsd"> --- > http://www.hazelcast.com/schema/spring/hazelcast-spring-3.12.xsd"> 13c13 < - and specifically http://docs.hazelcast.org/docs/2.4/manual/html-single/#SpringIntegration --- > - and specifically http://docs.hazelcast.org/docs/3.12/manual/html-single/#SpringIntegration alfresco@alfvm01:alfresco$
After the update and a restart, the Share Clustering is able to start and it is working successfully:
29-Nov-2021 08:34:12.776 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 29-Nov-2021 08:34:12.777 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.55] 29-Nov-2021 08:34:12.796 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying deployment descriptor [alfresco/alfresco-7.1.0.1/tomcat/conf/Catalina/localhost/share.xml] ... 29-Nov-2021 08:34:26.437 INFO [main] com.hazelcast.system.null [alfvm01.domain.com]:5801 [slingshot] [3.12.6] Hazelcast 3.12.6 (20200130 - be02cc5) starting at [alfvm01.domain.com]:5801 29-Nov-2021 08:34:26.437 INFO [main] com.hazelcast.system.null [alfvm01.domain.com]:5801 [slingshot] [3.12.6] Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. ... 29-Nov-2021 08:34:27.729 INFO [main] com.hazelcast.core.LifecycleService.null [alfvm01.domain.com]:5801 [slingshot] [3.12.6] [alfvm01.domain.com]:5801 is STARTING ... 29-Nov-2021 08:34:28.790 INFO [main] com.hazelcast.core.LifecycleService.null [alfvm01.domain.com]:5801 [slingshot] [3.12.6] [alfvm01.domain.com]:5801 is STARTED
Currently, the Alfresco documentation contains the wrong references to the 2.4 version. I opened a PR to correct the documentation to use the 3.12 version instead (impacts all versions starting from ACS 7.0) so hopefully it should be updated soon. In the meantime, check that you are using the correct versions! In case your server does have internet access, then you will not have any issues but that means that Alfresco will always perform internet lookups to retrieve the 2.4 version of the XSD definition.