Service Builder: cleanServiceBuilder throws "The url cannot be null"

thumbnail
Mirto Silvio Busico, modified 7 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts

Hi all,

in LR 7.1 CE GA 1 using Liferay IDE, trying to use the gradle task cleanServiceBuilder gives the error "The url cannot be null"

 

Working Directory: C:\appoggio\liferay\eclipse\wslr71ga1\msb\modules\msb-db\msb-db-service
Gradle User Home: C:\Users\mbusico\.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 3.0
Java Home: C:\Program Files\Java\jdk1.8.0_171
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: cleanServiceBuilder

:modules:msb-db:msb-db-service:cleanServiceBuilderException in thread "main" java.sql.SQLException: The url cannot be null
    at java.sql.DriverManager.getConnection(DriverManager.java:649)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at com.liferay.portal.tools.db.support.commands.BaseCommand.execute(BaseCommand.java:32)
    at com.liferay.portal.tools.db.support.DBSupport.main(DBSupport.java:75)
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':modules:msb-db:msb-db-service:cleanServiceBuilder'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_171\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.89 secs

 

What can I do?

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Mirto Silvio Busico:

in LR 7.1 CE GA 1 using Liferay IDE, trying to use the gradle task cleanServiceBuilder gives the error "The url cannot be null"

Can you provide your build.gradle and your jdbc.properties (if you're using a properties file to configure the JDBC connection for cleanServiceBuilder)?

thumbnail
Mirto Silvio Busico, modified 7 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts

Well, I suppose you mean the the build.gradle file in the service directory tree (see screenshot below).

This file contains

dependencies {
    compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.5.0"
    compileOnly group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"
    compileOnly project(":modules:msb-db:msb-db-api")
}

buildService {
    apiDir = "../msb-db-api/src/main/java"
}

group = "msb.db"

 

About jdbc.properties file, I cannot find this file in the directory tree and I didn't create this file.

 

 

 

 

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Mirto Silvio Busico:

This file contains

dependencies {
    compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.5.0"
    compileOnly group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"
    compileOnly project(":modules:msb-db:msb-db-api")
}

buildService {
    apiDir = "../msb-db-api/src/main/java"
}

group = "msb.db"

 

About jdbc.properties file, I cannot find this file in the directory tree and I didn't create this file.

It doesn't look like you've configured anything for cleanServiceBuilder at all. At a minimum, I would have expected to see the dbSupport dependencies, as mentioned in the DB Support Gradle Plugin documentation, since that tells the plugin which JDBC driver to use.

So to summarize, based on what I see in your configuration right now, the Gradle tooling doesn't know which database to look at or where to find its database driver, and that's where your error is coming from. You have to manually modify your build.gradle to set at least some of the properties described in the DB Support Gradle Plugin documentation to tell it what to do and where to find its dependencies.

If you have no idea where to start, unfortunately there isn't any official documentation on how to configure and use that task, and there aren't any public-facing examples (most of the examples I know about are in private repositories), so you're mostly on your own. However, you can model the changes after the code sample that was provided to our QA team in order to test LPS-76854. It was created for 7.0, but it might work for 7.1.

thumbnail
Mirto Silvio Busico, modified 7 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts

Thanks

I'll try asap

 

Alejandro Espartaco Alvarez, modified 5 Years ago. New Member Posts: 13 Join Date: 9/10/12 Recent Posts
Hi, were you able to solve the issue, how?
thumbnail
Mirto Silvio Busico, modified 5 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts
Hi, I gave up with this problem because of new Lifereay releases.
Asap I'll try to use the latest version I'll try to replicate the isssue.

Thanks