Bootique, Cayenne and production

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bootique, Cayenne and production

Pascal Robert-2
Hi,

I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:

jdbc:
  mysql:
    driverClassName: com.mysql.jdbc.Driver
    url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
    initialSize: 1
    username: xxxxx
    password: xxxxx

cayenne:
  datasource: mysql

But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.

INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml

INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.

What’s the trick?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik
The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.

Andrus

> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>
> Hi,
>
> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>
> jdbc:
>  mysql:
>    driverClassName: com.mysql.jdbc.Driver
>    url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>    initialSize: 1
>    username: xxxxx
>    password: xxxxx
>
> cayenne:
>  datasource: mysql
>
> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>
> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>
> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>
> What’s the trick?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik
> from CayenneModel

Imprecise term. Of course I meant "remove from your project using CayenneModeler" :)

Andrus


> On Jun 9, 2017, at 6:37 PM, Andrus Adamchik <[hidden email]> wrote:
>
> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>
> Andrus
>
>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>
>> Hi,
>>
>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>
>> jdbc:
>> mysql:
>>   driverClassName: com.mysql.jdbc.Driver
>>   url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>   initialSize: 1
>>   username: xxxxx
>>   password: xxxxx
>>
>> cayenne:
>> datasource: mysql
>>
>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>
>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>
>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>
>> What’s the trick?
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
In reply to this post by Andrus Adamchik

> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>
> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.

And can I set the connection information in another way for non-Bootique apps?  

> Andrus
>
>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>
>> Hi,
>>
>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>
>> jdbc:
>> mysql:
>>   driverClassName: com.mysql.jdbc.Driver
>>   url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>   initialSize: 1
>>   username: xxxxx
>>   password: xxxxx
>>
>> cayenne:
>> datasource: mysql
>>
>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>
>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>
>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>
>> What’s the trick?
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Nikita Timofeev
Hi Pascal,

Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
read all information from runtime properties.
All you need is to provide those properties via env variables or
directly in your code like this (this code for the latest 4.0
version):

ServerRuntime cayenneRuntime = ServerRuntime.builder()
        .addConfig("cayenne-project.xml")
        .addModule(binder -> {
            ServerModule.contributeProperties(binder)
                    .put("cayenne.jdbc.driver", "com.mysql.Driver")
                    .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
        })
        .build();

