Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Add more details to the fatal FlatJSPackage error message
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).
Feature Request Created: https://liferay.atlassian.net/browse/LPD-42483
Powered by Liferay™