Dupplicate view without ID


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.

An idea to solve that trouble ?

Thank u in advance

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.

Hi @p.belloy

Great, thank you very much for you quick reply.

Best Regards,

Hi @p.belloy,

When reload view, I have this message in catalina.out: com.axelor.meta.loader.ViewLoader : duplicate found: country-grid

My custom country view do no override the default one.

Thank you for your help

So I suppose that the message is generated when it load your custom module ?
If this is the case, how is define your country-grid view ?

You’re right, see message is displayed when my module is loaded.

My country-grid is defined like that:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
	xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.0.xsd">
    <grid id="f-country-grid" name="country-grid" title="Countries" model="com.axelor.apps.base.db.Country">
        <field name="name"/>
        <field name="currency.name"/>
        <field name="phonePrefix" title="Phone Prefix"/>
        <field name="alpha2Code"/>
        <field name="numericCode"/>

Thank you for your help

Nothing weird. This should work.

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 i’m looking at the ViewLoader class I can see

		if (StringUtils.isBlank(xmlId)) {
			if (isVisited(view.getClass(), name)) {
				log.error("duplicate view without 'id': {}", name);
		} else if (isVisited(view.getClass(), xmlId)) {

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.


That’s strange.

Did you try on a fresh database ? Else, please post the full view reload logs .


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.

	protected boolean isVisited(Class<?> type, String name) {
		if (visited.get() == null) {
		if (visited.get().contains(type + name)) {
			log.error("duplicate found: {}", name);
			return true;
		visited.get().add(type + name);
		return false;

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

Thanks for your help


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.

Hi @p.belloy,

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.

I really appreciate.


you’re welcome
good to know you found it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.