[1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html

On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:

>
>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>
>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>
> And can I set the connection information in another way for non-Bootique apps?
>
>> Andrus
>>
>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>
>>> jdbc:
>>> mysql:
>>>   driverClassName: com.mysql.jdbc.Driver
>>>   url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>   initialSize: 1
>>>   username: xxxxx
>>>   password: xxxxx
>>>
>>> cayenne:
>>> datasource: mysql
>>>
>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>
>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>
>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>
>>> What’s the trick?
>>
>



--
Best regards,
Nikita Timofeev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
Tried that, no luck (at least with the Bootique app):

java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server

Still connect to the URL defined in the model.

> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>
> Hi Pascal,
>
> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
> read all information from runtime properties.
> All you need is to provide those properties via env variables or
> directly in your code like this (this code for the latest 4.0
> version):
>
> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>        .addConfig("cayenne-project.xml")
>        .addModule(binder -> {
>            ServerModule.contributeProperties(binder)
>                    .put("cayenne.jdbc.driver", "com.mysql.Driver")
>                    .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>        })
>        .build();
>
> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>
> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>
>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>
>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>
>> And can I set the connection information in another way for non-Bootique apps?
>>
>>> Andrus
>>>
>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>
>>>> jdbc:
>>>> mysql:
>>>>  driverClassName: com.mysql.jdbc.Driver
>>>>  url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>  initialSize: 1
>>>>  username: xxxxx
>>>>  password: xxxxx
>>>>
>>>> cayenne:
>>>> datasource: mysql
>>>>
>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>
>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>
>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>
>>>> What’s the trick?
>>>
>>
>
>
>
> --
> Best regards,
> Nikita Timofeev

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Nikita Timofeev
Well, it seems like you can't use this Cayenne feature as Bootique
overwrites it with it's custom logic for resolving DataSource
properly.
So the only option I can see for you in this case is to delete
connection information from the model and use Bootique config from
Bootique app and cayenne.jdbc.* properties for other apps.

On Mon, Jun 12, 2017 at 5:31 PM, Pascal Robert <[hidden email]> wrote:

> Tried that, no luck (at least with the Bootique app):
>
> java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server
>
> Still connect to the URL defined in the model.
>
>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>
>> Hi Pascal,
>>
>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>> read all information from runtime properties.
>> All you need is to provide those properties via env variables or
>> directly in your code like this (this code for the latest 4.0
>> version):
>>
>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>        .addConfig("cayenne-project.xml")
>>        .addModule(binder -> {
>>            ServerModule.contributeProperties(binder)
>>                    .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>                    .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>        })
>>        .build();
>>
>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>
>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>
>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>
>>> And can I set the connection information in another way for non-Bootique apps?
>>>
>>>> Andrus
>>>>
>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>
>>>>> jdbc:
>>>>> mysql:
>>>>>  driverClassName: com.mysql.jdbc.Driver
>>>>>  url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>  initialSize: 1
>>>>>  username: xxxxx
>>>>>  password: xxxxx
>>>>>
>>>>> cayenne:
>>>>> datasource: mysql
>>>>>
>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>
>>>>> What’s the trick?
>>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Nikita Timofeev
>



--
Best regards,
Nikita Timofeev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

John Huss
In reply to this post by Pascal Robert-2
Cayenne is not going to read your System properties directly.  If you set
it in System properties to still have to pass it explicitly to the Cayenne
module like Nikita's code sample does.

On Mon, Jun 12, 2017 at 9:32 AM Pascal Robert <[hidden email]> wrote:

> Tried that, no luck (at least with the Bootique app):
>
> java
> -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
> -jar RevendeursWeb-1.0.jar --config=config.yml —server
>
> Still connect to the URL defined in the model.
>
> > Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a
> écrit :
> >
> > Hi Pascal,
> >
> > Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
> > read all information from runtime properties.
> > All you need is to provide those properties via env variables or
> > directly in your code like this (this code for the latest 4.0
> > version):
> >
> > ServerRuntime cayenneRuntime = ServerRuntime.builder()
> >        .addConfig("cayenne-project.xml")
> >        .addModule(binder -> {
> >            ServerModule.contributeProperties(binder)
> >                    .put("cayenne.jdbc.driver", "com.mysql.Driver")
> >                    .put("cayenne.jdbc.url", "jdbc:mysql://
> 127.0.0.1:3306/");
> >        })
> >        .build();
> >
> > [1]
> http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
> >
> > On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]>
> wrote:
> >>
> >>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a
> écrit :
> >>>
> >>> The easiest thing is to remove the DataNode from CayenneModel
> completely, and use Bootique connections locally, in production and in
> other environments.
> >>
> >> And can I set the connection information in another way for
> non-Bootique apps?
> >>
> >>> Andrus
> >>>
> >>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> I’m deploying my first Bootique app, which use Cayenne. In my
> config.yml file, I set the datasource like this:
> >>>>
> >>>> jdbc:
> >>>> mysql:
> >>>>  driverClassName: com.mysql.jdbc.Driver
> >>>>  url:
> "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
> >>>>  initialSize: 1
> >>>>  username: xxxxx
> >>>>  password: xxxxx
> >>>>
> >>>> cayenne:
> >>>> datasource: mysql
> >>>>
> >>>> But when I make a request to the app, it tries to connect to the
> server defined in the data model, not from the configuration file.
> >>>>
> >>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36
> o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource
> from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
> >>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36
> o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
> >>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36
> o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
> >>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36
> o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
> >>>>
> >>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36
> o.a.c.d.DriverDataSource: Connecting to
> 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
> >>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36
> o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
> >>>>
> >>>> What’s the trick?
> >>>
> >>
> >
> >
> >
> > --
> > Best regards,
> > Nikita Timofeev
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Amedeo Mantica
In reply to this post by Nikita Timofeev
With Cayenne 3.x I had similar issue

I had to delete the connection info nodes from the model, editing XML directly, dropping the entire <data-source> </data-source>

then...


@Override
public void configure(Binder binder) {


    binder.bind(ResourceLocator.class).toInstance(new ClassLoaderResourceLocator());

//those grab infos from my properties....
    String driver = conf.getString(JDBC_DRIVER_PROPERTY, "");
    String jdbcUrl = conf.getString(JDBC_URL_PROPERTY, "");
    String username = conf.getString(JDBC_USERNAME_PROPERTY, "");
    String password = conf.getString(JDBC_PASSWORD_PROPERTY, "");

    if(jdbcUrl != null) {
        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.JDBC_DRIVER_PROPERTY, driver);
        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.JDBC_URL_PROPERTY, jdbcUrl);
        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.JDBC_USERNAME_PROPERTY, username);
        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.JDBC_PASSWORD_PROPERTY, password);
    }

}


