[midPoint] Where does one configure datasources in midPoint 4.0.2?

Pavol Mederly mederly at evolveum.com
Fri May 15 16:47:10 CEST 2020


Richard,

done that: 
https://wiki.evolveum.com/display/midPoint/Repository+Configuration#RepositoryConfiguration-Datasourceconfiguration.

I have also quickly reviewed 
https://wiki.evolveum.com/display/midPoint/Using+MidPoint+with+embedded+Tomcat 
page you mentioned earlier, to see it was referencing quite old version 
of Spring Boot that we no longer use. Unfortunately, I am not able to 
fix it at this moment; so I just marked it as such.

Thank you for your research efforts, trying to find out the correct way 
of handling data sources. Maybe someone from the community will be able 
to expand on it.

Best regards,

Pavol Mederly
Software developer
evolveum.com

On 15/05/2020 16:24, Richard Frovarp wrote:
> It's not a huge deal for me. I think what you should do is update the
> documentation to say that it isn't possible with embedded Tomcat. Would
> at least save people time from trying to go down the path now that we
> know it isn't an easy / known path.
>
> Thanks for the info everyone.
>
> On Fri, 2020-05-15 at 10:19 +0200, Pavol Mederly wrote:
>> Hello Richard,
>> it looks like it is not so easy as I originally thought.
>> It would most probably require some development effort - or at least
>> some non-trivial Tomcat/Spring Boot knowledge (that I personally do
>> not have).
>> If no one from the community is able to help you with this, you can
>> create a JIRA (of "Improvement" kind).
>> Under a subscription we'll be glad to devote developers' time to it.
>> Best regards,
>> On 14/05/2020 22:54, Richard Frovarp wrote:
>>> I've spent some time wildly trying to guess as to how to make this
>>> work.
>>>
>>> First, with midPoint 4.0.2, Configuration example 1 is wrong:
>>>
>>> https://wiki.evolveum.com/display/midPoint/Using+MidPoint+with+embe
>>> dded+Tomcat
>>>
>>>
>>> midpoint.log:2020-05-14 12:49:00,550 [] [main] WARN
>>> (org.springframework.boot.web.servlet.context.AnnotationConfigServl
>>> etWebServerApplicationContext): Exception encountered during
>>> context initialization - cancelling refresh attempt:
>>> org.springframework.context.ApplicationContextException: Unable to
>>> start web server; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'tomcatEmbeddedServletContainerFactory'
>>> defined in class path resource
>>> [com/evolveum/midpoint/web/boot/EmbeddedTomcatAutoConfiguration$Emb
>>> eddedTomcat.class]: Initialization of bean failed; nested exception
>>> is
>>> org.springframework.beans.factory.UnsatisfiedDependencyException:
>>> Error creating bean with name
>>> 'com.evolveum.midpoint.web.boot.MidPointSpringApplication$ServerCus
>>> tomization': Unsatisfied dependency expressed through field
>>> 'sessionTimeout'; nested exception is
>>> org.springframework.beans.TypeMismatchException: Failed to convert
>>> value of type 'java.lang.String' to required type 'int'; nested
>>> exception is java.lang.NumberFormatException: For input string:
>>> "120m"
>>>
>>> If I drop the 'm' off of the entry, it doesn't throw an error. No
>>> idea if it is working at this point. Going to guess that example 2
>>> is also wrong.
>>>
>>> I've moved off of trying to use the datasource for the main DB
>>> connection. I am quite interested in using it for connectors. In
>>> particular the DatabaseTableConnector
>>>
>>> I've tried this:
>>>
>>> warehouse.datasource.url: jdbc:mysql://localhost/warehouse
>>> warehouse.datasource.username: midpoint
>>> warehouse.datasource.password: <password>
>>> warehouse.datasource.driver-class-name: com.mysql.jdbc.Driver
>>> warehouse.datasource.name: jdbc/warehouse
>>> warehouse.datasource.type: javax.sql.DataSource
>>>
>>> Then I get the following as an error:
>>>
>>> org.identityconnectors.framework.common.exceptions.ConnectorExcepti
>>> on(javax.naming.NoInitialContextException: Need to specify class
>>> name in environment or system property, or as an applet parameter,
>>> or in an application resource file: java.naming.factory.initial)-
>>>> javax.naming.NoInitialContextException(Need to specify class name
>>> in environment or system property, or as an applet parameter, or in
>>> an application resource file: java.naming.factory.initial)
>>>
>>> This says you need to do a change in embedded Tomcat, but the main
>>> application is already using a datasource, so I'm not sure. I am
>>> quite familiar with setting up JNDI via context files, however no
>>> experience with Spring Boot.
>>> https://stackoverflow.com/questions/24941829/how-to-create-jndi-con
>>> text-in-spring-boot-with-embedded-tomcat-container
>>>
>>>
>>> On Thu, 2020-05-14 at 11:53 -0500, Jason Everling wrote:
>>>> Maybe https://howtodoinjava.com/spring-boot2/datasource-configura
>>>> tion/
>>>>   
>>>> From: Keith Hazelton
>>>> Sent: Thursday, May 14, 2020 11:28 AM
>>>> To: midPoint General Discussion
>>>> Subject: Re: [midPoint] Where does one configure datasources in
>>>> midPoint 4.0.2?
>>>>   
>>>> This email is a followup on how we could potentially improve
>>>> documentation on datasource configuration for embedded Tomcat
>>>> versions of midPoint.
>>>>   
>>>> First, note that the Evolveum documentation on "Using midPoint
>>>> with Embedded Tomcat",  includes the following under
>>>> "Configuration" https://wiki.evolveum.com/display/midPoint/Using+
>>>> MidPoint+with+embedded+Tomcat,"
>>>>   
>>>> "MidPoint configuration is done as usual in config.xml file
>>>> located in midpoint.home. Configuration for embedded tomcat can
>>>> be done in two places. Default configuration file
>>>> name application.yml is located on classpath (admin-
>>>> gui/src/main/resources folder). Custom configuration file
>>>> application.yml can be placed to midpoint.home folder.
>>>> ...
>>>> "Following table shows list of available properties that can be
>>>> used to configure tomcat (e.g. http/https ports, session
>>>> timeouts, logging, max-post-size, etc.)."
>>>>   
>>>> The mentioned table does not mention datasource in its example of
>>>> "available properties":
>>>>   
>>>> It looks like the datasource settings in question are discussed
>>>> only in Spring documentation on "Common Application properties",
>>>> https://docs.spring.io/spring-boot/docs/current/reference/html/ap
>>>> pendix-application-properties.html
>>>>   
>>>> That site includes page after page of datasource settings, under
>>>> the "Data Properties" section.
>>>>   
>>>> QUESTION: Do we know which of these properties need to be set,
>>>> and to what values, to solve the problem under discussion? If we
>>>> do, that could be the basis for improved documentation.
>>>>   
>>>>             --Keith
>>>>
>>>> From: midPoint <midpoint-bounces at lists.evolveum.com> on behalf of
>>>> Petr Gašparík - AMI Praha a.s. <petr.gasparik at ami.cz>
>>>> Sent: Thursday, May 14, 2020 4:15 AM
>>>> To: midPoint General Discussion <midpoint at lists.evolveum.com>
>>>> Subject: Re: [midPoint] Where does one configure datasources in
>>>> midPoint 4.0.2?
>>>>   
>>>> This should be definitely better documented, as embedded Tomcat
>>>> is recommended, and in the near future the only one supported
>>>> option.
>>>> --
>>>> s pozdravem
>>>> Petr Gašparík
>>>> konzultant IT bezpečnosti
>>>> gsm: [+420] 603 523 860
>>>> e‑mail: petr.gasparik at ami.cz
>>>> AMI Praha a.s.
>>>> Pláničkova 11, 162 00 Praha 6
>>>> tel.: [+420] 274 783 239 | web: www.ami.cz
>>>>
>>>> Textem tohoto e‑mailu podepisující neslibuje uzavřít
>>>> ani neuzavírá za společnost AMI Praha a.s.
>>>> jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít
>>>> výhradně písemnou formu.
>>>>   
>>>> Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů a může
>>>> obsahovat důvěrné nebo osobní
>>>> informace. Nejste‑li zamýšleným příjemcem, je zakázáno jakékoliv
>>>> zveřejňování, zprostředkování
>>>> nebo jiné použití těchto informací. Pokud jste obdrželi e‑mail
>>>> neoprávněně, informujte o tom prosím
>>>> odesílatele a vymažte neprodleně všechny kopie tohoto e‑mailu
>>>> včetně všech jeho příloh. Nakládáním
>>>> s neoprávněně získanými informacemi se vystavujete riziku
>>>> právního postihu.
>>>>   
>>>>   
>>>> čt 14. 5. 2020 v 11:02 odesílatel Pavol Mederly <mederly at evolveum
>>>> .com> napsal:
>>>>> Richard,
>>>>> I believe that even for embedded Tomcat (used when running in
>>>>> standalone mode) you can configure data sources, probably by
>>>>> setting up things in application.yml file.
>>>>> Best regards,
>>>>> Pavol Mederly
>>>>> Software developer
>>>>> evolveum.com
>>>>> On 13/05/2020 19:22, Jason Everling wrote:
>>>>>> Yeah that was kind of what I meant by container, I believe
>>>>>> its using Tomcat as the backend, or Jetty? In any case, you
>>>>>> should still be able to create them, we don’t use that method
>>>>>> so someone else would have to chime in on configuring them.
>>>>>>   
>>>>>> From: Richard Frovarp
>>>>>> Sent: Tuesday, May 12, 2020 12:07 PM
>>>>>> To: midpoint at lists.evolveum.com
>>>>>> Subject: Re: [midPoint] Where does one configure datasources
>>>>>> in midPoint 4.0.2?
>>>>>>   
>>>>>> Not running in a container. Just did the download and run
>>>>>> using the
>>>>>> start.sh script in the tarball.
>>>>>>   
>>>>>> On Tue, 2020-05-12 at 11:51 -0500, Jason Everling wrote:
>>>>>>> Are you running container? I thought there was settings for
>>>>>> them if
>>>>>>> using container, maybe someone here has examples for
>>>>>> containers. We
>>>>>>> still use tomcat with global datasources so I cant speak to
>>>>>>> container’d deployment
>>>>>>>
>>>>>>> From: Richard Frovarp
>>>>>>> Sent: Tuesday, May 12, 2020 11:18 AM
>>>>>>> To: midpoint at lists.evolveum.com
>>>>>>> Subject: Re: [midPoint] Where does one configure
>>>>>> datasources in
>>>>>>> midPoint 4.0.2?
>>>>>>>
>>>>>>> So unless I'm running this directly through Tomcat I can't
>>>>>> do
>>>>>>> datasource how it comes normally?
>>>>>>>
>>>>>>> I'm getting these:
>>>>>>>
>>>>>>> 2020-05-12 11:11:52,084 [REPOSITORY]
>>>>>> [midPointScheduler_Worker-3]
>>>>>>> WARN (com.zaxxer.hikari.pool.PoolBase): HikariPool-1 -
>>>>>> Failed to
>>>>>>> validate connection com.mysql.jdbc.JDBC4Connection at 5bce37af
>>>>>>   (No
>>>>>>> operations allowed after connection closed.). Possibly
>>>>>> consider using
>>>>>>> a shorter maxLifetime value.
>>>>>>>
>>>>>>> Which I don't see a setting on how to address that via
>>>>>> config.xml. I
>>>>>>> know that 4.1 deprecates MariaDB and I'll need to change to
>>>>>>> PostgreSQL. I was kind of hoping to use datasource so that
>>>>>> I can skip
>>>>>>> providing passwords to a lot of resources that will be
>>>>>> reading data
>>>>>>> in from the same DB.
>>>>>>>
>>>>>>> On Tue, 2020-05-12 at 11:04 -0500, Jason Everling wrote:
>>>>>>>> Those examples are for tomcat native datasource
>>>>>> configuration,
>>>>>>>> standard configuration is done in config.xml in
>>>>>> midpoint.home
>>>>>>>> directory,
>>>>>>>>
>>>>>>>>      <repository>
>>>>>>>>      
>>>>>>>>
>>>>>> <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql
>>>>>> .SqlRe
>>>>>>>> positoryFactory</repositoryServiceFactoryClass>
>>>>>>>>        <database>sqlserver</database>
>>>>>>>>        <jdbcUsername>midpoint</jdbcUsername>
>>>>>>>>        <jdbcPassword>password</jdbcPassword>
>>>>>>>>      
>>>>>>>>
>>>>>> <jdbcUrl>jdbc:sqlserver://localhost:1433;database=midpoint</j
>>>>>> dbcUrl
>>>>>>>>      </repository>
>>>>>>>>
>>>>>>>> From: Richard Frovarp
>>>>>>>> Sent: Tuesday, May 12, 2020 9:40 AM
>>>>>>>> To: midpoint at lists.evolveum.com
>>>>>>>> Subject: [midPoint] Where does one configure datasources
>>>>>> in
>>>>>>>> midPoint 4.0.2?
>>>>>>>>
>>>>>>>> I've read the documentation here:
>>>>>>>>
>>>>>>>> https://wiki.evolveum.com/display/midPoint/Repository+Con
>>>>>> figuration
>>>>>>>> #Rep
>>>>>>>> ositoryConfiguration-Datasourceconfiguration
>>>>>>>>
>>>>>>>> But that doesn't give a current answer. Grepping through
>>>>>> everything
>>>>>>>> looking for the bits I think might exist in files doesn't
>>>>>> give me a
>>>>>>>> result.
>>>>>>>>
>>>>>>>> I'm getting a variety of connection problems, likely due
>>>>>> to
>>>>>>>> timeouts,
>>>>>>>> and it looks like the only way to set those is via a
>>>>>> datasource.
>>>>>>>> Thanks,
>>>>>>>> Richard
>>>>>>>> _______________________________________________
>>>>>>>> midPoint mailing list
>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> midPoint mailing list
>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> midPoint mailing list
>>>>>>> midPoint at lists.evolveum.com
>>>>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>> _______________________________________________
>>>>>> midPoint mailing list
>>>>>> midPoint at lists.evolveum.com
>>>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>   
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> midPoint mailing list
>>>>>> midPoint at lists.evolveum.com
>>>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>   
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>   
>>>
>>> _______________________________________________
>>> midPoint mailing list
>>> midPoint at lists.evolveum.com
>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> https://lists.evolveum.com/mailman/listinfo/midpoint
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint



More information about the midPoint mailing list