<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Deepak,<br>
    <br>
    by "Unknown column 'id'..." it seems to be a problem with the
    validation query.<br>
    <br>
    Please try the example from Vilo: validationQuery="select 1"<br>
    <br>
    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)<br>
    <br>
    I.<br>
    <br>
    <div class="moz-cite-prefix">On 08/26/2014 03:56 PM, Deepak
      Natarajan wrote:<br>
    </div>
    <blockquote cite="mid:53FC9226.6060706@trilobytesystems.com"
      type="cite">
      <pre wrap="">
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:
</pre>
      <blockquote type="cite">
        <pre wrap="">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:
</pre>
        <blockquote type="cite">
          <pre wrap="">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
</pre>
          <blockquote type="cite">
            <pre wrap="">Viliam Repan <a class="moz-txt-link-rfc2396E" href="mailto:vilo.repan@evolveum.com"><mailto:vilo.repan@evolveum.com></a>
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 <a class="moz-txt-link-rfc2396E" href="mailto:dnataraj@trilobytesystems.com"><mailto:dnataraj@trilobytesystems.com></a>
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?

<a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/Repository+Configuration">https://wiki.evolveum.com/display/midPoint/Repository+Configuration</a>

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
[<a class="moz-txt-link-freetext" href="jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml">jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml</a>]:
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
[<a class="moz-txt-link-freetext" href="jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml">jar:file:/Users/dnataraj/dev/midpoint/gui/admin-gui/target/midpoint/WEB-INF/lib/repo-sql-impl-3.0.jar!/ctx-repository-session.xml</a>]:
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 :

<a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/MySQL">https://wiki.evolveum.com/display/midPoint/MySQL</a>

Which does not use the new DS - and this is what I had earlier and it
works.

</pre>
          </blockquote>
          <pre wrap="">
-- 
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
<a class="moz-txt-link-freetext" href="http://www.trilobytesystems.com">http://www.trilobytesystems.com</a>




_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
        </blockquote>
        <pre wrap="">
-- 
Ing. Viliam Repáň
Evolveum, s.r.o.

tel: +421 910 797978
mail: <a class="moz-txt-link-abbreviated" href="mailto:vilo.repan@evolveum.com">vilo.repan@evolveum.com</a>

_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
      </blockquote>
      <pre wrap="">
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer
  evolveum.com
  ___________________________________________
           "Idem per idem - semper idem Vix."
</pre>
  </body>
</html>