[midPoint] MySQL configuration for 3.0

Ivan Noris ivan.noris at evolveum.com
Tue Aug 26 16:37:02 CEST 2014


Hi Deepak,

by "Unknown column 'id'..." it seems to be a problem with the validation
query.

Please try the example from Vilo: validationQuery="select 1"

The m_system_configuration table does not have "id" column. (Which may
be outdated info in Datasource documentation in our wiki; we will fix it)

I.

On 08/26/2014 03:56 PM, Deepak Natarajan wrote:
> Hi Vilo -
>
> Thanks! Adding the ResourceLink fixed the problem (I guess it would be
> nice to add this to the wiki on db configuration), but we have the next
> one (as usual). I have attached the idm logs, but the base error is :
>
> Caused by: javax.naming.NamingException: Cannot create
> PoolableConnectionFactory (Unknown column 'id' in 'field list')
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:860)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
> ~[catalina.jar:7.0.47]
> 	at
> org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:94)
> ~[catalina.jar:7.0.47]
> 	at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
> ~[na:1.7.0_45]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
> ~[catalina.jar:7.0.47]
> 	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
> ~[catalina.jar:7.0.47]
> 	at javax.naming.InitialContext.lookup(InitialContext.java:411)
> ~[na:1.7.0_45]
> 	at
> org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
> ~[spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
> ~[spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
> ~[spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
>
> Any thoughts?
>
> Viliam Repan wrote:
>> Hi Deepak,
>>
>> this is how tomcat/conf/config.xml looks like in my tomcat:
>> <?xml version='1.0' encoding='utf-8'?>
>> <Context>
>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>     <ResourceLink name="jdbc/midpointDataSource"
>>                   global="jdbc/midpointDataSource"
>>                   type="javax.sql.DataSource"/>
>>
>> </Context>
>>
>> tomcat/conf/server.xml contains:
>> <Resource name="jdbc/midpointDataSource" auth="Container"
>> type="javax.sql.DataSource"
>>      username="midpoint" password="qwe123"
>>      url="jdbc:mysql://localhost:3306/midpoint"
>>      driverClassName="com.mysql.jdbc.Driver"
>>      accessToUnderlyingConnectionAllowed="true"
>>      initialSize="5" maxWait="5000"
>>      maxActive="10" maxIdle="5"
>>      validationQuery="select 1"
>>      poolPreparedStatements="true"/>
>>
>> in element GlobalNamingResources
>>
>> Best regards,
>>
>> Vilo
>>
>> On 26.08.2014 13:37, Deepak Natarajan wrote:
>>> Hi Vilo,
>>>
>>>
>>> Thanks for the reply. I have reverted back to my earlier
>>> pre-datasource configuration to get things running.
>>>
>>>
>>> I cannot find a sample <context> for Midpoint on the wiki for my
>>> Tomcat configuration. I'm assuming I would add my resource in there?
>>> On the wiki right now, the Resource definition is added as a global
>>> (hence, I assumed, there is no need for a particular application
>>> context), but, as you pointed out if a resource link is needed to this
>>> Global resource definition, then I will need to create a context for
>>> Midpoint in my Tomcat server.xml.
>>>
>>> Thanks
>>> BR/Deepak
>>>> Viliam Repan <mailto:vilo.repan at evolveum.com>
>>>> August 26, 2014 at 12:41 PM
>>>> Hi Deepak,
>>>>
>>>> datasource should work, I currently don't have time to test it on my
>>>> computer against MySQL, but configuration looks fine to me.
>>>> From what I can see there is a configuration problem in your
>>>> application server.
>>>>
>>>> Invocation of init method failed; nested exception is
>>>> javax.naming.NameNotFoundException: Name [jdbc/mysql] is not bound in
>>>> this Context. Unable to find [jdbc].
>>>>
>>>> If it is tomcat maybe resource link to this datasource is missing in
>>>> context.xml or something like that...
>>>>
>>>> Best regards,
>>>>
>>>> Vilo
>>>>
>>>>
>>>>
>>>>
>>>> Deepak Natarajan <mailto:dnataraj at trilobytesystems.com>
>>>> August 26, 2014 at 10:39 AM
>>>> Hi -
>>>>
>>>> I have been trying to update my MySQL configuration from 2.3 to fit with
>>>> 3.0 since I noticed that the relevant documentation has changed as well.
>>>>
>>>> Question : Is the MySQL configuration not relying on the new data source
>>>> defined in Tomcat?
>>>>
>>>> https://wiki.evolveum.com/display/midPoint/Repository+Configuration
>>>>
>>>> I have the Resource defined as shown :
>>>>
>>>> <Resource name="jdbc/mysql" 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 id from m_system_configuration"
>>>> poolPreparedStatements="true"/>
>>>>
>>>> And the corresponding configuration in config.xml :
>>>>
>>>> <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>
>>>>
>>>> But this is failing.
>>>>
>>>>
>>>> 014-08-26 08:27:43,408 [RMI TCP Connection(2)-127.0.0.1] ERROR
>>>> (org.springframework.web.context.ContextLoader): Context initialization
>>>> failed
>>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>>> bean with name 'repositoryService' defined in class path resource
>>>> [ctx-configuration.xml]: Initialization of bean failed; nested exception
>>>> is org.springframework.beans.factory.BeanCreationException: Error
>>>> creating bean with name 'sessionFactory' defined in URL
>>>> [jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml]:
>>>> Initialization of bean failed; nested exception is
>>>> org.springframework.beans.factory.BeanExpressionException: Expression
>>>> parsing failed; nested exception is
>>>> org.springframework.expression.spel.SpelEvaluationException:
>>>> EL1021E:(pos 14): A problem occurred whilst attempting to access the
>>>> property 'dataSource': 'Unable to access property 'dataSource' through
>>>> getter'
>>>> ... 73 common frames omitted
>>>> Caused by: java.lang.reflect.InvocationTargetException: null
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> ~[na:1.7.0_45]
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>> ~[na:1.7.0_45]
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> ~[na:1.7.0_45]
>>>> at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
>>>> at
>>>> org.springframework.expression.spel.support.ReflectivePropertyAccessor$OptimalPropertyAccessor.read(ReflectivePropertyAccessor.java:495)
>>>> ~[spring-expression-3.1.0.RELEASE.jar:3.1.0.RELEASE]
>>>> ... 74 common frames omitted
>>>> Caused by: org.springframework.beans.factory.BeanCreationException:
>>>> Error creating bean with name 'jndiDataSource' defined in URL
>>>> [jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml]:
>>>> Invocation of init method failed; nested exception is
>>>> javax.naming.NameNotFoundException: Name [jdbc/mysql] is not bound in
>>>> this Context. Unable to find [jdbc].
>>>>
>>>> However, I see that the MySQL configuration looks different here :
>>>>
>>>> https://wiki.evolveum.com/display/midPoint/MySQL
>>>>
>>>> Which does not use the new DS - and this is what I had earlier and it
>>>> works.
>>>>
>>> -- 
>>> Deepak Natarajan
>>> Director
>>>
>>> Trilobyte Systems ApS
>>>
>>> Falkoner Alle 1, 3            Fredrikinkatu 61A, 6th Floor
>>> 2000 Frederiksberg         Business Center Papula
>>> Denmark                          00100 Helsinki
>>>                                         Finland
>>>
>>> Tel : +45 29375068
>>> http://www.trilobytesystems.com
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> midPoint mailing list
>>> midPoint at lists.evolveum.com
>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>> -- 
>> Ing. Viliam Repáň
>> Evolveum, s.r.o.
>>
>> tel: +421 910 797978
>> mail: vilo.repan at evolveum.com
>>
>> _______________________________________________
>> 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."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140826/ee6b4e91/attachment.htm>


More information about the midPoint mailing list