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: Unable find model model.impl.TestImpl java.lang.ClassNotFoundException:
Hi All,
currently I'm working on Liferay dxp EE
How to Resolve this issue [DynamicQueryFactoryImpl:103]
Unable find model model.impl.TestImpl
java.lang.ClassNotFoundException: model.impl.TestImpl
But In liferay dxp i'm using below dynamic query
DynamicQuery dynn = TestLocalServiceUtil.dynamicQuery();
Please advice me it's very helpful.
Kiran.
If you are using DXP, you should not be using the static util class.
Change over to the TestLocalService and have it injected using OSGi's @Reference annotation.
Thanks david for your quick response,
these issue was resolved following below code for change in Liferay DXP.
In liferay 6.2 DynamicQuery dynamic =DynamicQueryFactoryUtil.forClass(Test.class);
In liferay DXP DynamicQuery dynamic = TestLocalServiceUtil.dynamicQuery();
Thanks,
Kiran.
Right, but for DXP you should not use TestLocalServiceUtil.
Instead, your class should have the @Component annotation, then somewhere inside you'd have like:
@Reference<br> private TestLocalService _testLocalService;
Then your actual Liferay DXP code becomes:
DynamicQuery dynamic = _testLocalService.dynamicQuery();
Also, as a side note, in 6.2 you could also (and should also) have used TestLocalService.dynamicQuery() as it avoids the class loader issues.
Powered by Liferay™