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: Liferay 7.0 CustomSQL Gives an error- Null is not a valid include
When I put
I have the default.xml in the custom-sql folder within resources / META-INF and in my build.gradle
I am doing something wrong?
@ServiceReference (type = CustomSQL.class)
private CustomSQL _customSQL;in my * FinderImpl.java of my service module, I get an error in the web module:ERROR [http-nio-8080-exec-5][MVCPortlet:589] null is not a valid includeeven without actually using it.I have the default.xml in the custom-sql folder within resources / META-INF and in my build.gradle
compile group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.4"The import com.liferay.portal.dao.orm.custom.sql.CustomSQL is done correctly .
I am doing something wrong?
Hi Cesar,
I am pretty sure I had the same problem around this time last year. Just looking back at that project I ended up just using --
I don't have an @ServiceReference at all. Now I know that in the case of the *LocalService classes, it's bad form to use the Util version as you don't reap the benefits of OSGI dependency management etc, but it looks like in the end I just stuck with a straight call.
I am pretty sure I had the same problem around this time last year. Just looking back at that project I ended up just using --
import com.liferay.portal.dao.orm.custom.sql.CustomSQLUtil;and for my gradle reference I havecompileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.4"I don't have an @ServiceReference at all. Now I know that in the case of the *LocalService classes, it's bad form to use the Util version as you don't reap the benefits of OSGI dependency management etc, but it looks like in the end I just stuck with a straight call.
String sql = CustomSQLUtil.get(getClass(), FIND_RECIPIENTS);FWIWT, normally when I am using an @ServiceReference I include the full canonical name -- so in this case it would be@ServiceReference(type=com.liferay.portal.dao.orm.custom.sql.CustomSQL.class)
private CustomSQL _customSQL;
Not sure if that will make a difference, but it'd be an easy test.