Amedeo

> On 12 Jun 2017, at 16:49, Nikita Timofeev <[hidden email]> wrote:
>
> Well, it seems like you can't use this Cayenne feature as Bootique
> overwrites it with it's custom logic for resolving DataSource
> properly.
> So the only option I can see for you in this case is to delete
> connection information from the model and use Bootique config from
> Bootique app and cayenne.jdbc.* properties for other apps.
>
> On Mon, Jun 12, 2017 at 5:31 PM, Pascal Robert <[hidden email]> wrote:
>> Tried that, no luck (at least with the Bootique app):
>>
>> java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server
>>
>> Still connect to the URL defined in the model.
>>
>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>
>>> Hi Pascal,
>>>
>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>> read all information from runtime properties.
>>> All you need is to provide those properties via env variables or
>>> directly in your code like this (this code for the latest 4.0
>>> version):
>>>
>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>       .addConfig("cayenne-project.xml")
>>>       .addModule(binder -> {
>>>           ServerModule.contributeProperties(binder)
>>>                   .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>                   .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>       })
>>>       .build();
>>>
>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>
>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>
>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>
>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>
>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>
>>>>> Andrus
>>>>>
>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>
>>>>>> jdbc:
>>>>>> mysql:
>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>> initialSize: 1
>>>>>> username: xxxxx
>>>>>> password: xxxxx
>>>>>>
>>>>>> cayenne:
>>>>>> datasource: mysql
>>>>>>
>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>
>>>>>> What’s the trick?
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Nikita Timofeev
>>
>
>
>
> --
> Best regards,
> Nikita Timofeev

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik
In reply to this post by Pascal Robert-2
Hi Pascal,

Your example is a Bootique app. So it will have its connection info in config.yml, and you don't need the properties. If you use your model in another app that is not a Bootuque app, then the -D properties will work.

Or did I misunderstand your use case?

Andrus


> On Jun 12, 2017, at 5:31 PM, Pascal Robert <[hidden email]> wrote:
>
> Tried that, no luck (at least with the Bootique app):
>
> java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server
>
> Still connect to the URL defined in the model.
>
>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>
>> Hi Pascal,
>>
>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>> read all information from runtime properties.
>> All you need is to provide those properties via env variables or
>> directly in your code like this (this code for the latest 4.0
>> version):
>>
>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>       .addConfig("cayenne-project.xml")
>>       .addModule(binder -> {
>>           ServerModule.contributeProperties(binder)
>>                   .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>                   .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>       })
>>       .build();
>>
>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>
>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>
>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>
>>> And can I set the connection information in another way for non-Bootique apps?
>>>
>>>> Andrus
>>>>
>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>
>>>>> jdbc:
>>>>> mysql:
>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>> initialSize: 1
>>>>> username: xxxxx
>>>>> password: xxxxx
>>>>>
>>>>> cayenne:
>>>>> datasource: mysql
>>>>>
>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>
>>>>> What’s the trick?
>>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Nikita Timofeev
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2

> Le 12 juin 2017 à 11:36, Andrus Adamchik <[hidden email]> a écrit :
>
> Hi Pascal,
>
> Your example is a Bootique app. So it will have its connection info in config.yml, and you don't need the properties. If you use your model in another app that is not a Bootuque app, then the -D properties will work.
>
> Or did I misunderstand your use case?

I was hoping to have a solution that would work on both Bootique and non-Bootique apps :-)

