I would like to create my own module that overrides some view, action, etc.
To achieve that I created a new module with some domains and view definitions with the same name as original but when starting tomcat I have an error: duplicate view without 'id': purchase-request-form.
I understood that to be overriden, a view need to have the same ID as the one to override but the original one does not have an ID. Adding an ID to the original view can create trouble when updating from Git.
You need to set an unique id for the view or action that you want to overwrite. This is to keep track of xml view definitions during updates/reload of views. The original view doesn’t need to have an id, only overwritten views need it.
First, make sure there is no other view define with this id in your project (just to be sure). Before reload the views, try to remove all referrenced “Country” views. If still the issue, try on a fresh database (drop/create).
if (StringUtils.isBlank(xmlId)) {
if (isVisited(view.getClass(), name)) {
log.error("duplicate view without 'id': {}", name);
return;
}
} else if (isVisited(view.getClass(), xmlId)) {
return;
}
My view has an ID and is considered as Visited (msg duplicate found comes from AbstractLoader.isVisited) so my view enter in the seconf “if” and is not added.
Yes, this has been made with a fresh database. This message appears in the module install.
I will add some log in the AbstractLoader to understand this situation.
According to the code above (AbstractLoader) it seems that my view enter in the second IF and it’s really strange because the value of name is normally the id and each id is unique
The only explanation I have in mind, is that there is another view with that id somewhere in the source.
Maybe grep -Hrn --exclude-dir=build 'f-country-grid' * in your project root directory will show more than one occurrence. Else, try to change the id to another more complexe value, recompile, and deploy again.
We found the problem and I really apologize for that.
The reason is just that my collegue do no used my last commit, thus the compiled war used an ID with the same value as the NAME. I just tested myself with the good ID (with “f-” prefix) and it works now.
Thank you very much for your help and sorry for the time consuming of this f…g mistake.