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: LR 7.1 - StackOverflowError when customizing language keys
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/overriding-a-modules-language-keys
@Component(
immediate = true,
property = {
"bundle.symbolic.name=com.liferay.login.web",
"resource.bundle.base.name=content.Language",
"servlet.context.name=login-web"
}
)
public class LoginResourceBundleLoader implements ResourceBundleLoader {
private static final Log LOGGER = LogFactoryUtil.getLog(LoginResourceBundleLoader.class);
@Override
public ResourceBundle loadResourceBundle(Locale locale) {
LOGGER.info("loadResourceBundle: " + locale.toString());
return _resourceBundleLoader.loadResourceBundle(locale);
}
@Reference(
target = "(&(bundle.symbolic.name=com.liferay.login.web)(!(component.name=in.drifted.liferay.overrides.login.keys.LoginResourceBundleLoader)))"
)
public void setResourceBundleLoader(ResourceBundleLoader resourceBundleLoader) {
_resourceBundleLoader = new AggregateResourceBundleLoader(new CacheResourceBundleLoader(new ClassResourceBundleLoader("content.Language", LoginResourceBundleLoader.class.getClassLoader())), resourceBundleLoader);
}
private AggregateResourceBundleLoader _resourceBundleLoader;
}
However, there is a recursion in loadResourceBundle. In the log I can see over 1800 identical messages:
[LoginResourceBundleLoader:28] loadResourceBundle: en_US
which are followed by [status_jsp:927] com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.StackOverflowError
Any idea how to fix this?
LR 7.1 ga-1, tomcat 8.5
Hello,
I encountered the same problem. Were you able to find a solution or workaround? If so could you please post it?
Thanks in advance,
Michał
It is not resolved yet. Are you customizing login portlet or something else?
In meantime I've seen various ways how resource bundles are overridden, in some portlets there are additional entries in bnd.bnd file, in other aggregating is done slightly differently. In sum, I think there are various approaches.
But I still believe in documentation and I think this error is rather some bug in the login portlet, not in our approach (as it works in other portlet I tested).
I've just tested my customization in 7.1.1 and I am getting the same error.
Btw, for this newer version the kernel dependency in the pom.xml file must be updated to:
<dependency> <groupId>com.liferay.portal</groupId> <artifactId>com.liferay.portal.kernel</artifactId> <version>3.39.2</version> <scope>provided</scope> </dependency>
This issue has already been reported in https://issues.liferay.com/browse/LPS-86878
That pom.xml comment was related to the test project https://github.com/jan-tosovsky-cz/liferay-overrides-login-test which I created for that Jira ticket.
Jan Tošovský:It is not resolved yet. Are you customizing login portlet or something else?
Yes, I try to customize login portlet.
I've tested it on sample project:
https://github.com/liferay/liferay-blade-samples/tree/7.1/maven/overrides/resource-bundle-override
It seems that the problem is only with login module. When I change other module like blog or journal it works fine.
Powered by Liferay™