0

I'm trying to use MS SQL driver with jdbc app with local data flow server jdbc --url='jdbc:sqlserver://server' --driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

As expected, the driver is not in classpath and I get Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver when deploying the stream.

I also tried to invoke the data flow server with -cp argument:

java -cp "C:\path\to\msjdbc.jar " -jar spring-cloud-dataflow-server-local-1.0.1.RELEASE.jar - same result.

Can anyone help to resolve this ?

Thanks

Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24

2 Answers2

1

The local dataflow server spawns the app in a separate process and doesn't use the classpath resources for the app. Hence, I think you need to add the driver into jdbc app path. or, you can try setting the classpath local deployer deployment property for the app when deploying the stream. When specifying spring.cloud.deployer.local.classpath property, the property spring.cloud.deployer.local.main also needs to be specified.

stream create a1 --definition "time | jdbc"

stream deploy a1 --properties "app.jdbc.spring.cloud.deployer.local.classpath=/temp/myclasspath,app.jdbc.spring.cloud.deployer.local.main="

Ilayaperumal Gopinathan
  • 4,099
  • 1
  • 13
  • 12
  • Thanks, it does make sense, what should be the `main` in this case ? – Alexander.Furer Nov 08 '16 at 13:41
  • It is the java main application class of the app. If you are using the out-of-the box `jdbc` sink and `app` has `rabbit` binder, then your `main` class is: `org.springframework.cloud.stream.app.jdbc.sink.rabbit.JdbcSinkRabbitApplication`. – Ilayaperumal Gopinathan Nov 08 '16 at 13:48
  • I've tried what you've suggested, but these deployment properties some how got striped out from `deploymentProperties` map. I've run remote debugger and see that they being passed correctly to the `StreamDeploymentController` , but they disappeared from `AppDeploymentRequest` when I reached `AbstractLocalDeployerSupport::buildExecutionCommand` method. – Alexander.Furer Nov 08 '16 at 15:59
  • I also followed the Patching pre-built applications guide from http://docs.spring.io/spring-cloud-stream-app-starters/docs/current-SNAPSHOT/reference/htmlsingle/#_patching_pre_built_applications, but `app info source:ms-jdbc` shows empty table. Please advise – Alexander.Furer Nov 08 '16 at 16:01
  • For `app info source:ms-jdbc` to work you need to specify whitelisted properties. http://docs.spring.io/spring-cloud-dataflow/docs/1.1.0.BUILD-SNAPSHOT/reference/html/spring-cloud-dataflow-register-apps.html#spring-cloud-dataflow-stream-app-whitelisting – Ilayaperumal Gopinathan Nov 09 '16 at 06:09
  • Also, which version of `deployer` are you using? may be the version you are using doesn't support `classpath`. You can try using `1.1.0.BUILD-SNAPSHOT`. – Ilayaperumal Gopinathan Nov 09 '16 at 06:13
0

Thanks for your suggestions Ilayaperumal Gopinathan, it helped me to resolve the issue. Looks like the usage of app.jdbc.spring.cloud.deployer.local.classpath and app.jdbc.spring.cloud.deployer.local.main is undocumented feature and it didn't work for me (at lest with 1.0.1.Release)

I've managed to patch the pre-built jdbc starter and include MS jdbc driver following the documentation from http://docs.spring.io/spring-cloud-stream-app-starters/docs/current-SNAPSHOT/reference/htmlsingle/#_patching_pre_built_applications.

It didn't work with 1.0.1.Release due to this bug (https://github.com/spring-cloud/spring-cloud-dataflow/issues/748) that was resolved in 1.1.0.Snapshot.

I didn't have to specify any whitelisted properties and 1.1.0.Snapshot picked them up properly from inner jar.

Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24