>
> Andrus
>
>
>> On Jun 12, 2017, at 5:31 PM, Pascal Robert <[hidden email]> wrote:
>>
>> Tried that, no luck (at least with the Bootique app):
>>
>> java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server
>>
>> Still connect to the URL defined in the model.
>>
>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>
>>> Hi Pascal,
>>>
>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>> read all information from runtime properties.
>>> All you need is to provide those properties via env variables or
>>> directly in your code like this (this code for the latest 4.0
>>> version):
>>>
>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>      .addConfig("cayenne-project.xml")
>>>      .addModule(binder -> {
>>>          ServerModule.contributeProperties(binder)
>>>                  .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>                  .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>      })
>>>      .build();
>>>
>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>
>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>
>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>
>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>
>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>
>>>>> Andrus
>>>>>
>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>
>>>>>> jdbc:
>>>>>> mysql:
>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>> initialSize: 1
>>>>>> username: xxxxx
>>>>>> password: xxxxx
>>>>>>
>>>>>> cayenne:
>>>>>> datasource: mysql
>>>>>>
>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>
>>>>>> What’s the trick?
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Nikita Timofeev
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik
> I was hoping to have a solution that would work on both Bootique and non-Bootique apps :-)

In which case you need the least common denominator for DS configuration, which is Cayenne. So do the opposite of what was initially suggested - keep the DataNode in Cayenne project and remove if from config.yml. Then your Cayenne configuration will be used and properties will be respected.

Andrus



> On Jun 12, 2017, at 6:40 PM, Pascal Robert <[hidden email]> wrote:
>
>
>> Le 12 juin 2017 à 11:36, Andrus Adamchik <[hidden email]> a écrit :
>>
>> Hi Pascal,
>>
>> Your example is a Bootique app. So it will have its connection info in config.yml, and you don't need the properties. If you use your model in another app that is not a Bootuque app, then the -D properties will work.
>>
>> Or did I misunderstand your use case?
>
> I was hoping to have a solution that would work on both Bootique and non-Bootique apps :-)
>
>>
>> Andrus
>>
>>
>>> On Jun 12, 2017, at 5:31 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>> Tried that, no luck (at least with the Bootique app):
>>>
>>> java -Dcayenne.jdbc.url="jdbc:mysql://xx.xx.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true" -jar RevendeursWeb-1.0.jar --config=config.yml —server
>>>
>>> Still connect to the URL defined in the model.
>>>
>>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>>
>>>> Hi Pascal,
>>>>
>>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>>> read all information from runtime properties.
>>>> All you need is to provide those properties via env variables or
>>>> directly in your code like this (this code for the latest 4.0
>>>> version):
>>>>
>>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>>     .addConfig("cayenne-project.xml")
>>>>     .addModule(binder -> {
>>>>         ServerModule.contributeProperties(binder)
>>>>                 .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>>                 .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>>     })
>>>>     .build();
>>>>
>>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>>
>>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>>
>>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>>
>>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>>
>>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>>
>>>>>> Andrus
>>>>>>
>>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>>
>>>>>>> jdbc:
>>>>>>> mysql:
>>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>>> initialSize: 1
>>>>>>> username: xxxxx
>>>>>>> password: xxxxx
>>>>>>>
>>>>>>> cayenne:
>>>>>>> datasource: mysql
>>>>>>>
>>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>>
>>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>>
>>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>>
>>>>>>> What’s the trick?
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Nikita Timofeev
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
In reply to this post by Nikita Timofeev
Ok, it is working if I remove the Cayenne tree in config.yml, while keeping the JDBC part, or else I get:

Caused by: java.lang.IllegalStateException: No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project.

> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>
> Hi Pascal,
>
> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
> read all information from runtime properties.
> All you need is to provide those properties via env variables or
> directly in your code like this (this code for the latest 4.0
> version):
>
> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>        .addConfig("cayenne-project.xml")
>        .addModule(binder -> {
>            ServerModule.contributeProperties(binder)
>                    .put("cayenne.jdbc.driver", "com.mysql.Driver")
>                    .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>        })
>        .build();
>
> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>
> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>
>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>
>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>
>> And can I set the connection information in another way for non-Bootique apps?
>>
>>> Andrus
>>>
>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>
>>>> jdbc:
>>>> mysql:
>>>>  driverClassName: com.mysql.jdbc.Driver
>>>>  url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>  initialSize: 1
>>>>  username: xxxxx
>>>>  password: xxxxx
>>>>
>>>> cayenne:
>>>> datasource: mysql
>>>>
>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>
>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>
>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>
>>>> What’s the trick?
>>>
>>
>
>
>
> --
> Best regards,
> Nikita Timofeev

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
Talked too fast. If I keep the JDBC part in config.yml, it tries to connect to that datasource when the Bootique app launch.

> Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :
>
> Ok, it is working if I remove the Cayenne tree in config.yml, while keeping the JDBC part, or else I get:
>
> Caused by: java.lang.IllegalStateException: No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project.
>
>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>
>> Hi Pascal,
>>
>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>> read all information from runtime properties.
>> All you need is to provide those properties via env variables or
>> directly in your code like this (this code for the latest 4.0
>> version):
>>
>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>       .addConfig("cayenne-project.xml")
>>       .addModule(binder -> {
>>           ServerModule.contributeProperties(binder)
>>                   .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>                   .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>       })
>>       .build();
>>
>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>
>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>
>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>
>>> And can I set the connection information in another way for non-Bootique apps?
>>>
>>>> Andrus
>>>>
>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>
>>>>> jdbc:
>>>>> mysql:
>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>> initialSize: 1
>>>>> username: xxxxx
>>>>> password: xxxxx
>>>>>
>>>>> cayenne:
>>>>> datasource: mysql
>>>>>
>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>
>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>
>>>>> What’s the trick?
>>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Nikita Timofeev
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik
As I mentioned [1], if your least common denominator is Cayenne, then use Cayenne for DataSource management, and remove it from Bootique.

Andrus

[1] https://lists.apache.org/thread.html/80a226b35e9492c6788b155708f52afb57ddbc90f65e890c41b2f1ad@%3Cuser.cayenne.apache.org%3E

> On Jun 13, 2017, at 7:20 PM, Pascal Robert <[hidden email]> wrote:
>
> Talked too fast. If I keep the JDBC part in config.yml, it tries to connect to that datasource when the Bootique app launch.
>
>> Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :
>>
>> Ok, it is working if I remove the Cayenne tree in config.yml, while keeping the JDBC part, or else I get:
>>
>> Caused by: java.lang.IllegalStateException: No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project.
>>
>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>
>>> Hi Pascal,
>>>
>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>> read all information from runtime properties.
>>> All you need is to provide those properties via env variables or
>>> directly in your code like this (this code for the latest 4.0
>>> version):
>>>
>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>      .addConfig("cayenne-project.xml")
>>>      .addModule(binder -> {
>>>          ServerModule.contributeProperties(binder)
>>>                  .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>                  .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>      })
>>>      .build();
>>>
>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>
>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>
>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>
>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>
>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>
>>>>> Andrus
>>>>>
>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>
>>>>>> jdbc:
>>>>>> mysql:
>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>> initialSize: 1
>>>>>> username: xxxxx
>>>>>> password: xxxxx
>>>>>>
>>>>>> cayenne:
>>>>>> datasource: mysql
>>>>>>
>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>
>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>
>>>>>> What’s the trick?
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Nikita Timofeev
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
This is what I tried. Empty config.yml, keeping everything in the Cayenne project, including the data-source. If I do that, I get the "No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project. » exception.

> Le 13 juin 2017 à 13:21, Andrus Adamchik <[hidden email]> a écrit :
>
> As I mentioned [1], if your least common denominator is Cayenne, then use Cayenne for DataSource management, and remove it from Bootique.
>
> Andrus
>
> [1] https://lists.apache.org/thread.html/80a226b35e9492c6788b155708f52afb57ddbc90f65e890c41b2f1ad@%3Cuser.cayenne.apache.org%3E
>
>> On Jun 13, 2017, at 7:20 PM, Pascal Robert <[hidden email]> wrote:
>>
>> Talked too fast. If I keep the JDBC part in config.yml, it tries to connect to that datasource when the Bootique app launch.
>>
>>> Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :
>>>
>>> Ok, it is working if I remove the Cayenne tree in config.yml, while keeping the JDBC part, or else I get:
>>>
>>> Caused by: java.lang.IllegalStateException: No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project.
>>>
>>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>>
>>>> Hi Pascal,
>>>>
>>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>>> read all information from runtime properties.
>>>> All you need is to provide those properties via env variables or
>>>> directly in your code like this (this code for the latest 4.0
>>>> version):
>>>>
>>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>>     .addConfig("cayenne-project.xml")
>>>>     .addModule(binder -> {
>>>>         ServerModule.contributeProperties(binder)
>>>>                 .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>>                 .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>>     })
>>>>     .build();
>>>>
>>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>>
>>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>>
>>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>>
>>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>>
>>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>>
>>>>>> Andrus
>>>>>>
>>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>>
>>>>>>> jdbc:
>>>>>>> mysql:
>>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>>> initialSize: 1
>>>>>>> username: xxxxx
>>>>>>> password: xxxxx
>>>>>>>
>>>>>>> cayenne:
>>>>>>> datasource: mysql
>>>>>>>
>>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>>
>>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>>
>>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>>
>>>>>>> What’s the trick?
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Nikita Timofeev
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2
The problem was that my Bootique app was linked with the LinkRest module, which I don’t use. Removed the dependency and now everything works fine.

