a week ago
Hi all,
I'm trying to upgrade my Alfresco Content Services from 5.2 to 23.2, but I'm stuck with the error in the subject while starting Tomcat. I want to underline that Share runs correctly and I can work on my documents. The problems start when using Digital Workspace. This is how I ended up with it:
- I migrated data from my old 5.2 production installation to the new 23.2 one (both DB and contentstore)
- These data include a model which is supposed to disappear as we decided to move a third party customization to a different system
- Following this thread https://connect.hyland.com/t5/alfresco-forum/a-namespace-prefix-is-not-registered-simple-ocr/m-p/483... I used alfresco-model-extractor_linux_amd64 from Angel Borroy to extract the custom models from the AMPs provided by the third party company.
- I put the jar files produced by the binary into the webapps/alfresco/WEB-INF/lib directory so that Tomcat could load the models at bootstrap
Unluckily Tomcat returned this stack trace:
Error creating bean with name 'choc-alfresco' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/models-choc.jar!/alfresco/module/choc-alfresco/module-context.xml]: 07250001 Could not import bootstrap model 'alfresco/module/choc-alfresco/model/invoiceModel.xml'
...
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 07250001 Could not import bootstrap model 'alfresco/module/choc-alfresco/model/invoiceModel.xml'
...
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 07250000 Failed to compile model 'inv:model'
...
Caused by: org.alfresco.service.namespace.NamespaceException: URI http://www.pec.it/model/pec/1.0 cannot be imported as it is not defined (with prefix pec
After some investigations, I concluded that the jar files generated by the binary may be corrupted because if I try to extract them with "jar xf" I get this error:
java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor
at java.base/java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:529)
at java.base/java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:153)
at jdk.jartool/sun.tools.jar.Main.extract(Main.java:1395)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:397)
at jdk.jartool/sun.tools.jar.Main.main(Main.java:1721)
So I decided to replicate "by hand" what the binary model-extractor is supposed to do, that is create a directory structure where to put the files relative to the model, then fill the structures with the relevant files.
This time, after having copied the jar files into webapps/alfresco/WEB-INF/lib, Alfresco didn't complain about the Namespace, but about other xml files which it expects to find in the directory structure, e.g.:
...
Caused by: java.io.FileNotFoundException: class path resource [alfresco/module/choc/webscript-context.xml] cannot be opened because it does not exist
So I started to move the files extracted from the AMP inside the requested directories and I finally got this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enterpriseConfigurationDataCollector' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/alfresco-enterprise-repository-23.2.0.63.jar!/alfresco/enterprise/heartbeat/heartbeat-enterprise-repo-collector-context.xml]: Cannot resolve reference to bean 'querySetConfigService' while setting bean property 'querySetConfigService'
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'querySetConfigService' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/alfresco-enterprise-repository-23.2.0.63.jar!/alfresco/enterprise/query-set-context.xml]: Cannot resolve reference to bean 'populateRqaService' while setting bean property 'populateRqaService'
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'populateRqaService' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/alfresco-enterprise-repository-23.2.0.63.jar!/alfresco/enterprise/query-set-context.xml]: Cannot resolve reference to bean 'populateRqaTableWorkerFactory' while setting bean property 'workerObjectProvider'
...
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rqaWorkerConfig' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/alfresco-enterprise-repository-23.2.0.63.jar!/org/alfresco/enterprise/repo/queryaccelerator/population/config/RqaWorkerConfig.class]: Unsatisfied dependency expressed through constructor parameter 0: Cannot find class [it.maw.choc.model.ChocUtil] for bean with name 'choc.util.init' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/models-choc.jar!/alfresco/module/choc-alfresco/module-context.xml]
...
Caused by: java.lang.ClassNotFoundException: it.maw.choc.model.ChocUtil
As far as I can tell I'm now able to load the model, but then Alfresco tries to look for the classes which implement the model itself, that is exactly what I'm trying to avoid, since I want only to load the model in order not to have Alfresco complaining about namespaces definitions.
Is there another way to solve this problem? I'm perfectly fine also to migrate data from 5.2 to 7.4 and then to 23.2 if it can help.
Thanks in advance for any hints/suggestions.
Regards,
Marco
Wednesday - last edited Wednesday
Hi Marco,
look in alfresco/module/choc-alfresco/module-context.xml file. I guess that those file are listed there, maybe not in the correct order: maybe the model extractor is simply juxtaposing in alphabetical order and not consider the interdependence. I think that if you put in the correct order, everything should work.
If correct, we can poke Angel and ask for an enhancement. 🙂
a week ago
Hi Corvo,
the weird part is the generated JAR is corrupted. Do you have any error running the model extractor?
BTW, the model extractor extracts the models configuration and then bootstrap them using an xml file. If you want to do it manually, you should create an alfresco-platform-jar-archetype following the docs there, then add the models and then modify the bootstrap-context.xml file.
There's also another way, that I would suggest only in non-production environment: you can start Alfresco without any model, then upload the models in the Data Dictionary\Models in the repository, then modify their metadata and set Active to true.
Hope this helps
Wednesday
Hi Leo,
pretty weird indeed. It turned out that the jar files are ok. It must be something related to how the jar binary in Linux manages them. To cross check, I extracted the models using a Windows machine, the windows binary from Angel's repo, and the jar binary from Microsoft to extract the files. They were ok. Still I get these errors when I put them in webapps/alfresco/WEB-INF/lib:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'choc-alfresco' defined in URL [jar:file:/opt/apache-tomcat-10.1.24/webapps/alfresco/WEB-INF/lib/choc-models-win.jar!/alfresco/module/choc-alfresco/module-context.xml]: 07270001 Could not import bootstrap model 'alfresco/module/choc-alfresco/model/invoiceModel.xml'
...
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 07270001 Could not import bootstrap model 'alfresco/module/choc-alfresco/model/invoiceModel.xml'
...
Caused by: org.alfresco.service.namespace.NamespaceException: URI http://www.pec.it/model/pec/1.0 cannot be imported as it is not defined (with prefix pec
May these errors depend on how the custom models have been defined and implemented by the third party company? Had they developed the models following the standard Alfresco procedures, the extractor should provide a working jar file. Just guessing, though...
Thanks again for the support.
Regards,
Marco
Wednesday
Hi Marco,
the error is related by the pec namespace configuration that is not found. Maybe in the past that namespace was removed. Check if the pec namespace is used in the file alfresco/module/choc-alfresco/model/invoiceModel.xml in the jar created.
You should find the pec in the imports section, but search if it's also used in the rest of the model. If not, just remove the import. If yes you have to find the model file that creates the pec namespace.
You can also try creating a mockup model for the pec namespace, something like this
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="pec:something">
<description>the description</description>
<author>the creator</author>
<imports />
<namespaces>
<namespace uri="http://www.pec.it/model/pec/1.0" prefix="pec" />
</namespaces>
<data-types />
<constraints />
<aspects />
</model>
Best regards
Wednesday
Hi Leo,
the definition of the pec namespace is inside the pecModel.xml file which is present in my jar archive. The xml files with all the definitions are under alfresco/module/choc-alfresco/model and the complete list is:
addressbookModel.xml
agendaModel.xml
auditModel.xml
configModel.xml
conservazioneModel.xml
docsModel.xml
h2hModel.xml
invoiceModel.xml
m4iModel.xml
m4jModel.xml
mailAssignmentModel.xml
managedocModel.xml
massiveSender.xml
organizationModel.xml
pecModel.xml
protocolloModel.xml
signModel.xml
sorModel.xml
titolarioModel.xml
whistleblowingModel.xml
and the first lines of pecModel are:
<?xml version="1.0" encoding="UTF-8"?>
<model name="pec:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Pec Model</description>
<author>xxx</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<namespaces>
<namespace uri="http://www.pec.it/model/pec/1.0" prefix="pec" />
</namespaces>
so, as far as I understand, the invoiceModel should pick up the definition from pecModel.xml, right? But apparently it's not working. Where else could I look to understand why these definitions are ignored?
Thanks again for your support.
Regards,
Marco
Wednesday - last edited Wednesday
Hi Marco,
look in alfresco/module/choc-alfresco/module-context.xml file. I guess that those file are listed there, maybe not in the correct order: maybe the model extractor is simply juxtaposing in alphabetical order and not consider the interdependence. I think that if you put in the correct order, everything should work.
If correct, we can poke Angel and ask for an enhancement. 🙂
Wednesday
Hi Leo,
that was the point! I rearranged the lists of definitions in module-context.xml and it worked! Another small point: the executable defines a default module version 1.0.1 for the extracted modules. If newer modules are somehow seen by Alfresco, it complains telling you that the module you're trying to register is older than the one Alfresco sees.
Just in case you want to poke Angel to ask for some improvements in his model extractor.
Thanks a lot for your support. Really valuable.
Regards,
Marco
Wednesday
The model extractor determine the module version in the customization using the module.properties file, if not found it returns 1.0.0 and then it increments it to 1.0.1 (here's the source code). Can you please check if that file is present and in your amp/jar (should be in alfresco/module/<your-module-name>/module.properties ) and if the value of module.version param is specified ?
Thursday
Hi Leo,
yes, the file is alfresco/module/choc-alfresco/module.properties and the original value is
module.version=1.12.0
Then in the extracted module I found 1.0.1, which triggered the issue. I simply put
module.version=1.12.1
and that made the trick.
Regards,
Marco
Explore our Alfresco products with the links below. Use labels to filter content by product module.