[midPoint] MySQL configuration for 3.0

Ivan Noris ivan.noris at evolveum.com
Tue Aug 26 23:01:19 CEST 2014


Hi Deepak,

On 08/26/2014 09:11 PM, Deepak Natarajan wrote:
> Hi Ivan -
>
> Nice one!. For our first/current customer, we are not using Workflow (it
> is planned for the future, and I will have to learn how to configure and
> use it etc) but for our current delivery it is not pertinent.
>
> Could you give me a quick tip on how to disable it? (I did a quick
> search on the wiki, was unable to find anything).

To disable:

  <workflow>
    <enabled>false</enabled>
  </workflow>

in midpoint's config.xml. I have already updated
https://wiki.evolveum.com/display/midPoint/Workflow+configuration.

BTW. datasource support for task manager / workflow is now being tracked
here: https://jira.evolveum.com/browse/MID-2028

Regards,
Ivan

> BR/Deepak
>
> Ivan Noris wrote:
>> Hi Deepak,
>>
>> in your log (attached to your last mail) the final exception is:
>>
>> Caused by: com.evolveum.midpoint.util.exception.SystemException: JDBC driver must be specified (either explicitly or in SQL repository configuration)
>> 	at com.evolveum.midpoint.wf.impl.WfConfiguration.notEmpty(WfConfiguration.java:201) ~[workflow-impl-3.0.jar:na]
>> 	at com.evolveum.midpoint.wf.impl.WfConfiguration.validate(WfConfiguration.java:193) ~[workflow-impl-3.0.jar:na]
>> 	at com.evolveum.midpoint.wf.impl.WfConfiguration.initialize(WfConfiguration.java:165) ~[workflow-impl-3.0.jar:na]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
>>
>>
>> This implies that workflow is enabled. And it's failing to use datasource.
>>
>> Further, I see:
>>
>>
>> 2014-08-26 18:19:25,703 [RMI TCP Connection(2)-127.0.0.1] INFO 
>> (c.e.midpoint.repo.sql.CompositeDataSource): Loading datasource.
>> 2014-08-26 18:19:25,703 [RMI TCP Connection(2)-127.0.0.1] INFO 
>> (c.e.midpoint.repo.sql.CompositeDataSource): JDNI datasource present in
>> configuration, looking for 'java:comp/env/jdbc/midpointDS'.
>>
>> So repository IS using datasource.
>>
>> Then:
>>
>> 2014-08-26 18:19:28,458 [RMI TCP Connection(2)-127.0.0.1] INFO 
>> (c.e.midpoint.task.quartzimpl.Initializer): Task Manager: Quartz Job
>> Store: in-memory, NOT clustered. Threads: 10
>>
>> So task manager is using memory, not database (that's why you didn't
>> have the error that I do).
>>
>> So, the problem is probably caused by workflow+datasource combination,
>> not repository. I'm not using workflow in my setup.
>>
>> Just to be sure: are you using the workflow in your setup or it can be
>> disabled (that would work around the problem)?
>>
>> If the combination datasource+jdbc url+user+password works, I would
>> speculate that repository is using datasource and workflow is inheriting
>> the jdbc url+user+password parameters.
>>
>> Regards,
>> Ivan
>>
>> On 08/26/2014 08:26 PM, Deepak Natarajan wrote:
>>> Hi Ivan -
>>>
>>> Hmmm. My configuration looks like yours, albeit with MySQL.
>>>
>>> 1. I have mysql-connector-java-5.1.28-bin.jar in <tc>/lib
>>>
>>> 2. My <tc>/conf/context.xml :
>>>
>>> <Context>
>>>
>>>     <!-- Default set of monitored resources -->
>>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>     <ResourceLink name="jdbc/midpointDS" global="jdbc/midpointDS"
>>> type="javax.sql.DataSource"/>
>>> ...
>>> ...
>>> </Context>
>>>
>>> 3. My <tc>/conf/server.xml
>>>
>>>   <GlobalNamingResources>
>>>
>>>
>>>     <Resource name="jdbc/midpointDS" auth="Container"
>>> type="javax.sql.DataSource"
>>>         username="xx" password="xx"
>>>         url="jdbc:mysql://localhost:3306/midpoint"
>>>         driverClassName="com.mysql.jdbc.Driver"
>>>         accessToUnderlyingConnectionAllowed="true"
>>>         initialSize="5" maxWait="5000"
>>>         maxActive="30" maxIdle="5"
>>>         validationQuery="select 1"
>>>         poolPreparedStatements="true"/>
>>>
>>>   </GlobalNamingResources>
>>>
>>> 4. midpoint's config :
>>>
>>>         <repository
>>> 	<repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass>
>>>             <embedded>false</embedded>
>>>
>>> <hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect>
>>>             <hibernateHbm2ddl>validate</hibernateHbm2ddl>
>>>             <dataSource>java:comp/env/jdbc/midpointDS</dataSource>
>>>         </repository>
>>>
>>>
>>> and when I redeploy/restart, I get the same error - see attached log file.
>>>
>>> In any case, I am able to work around this by specifying the details of
>>> the jdbc connection - username, driver class etc. as below :
>>>
>>>         <repository>
>>>
>>> <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass>
>>>             <embedded>false</embedded>
>>>
>>> <hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect>
>>>             <hibernateHbm2ddl>validate</hibernateHbm2ddl>
>>>             <dataSource>java:comp/env/jdbc/midpointDS</dataSource>
>>>             <jdbcUrl>jdbc:mysql://localhost:3306/midpoint</jdbcUrl>
>>>             <driverClassName>com.mysql.jdbc.Driver</driverClassName>
>>>             <jdbcUsername>xx</jdbcUsername>
>>>             <jdbcPassword>xx</jdbcPassword>
>>>         </repository>
>>>
>>> And, when I do go to configure/about, I actually see the DS! - I didnt
>>> check this previously. So I guess it IS using the DS after all?
>>>
>>> Thanks for your help!
>>>
>>> BR/Deepak
>>>
>>> Ivan Noris wrote:
>>>> Hi Deepak,
>>>>
>>>> my working configuration for Repository (Task Manager/cluster not
>>>> working yet) and Postgresql (I don't have mysql handy now):
>>>>
>>>> 1. postgresql JDBC driver is in <tomcat>/lib directory for datasource to
>>>> work
>>>> 2. <tomcat>/conf/context.xml:
>>>> . . .
>>>> <Context>
>>>>
>>>>     <!-- Default set of monitored resources -->
>>>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>>     <ResourceLink name="*jdbc/midpointDS*"
>>>>                   global="*jdbc/midpointDS*"
>>>>                   type="javax.sql.DataSource"/>
>>>>
>>>> . . .
>>>>
>>>> 3. <tomcat>/conf/server.xml:
>>>> . . .
>>>>   <GlobalNamingResources>
>>>> . . .
>>>>     <Resource name="*jdbc/midpointDS*" auth="Container"
>>>> type="javax.sql.DataSource"
>>>>         username="username" password="password"
>>>>         url="jdbc:postgresql://localhost/midpoint"
>>>>         driverClassName="org.postgresql.Driver"
>>>>         accessToUnderlyingConnectionAllowed="true"
>>>>         initialSize="5" maxWait="5000"
>>>>         maxActive="30" maxIdle="5"
>>>>         validationQuery="select 1"
>>>>         poolPreparedStatements="true"/>
>>>>   </GlobalNamingResources>
>>>> . . .
>>>>
>>>> 4. midpoint's config.xml:
>>>>
>>>>     <repository>
>>>>       <embedded>false</embedded>
>>>>      
>>>> <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceF
>>>>      
>>>> <hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointPostgreSQLDialect</hibernateDialect>
>>>>       <hibernateHbm2ddl>validate</hibernateHbm2ddl>
>>>>       *<dataSource>java:comp/env/jdbc/midpointDS</dataSource>*
>>>>     </repository>
>>>>
>>>> After starting, Configuration - About shows:
>>>> Additional details
>>>> dataSource     java:comp/env/jdbc/midpointDS
>>>>
>>>> so the Datasource is being used.
>>>>
>>>> I will still have to configure Task Manager, but this is a quick report
>>>> so you can test it (with MySQL).
>>>> I will update the wiki page after that.
>>>>
>>>> Best regards,
>>>> Ivan
>>>>
>>>> On 08/26/2014 05:49 PM, Deepak Natarajan wrote:
>>>>> Hi Ivan -
>>>>>
>>>>> I'm sorry, in my reply I pasted from the wiki, to make my point (i.e I
>>>>> am using the configuration as described).
>>>>>
>>>>> The one in my file is (and which is working correctly now that I added
>>>>> in the additional fields of username, password, url and driverclass:
>>>>>
>>>>>         <repository>
>>>>>
>>>>> <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass>
>>>>>             <embedded>false</embedded>
>>>>>
>>>>> <hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect>
>>>>>             <hibernateHbm2ddl>validate</hibernateHbm2ddl>
>>>>>             <dataSource>java:comp/env/jdbc/midpointDS</dataSource>
>>>>>             <jdbcUrl>jdbc:mysql://localhost:3306/midpoint</jdbcUrl>
>>>>>             <driverClassName>com.mysql.jdbc.Driver</driverClassName>
>>>>>             <jdbcUsername>x</jdbcUsername>
>>>>>             <jdbcPassword>x</jdbcPassword>
>>>>>             <!-- <asServer>true</asServer> -->
>>>>>             <!--
>>>>>             <baseDir>${midpoint.home}</baseDir>
>>>>>             -->
>>>>>         </repository>
>>>>>
>>>>> So yes, it is the same DS as I have configured in my Tomcat instance :
>>>>>
>>>>>   <GlobalNamingResources>
>>>>>     <!-- Editable user database that can also be used by
>>>>>          UserDatabaseRealm to authenticate users
>>>>>     -->
>>>>>     <Resource name="UserDatabase" auth="Container"
>>>>>               type="org.apache.catalina.UserDatabase"
>>>>>               description="User database that can be updated and saved"
>>>>>               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>>>>>               pathname="conf/tomcat-users.xml" />
>>>>>
>>>>>     <Resource name="jdbc/midpointDS" auth="Container"
>>>>> type="javax.sql.DataSource"
>>>>>         username="x" password="x"
>>>>>         url="jdbc:mysql://localhost:3306/midpoint"
>>>>>         driverClassName="com.mysql.jdbc.Driver"
>>>>>         accessToUnderlyingConnectionAllowed="true"
>>>>>         initialSize="5" maxWait="5000"
>>>>>         maxActive="30" maxIdle="5"
>>>>>         validationQuery="select 1"
>>>>>         poolPreparedStatements="true"/>
>>>>>
>>>>>   </GlobalNamingResources>
>>>>>
>>>>> which is the same in the context.xml
>>>>>
>>>>> -deepak
>>>>>
>>>>> Ivan Noris wrote:
>>>>>> Hi Deepak,
>>>>>>
>>>>>> it seems you are referencing bad datasource.
>>>>>>
>>>>>> Shouldn't it be "jdbc/mysql" based on your configuration pasted earlier
>>>>>> in this thread?
>>>>>> Anyway it must be the same as in the datasource configuration in Tomcat.
>>>>>>
>>>>>> Regards,
>>>>>> Ivan
>>>>>>
>>>>>> On 08/26/2014 05:07 PM, Deepak Natarajan wrote:
>>>>>>> Argh - I should have noticed this, sorry. Didn't spot this change in
>>>>>>> Vilo's email. This got rid of that error - however, I subsequently get
>>>>>>> these :
>>>>>>>
>>>>>>> Caused by: com.evolveum.midpoint.util.exception.SystemException: JDBC
>>>>>>> driver must be specified (either explicitly or in SQL repository
>>>>>>> configuration)
>>>>>>>
>>>>>>> Caused by: com.evolveum.midpoint.util.exception.SystemException: JDBC
>>>>>>> URL must be specified (either explicitly or in SQL repository
>>>>>>> configuration).
>>>>>>>
>>>>>>> Caused by: com.evolveum.midpoint.util.exception.SystemException: JDBC
>>>>>>> user name must be specified (either explicitly or in SQL repository
>>>>>>> configuration).
>>>>>>>
>>>>>>> So the configuration prescribed here :
>>>>>>>
>>>>>>> <configuration>
>>>>>>>     <midpoint>
>>>>>>>         <repository>
>>>>>>>
>>>>>>> <repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass>
>>>>>>>             <embedded>false</embedded>
>>>>>>>
>>>>>>> <hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect>
>>>>>>>             <hibernateHbm2ddl>validate</hibernateHbm2ddl>
>>>>>>>             <dataSource>java:comp/env/jdbc/mysql</dataSource>
>>>>>>>         </repository>
>>>>>>>     </midpoint>
>>>>>>> </configuration>
>>>>>>>
>>>>>>> does not work, I had to pretty much add in the rest of it (essentially
>>>>>>> what I had before moving to the DS configuration -
>>>>>>> https://wiki.evolveum.com/display/midPoint/MySQL). So I'm not sure if
>>>>>>> the DS is really being used, if you know what I mean...?
>>>>>>>
>>>>>>> Thanks
>>>>>>> -deepak
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> midPoint mailing list
>>>>>>> midPoint at lists.evolveum.com
>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>> -- 
>>>>   Ing. Ivan Noris
>>>>   Senior Identity Management Engineer
>>>>   evolveum.com
>>>>   ___________________________________________
>>>>            "Idem per idem - semper idem Vix."
>>>>
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>
>>> _______________________________________________
>>> midPoint mailing list
>>> midPoint at lists.evolveum.com
>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>> -- 
>>   Ing. Ivan Noris
>>   Senior Identity Management Engineer
>>   evolveum.com
>>   ___________________________________________
>>            "Idem per idem - semper idem Vix."
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer
  evolveum.com
  ___________________________________________
           "Idem per idem - semper idem Vix."




More information about the midPoint mailing list