> Le 13 juin 2017 à 15:02, Pascal Robert <[hidden email]> a écrit :
>
> This is what I tried. Empty config.yml, keeping everything in the Cayenne project, including the data-source. If I do that, I get the "No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project. » exception.
>
>> Le 13 juin 2017 à 13:21, Andrus Adamchik <[hidden email]> a écrit :
>>
>> As I mentioned [1], if your least common denominator is Cayenne, then use Cayenne for DataSource management, and remove it from Bootique.
>>
>> Andrus
>>
>> [1] https://lists.apache.org/thread.html/80a226b35e9492c6788b155708f52afb57ddbc90f65e890c41b2f1ad@%3Cuser.cayenne.apache.org%3E
>>
>>> On Jun 13, 2017, at 7:20 PM, Pascal Robert <[hidden email]> wrote:
>>>
>>> Talked too fast. If I keep the JDBC part in config.yml, it tries to connect to that datasource when the Bootique app launch.
>>>
>>>> Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :
>>>>
>>>> Ok, it is working if I remove the Cayenne tree in config.yml, while keeping the JDBC part, or else I get:
>>>>
>>>> Caused by: java.lang.IllegalStateException: No DataSources are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne project.
>>>>
>>>>> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a écrit :
>>>>>
>>>>> Hi Pascal,
>>>>>
>>>>> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
>>>>> read all information from runtime properties.
>>>>> All you need is to provide those properties via env variables or
>>>>> directly in your code like this (this code for the latest 4.0
>>>>> version):
>>>>>
>>>>> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>>>>>    .addConfig("cayenne-project.xml")
>>>>>    .addModule(binder -> {
>>>>>        ServerModule.contributeProperties(binder)
>>>>>                .put("cayenne.jdbc.driver", "com.mysql.Driver")
>>>>>                .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>>>>>    })
>>>>>    .build();
>>>>>
>>>>> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.html
>>>>>
>>>>> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>
>>>>>>> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>>>>>>>
>>>>>>> The easiest thing is to remove the DataNode from CayenneModel completely, and use Bootique connections locally, in production and in other environments.
>>>>>>
>>>>>> And can I set the connection information in another way for non-Bootique apps?
>>>>>>
>>>>>>> Andrus
>>>>>>>
>>>>>>>> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I’m deploying my first Bootique app, which use Cayenne. In my config.yml file, I set the datasource like this:
>>>>>>>>
>>>>>>>> jdbc:
>>>>>>>> mysql:
>>>>>>>> driverClassName: com.mysql.jdbc.Driver
>>>>>>>> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&autoReconnect=true"
>>>>>>>> initialSize: 1
>>>>>>>> username: xxxxx
>>>>>>>> password: xxxxx
>>>>>>>>
>>>>>>>> cayenne:
>>>>>>>> datasource: mysql
>>>>>>>>
>>>>>>>> But when I make a request to the app, it tries to connect to the server defined in the data model, not from the configuration file.
>>>>>>>>
>>>>>>>> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML configuration resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
>>>>>>>> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
>>>>>>>> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
>>>>>>>> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.XMLDataChannelDescriptorLoader: Loading XML DataMap resource from jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>>>>>>>>
>>>>>>>> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource: Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as 'filemaker'
>>>>>>>> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource: *** Connecting: FAILURE.
>>>>>>>>
>>>>>>>> What’s the trick?
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> Nikita Timofeev
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: Bootique, Cayenne and production

Elena Bondareva
In reply to this post by Pascal Robert-2
Hi Pascal,

Did you rename your project in Cayenne Modeler, so that the name isn't
'cayenne-project.xml' yet? If yes, then write the exact name of Cayenne
project into the module config.
And keep config,yml empty.

 @Override
    public void configure(Binder binder) {
        //provide not default project name to be found by BQ
        CayenneModule.extend(binder).addProject("cayenne-project1.xml");
    }


