Add more details to the fatal FlatJSPackage error message

تم تعديل Jan Tošovský منذ 1 سنة من الدقائق. Liferay Master المشاركات: 576 تاريخ الإنضمام: 22‏/7‏/10 المشاركات الحديثة

Recently I had to recover the server from a backup after clearing the /osgi/state, because I was getting "A JS module with the same name already exists" exception when the server was restarted. There are over 100 custom modules in my instance and it was unclear which one is faulty. The issue was fatal as I couldn't even show the login page.

Later I was able to detect the problematic module by tweaking the relevant code, which now prints the given module details:
https://github.com/liferay/liferay-portal/blob/master/modules/apps/frontend-js/frontend-js-loader-modules-extender/src/main/java/com/liferay/frontend/js/loader/modules/extender/internal/npm/flat/FlatJSPackage.java

if (_jsModules.putIfAbsent(jsModule.getName(), jsModule) != null) {
	throw new IllegalStateException(
		"A JS module with the same name " + jsModule.getName() + " (" + getId() + ") already exists in " + _jsModules.get(jsModule.getName()).getJSPackage().getId());
}

It would be nice to have something like this directly in the LR code. After removing that module (a JSP override containing a main.js file) the server restarted successfully. Once that module was redeployed, no similar exception was thrown anymore (it will be thrown next time the /osgi/state/ is cleared).

 

thumbnail
تم تعديل Jamie Sammons منذ 1 سنة من الدقائق. Expert المشاركات: 367 تاريخ الإنضمام: 5‏/9‏/14 المشاركات الحديثة

Feature Request Created: https://liferay.atlassian.net/browse/LPD-42483