Thx,
Elena Bondareva

This is what I tried. Empty config.yml, keeping everything in the Cayenne
project, including the data-source. If I do that, I get the "No DataSources
are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it
in Cayenne project. » exception.

Le 13 juin 2017 à 13:21, Andrus Adamchik <[hidden email]> a écrit :

As I mentioned [1], if your least common denominator is Cayenne, then use
Cayenne for DataSource management, and remove it from Bootique.

Andrus

[1] https://lists.apache.org/thread.html/80a226b35e9492c6788b155708f52a
fb57ddbc90f65e890c41b2f1ad@%3Cuser.cayenne.apache.org%3E

On Jun 13, 2017, at 7:20 PM, Pascal Robert <[hidden email]> wrote:

Talked too fast. If I keep the JDBC part in config.yml, it tries to connect
to that datasource when the Bootique app launch.

Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :

Ok, it is working if I remove the Cayenne tree in config.yml, while keeping
the JDBC part, or else I get:

Caused by: java.lang.IllegalStateException: No DataSources are available
for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne
project.

Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a
écrit :

Hi Pascal,

Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
read all information from runtime properties.
All you need is to provide those properties via env variables or
directly in your code like this (this code for the latest 4.0
version):

ServerRuntime cayenneRuntime = ServerRuntime.builder()
   .addConfig("cayenne-project.xml")
   .addModule(binder -> {
       ServerModule.contributeProperties(binder)
               .put("cayenne.jdbc.driver", "com.mysql.Driver")
               .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
   })
   .build();

[1] http://cayenne.apache.org/docs/4.0/api/org/apache/
cayenne/configuration/server/PropertyDataSourceFactory.html

On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:


Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :

The easiest thing is to remove the DataNode from CayenneModel completely,
and use Bootique connections locally, in production and in other
environments.


And can I set the connection information in another way for non-Bootique
apps?

Andrus

On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:

Hi,

I’m deploying my first Bootique app, which use Cayenne. In my config.yml
file, I set the datasource like this:

jdbc:
mysql:
driverClassName: com.mysql.jdbc.Driver
url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&
autoReconnect=true"
initialSize: 1
username: xxxxx
password: xxxxx

cayenne:
datasource: mysql

But when I make a request to the app, it tries to connect to the server
defined in the data model, not from the configuration file.

INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.
XMLDataChannelDescriptorLoader: Loading XML configuration resource from
jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.
XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.
XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.
XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml

INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource:
Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as
'filemaker'
INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource:
*** Connecting: FAILURE.

What’s the trick?






--
Best regards,
Nikita Timofeev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Pascal Robert-2

> Le 14 juin 2017 à 11:35, Elena Bondareva <[hidden email]> a écrit :
>
> Hi Pascal,
>
> Did you rename your project in Cayenne Modeler, so that the name isn't
> 'cayenne-project.xml' yet? If yes, then write the exact name of Cayenne
> project into the module config.
> And keep config,yml empty.
>
> @Override
>    public void configure(Binder binder) {
>        //provide not default project name to be found by BQ
>        CayenneModule.extend(binder).addProject("cayenne-project1.xml");
>    }


Yeah, I did name the project correctly. See my latest reply, the problem was that I was linking LinkRest, and this one expects a jdbc configuration.

>
>
> Thx,
> Elena Bondareva
>
> This is what I tried. Empty config.yml, keeping everything in the Cayenne
> project, including the data-source. If I do that, I get the "No DataSources
> are available for Cayenne. Add a DataSource via 'bootique-jdbc' or map it
> in Cayenne project. » exception.
>
> Le 13 juin 2017 à 13:21, Andrus Adamchik <[hidden email]> a écrit :
>
> As I mentioned [1], if your least common denominator is Cayenne, then use
> Cayenne for DataSource management, and remove it from Bootique.
>
> Andrus
>
> [1] https://lists.apache.org/thread.html/80a226b35e9492c6788b155708f52a
> fb57ddbc90f65e890c41b2f1ad@%3Cuser.cayenne.apache.org%3E
>
> On Jun 13, 2017, at 7:20 PM, Pascal Robert <[hidden email]> wrote:
>
> Talked too fast. If I keep the JDBC part in config.yml, it tries to connect
> to that datasource when the Bootique app launch.
>
> Le 12 juin 2017 à 12:24, Pascal Robert <[hidden email]> a écrit :
>
> Ok, it is working if I remove the Cayenne tree in config.yml, while keeping
> the JDBC part, or else I get:
>
> Caused by: java.lang.IllegalStateException: No DataSources are available
> for Cayenne. Add a DataSource via 'bootique-jdbc' or map it in Cayenne
> project.
>
> Le 12 juin 2017 à 09:32, Nikita Timofeev <[hidden email]> a
> écrit :
>
> Hi Pascal,
>
> Yes you can setup DataSource via PropertyDataSourceFactory[1] that can
> read all information from runtime properties.
> All you need is to provide those properties via env variables or
> directly in your code like this (this code for the latest 4.0
> version):
>
> ServerRuntime cayenneRuntime = ServerRuntime.builder()
>   .addConfig("cayenne-project.xml")
>   .addModule(binder -> {
>       ServerModule.contributeProperties(binder)
>               .put("cayenne.jdbc.driver", "com.mysql.Driver")
>               .put("cayenne.jdbc.url", "jdbc:mysql://127.0.0.1:3306/");
>   })
>   .build();
>
> [1] http://cayenne.apache.org/docs/4.0/api/org/apache/
> cayenne/configuration/server/PropertyDataSourceFactory.html
>
> On Mon, Jun 12, 2017 at 3:59 PM, Pascal Robert <[hidden email]> wrote:
>
>
> Le 9 juin 2017 à 11:37, Andrus Adamchik <[hidden email]> a écrit :
>
> The easiest thing is to remove the DataNode from CayenneModel completely,
> and use Bootique connections locally, in production and in other
> environments.
>
>
> And can I set the connection information in another way for non-Bootique
> apps?
>
> Andrus
>
> On Jun 9, 2017, at 6:14 PM, Pascal Robert <[hidden email]> wrote:
>
> Hi,
>
> I’m deploying my first Bootique app, which use Cayenne. In my config.yml
> file, I set the datasource like this:
>
> jdbc:
> mysql:
> driverClassName: com.mysql.jdbc.Driver
> url: "jdbc:mysql://10.6.xx.xx:3306/filemaker?connectTimeout=0&
> autoReconnect=true"
> initialSize: 1
> username: xxxxx
> password: xxxxx
>
> cayenne:
> datasource: mysql
>
> But when I make a request to the app, it tries to connect to the server
> defined in the data model, not from the configuration file.
>
> INFO  [2017-06-09 15:08:32,255] bootique-http-36 o.a.c.c.
> XMLDataChannelDescriptorLoader: Loading XML configuration resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/cayenne-filemaker.xml
> INFO  [2017-06-09 15:08:32,278] bootique-http-36 o.a.c.c.
> XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/mysql.map.xml
> INFO  [2017-06-09 15:08:32,332] bootique-http-36 o.a.c.c.
> XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/revendeurs.map.xml
> INFO  [2017-06-09 15:08:32,338] bootique-http-36 o.a.c.c.
> XMLDataChannelDescriptorLoader: Loading XML DataMap resource from
> jar:file:/opt/bin/RevendeursWeb-1.0.jar!/utilisateurs.map.xml
>
> INFO  [2017-06-09 15:08:32,366] bootique-http-36 o.a.c.d.DriverDataSource:
> Connecting to 'jdbc:mysql://legestionnaire.druide:3306/filemaker' as
> 'filemaker'
> INFO  [2017-06-09 15:08:32,413] bootique-http-36 o.a.c.d.DriverDataSource:
> *** Connecting: FAILURE.
>
> What’s the trick?
>
>
>
>
>
>
> --
> Best regards,
> Nikita Timofeev

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bootique, Cayenne and production

Andrus Adamchik

> On Jun 14, 2017, at 6:37 PM, Pascal Robert <[hidden email]> wrote:
> See my latest reply, the problem was that I was linking LinkRest, and this one expects a jdbc configuration.

This sounds odd and something we'll need to research. I suspect this is hiding a different problem. I mean LinkRest stack should be able to start without a JDBC configuration, if Cayenne has a DataSource.

> Yeah, I did name the project correctly.

There's no "incorrect" name. Elena's point was that non-default name requires an explicit declaration via CayenneModule.extend(..).

Andrus
Loading...