<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Deepak,<br>
    <br>
    this is how tomcat/conf/config.xml looks like in my tomcat:<br>
    <?xml version='1.0' encoding='utf-8'?><br>
    <Context><br>
        <WatchedResource>WEB-INF/web.xml</WatchedResource><br>
        <ResourceLink name="jdbc/midpointDataSource"<br>
                      global="jdbc/midpointDataSource"<br>
                      type="javax.sql.DataSource"/><br>
    <br>
    </Context><br>
    <br>
    tomcat/conf/server.xml contains:<br>
    <Resource name="jdbc/midpointDataSource" auth="Container"
    type="javax.sql.DataSource"<br>
         username="midpoint" password="qwe123"<br>
         url="jdbc:mysql://localhost:3306/midpoint"<br>
         driverClassName="com.mysql.jdbc.Driver"<br>
         accessToUnderlyingConnectionAllowed="true"<br>
         initialSize="5" maxWait="5000"<br>
         maxActive="10" maxIdle="5"<br>
         validationQuery="select 1"<br>
         poolPreparedStatements="true"/><br>
    <br>
    in element GlobalNamingResources<br>
    <br>
    Best regards,<br>
    <br>
    Vilo<br>
    <br>
    <div class="moz-cite-prefix">On 26.08.2014 13:37, Deepak Natarajan
      wrote:<br>
    </div>
    <blockquote cite="mid:53FC7194.6030205@trilobytesystems.com"
      type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      Hi Vilo,<br>
      <br>
      <br>
      Thanks for the reply. I have reverted back to my earlier
      pre-datasource configuration to get things running.<br>
      <br>
      <br>
      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?<br>
      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. <br>
      <br>
      Thanks<br>
      BR/Deepak <br>
      <blockquote style="border: 0px none;"
        cite="mid:53FC6447.30701@evolveum.com" type="cite">
        <div style="margin:30px 25px 10px 25px;" class="__pbConvHr">
          <div style="display:table;width:100%;border-top:1px solid
            #EDEEF0;padding-top:5px">
            <div
              style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
                photoaddress="vilo.repan@evolveum.com" photoname="Viliam
                Repan" src="cid:part1.00070900.01080801@evolveum.com"
                name="compose-unknown-contact.jpg" height="25px"
                width="25px"></div>
            <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
              <a moz-do-not-send="true"
                href="mailto:vilo.repan@evolveum.com"
                style="color:#737F92
                !important;padding-right:6px;font-weight:bold;text-decoration:none
                !important;">Viliam Repan</a></div>
            <div
              style="display:table-cell;white-space:nowrap;vertical-align:middle;">
              <font color="#9FA2A5"><span style="padding-left:6px">August
                  26, 2014 at 12:41 PM</span></font></div>
          </div>
        </div>
        <div style="color:#888888;margin-left:24px;margin-right:24px;"
          __pbrmquotes="true" class="__pbConvBody">Hi Deepak,
          <br>
          <br>
          datasource should work, I currently don't have time to test it
          on my computer against MySQL, but configuration looks fine to
          me.
          <br>
          From what I can see there is a configuration problem in your
          application server.
          <br>
          <br>
          Invocation of init method failed; nested exception is
          <br>
          javax.naming.NameNotFoundException: Name [jdbc/mysql] is not
          bound in
          <br>
          this Context. Unable to find [jdbc].
          <br>
          <br>
          If it is tomcat maybe resource link to this datasource is
          missing in context.xml or something like that...
          <br>
          <br>
          Best regards,
          <br>
          <br>
          Vilo
          <br>
          <br>
          <br>
          <br>
          <br>
        </div>
        <div style="margin:30px 25px 10px 25px;" class="__pbConvHr">
          <div style="display:table;width:100%;border-top:1px solid
            #EDEEF0;padding-top:5px">
            <div
              style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
                photoaddress="dnataraj@trilobytesystems.com"
                photoname="Deepak Natarajan"
                src="cid:part1.00070900.01080801@evolveum.com"
                name="compose-unknown-contact.jpg" height="25px"
                width="25px"></div>
            <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
              <a moz-do-not-send="true"
                href="mailto:dnataraj@trilobytesystems.com"
                style="color:#737F92
                !important;padding-right:6px;font-weight:bold;text-decoration:none
                !important;">Deepak Natarajan</a></div>
            <div
              style="display:table-cell;white-space:nowrap;vertical-align:middle;">
              <font color="#9FA2A5"><span style="padding-left:6px">August
                  26, 2014 at 10:39 AM</span></font></div>
          </div>
        </div>
        <div style="color:#888888;margin-left:24px;margin-right:24px;"
          __pbrmquotes="true" class="__pbConvBody">
          <div>Hi -<br>
            <br>
            I have been trying to update my MySQL configuration from 2.3
            to fit with<br>
            3.0 since I noticed that the relevant documentation has
            changed as well.<br>
            <br>
            Question : Is the MySQL configuration not relying on the new
            data source<br>
            defined in Tomcat?<br>
            <br>
            <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://wiki.evolveum.com/display/midPoint/Repository+Configuration">https://wiki.evolveum.com/display/midPoint/Repository+Configuration</a><br>
            <br>
            I have the Resource defined as shown :<br>
            <br>
            <Resource name="jdbc/mysql" auth="Container"
            type="javax.sql.DataSource"<br>
            username="x" password="x"<br>
            url="jdbc:mysql://localhost:3306/midpoint"<br>
            driverClassName="com.mysql.jdbc.Driver"<br>
            accessToUnderlyingConnectionAllowed="true"<br>
            initialSize="5" maxWait="5000"<br>
            maxActive="30" maxIdle="5"<br>
            validationQuery="select id from m_system_configuration"<br>
            poolPreparedStatements="true"/><br>
            <br>
            And the corresponding configuration in config.xml :<br>
            <br>
            <repository><br>
            <br>
<repositoryServiceFactoryClass>com.evolveum.midpoint.repo.sql.SqlRepositoryFactory</repositoryServiceFactoryClass><br>
            <embedded>false</embedded><br>
            <br>
<hibernateDialect>com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect</hibernateDialect><br>
            <hibernateHbm2ddl>validate</hibernateHbm2ddl><br>
<dataSource>java:comp/env/jdbc/mysql</dataSource><br>
            </repository><br>
            <br>
            But this is failing.<br>
            <br>
            <br>
            014-08-26 08:27:43,408 [RMI TCP Connection(2)-127.0.0.1]
            ERROR<br>
            (org.springframework.web.context.ContextLoader): Context
            initialization<br>
            failed<br>
            org.springframework.beans.factory.BeanCreationException:
            Error creating<br>
            bean with name 'repositoryService' defined in class path
            resource<br>
            [ctx-configuration.xml]: Initialization of bean failed;
            nested exception<br>
            is org.springframework.beans.factory.BeanCreationException:
            Error<br>
            creating bean with name 'sessionFactory' defined in URL<br>
            [<a moz-do-not-send="true" 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%21/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>]:<br>
            Initialization of bean failed; nested exception is<br>
            org.springframework.beans.factory.BeanExpressionException:
            Expression<br>
            parsing failed; nested exception is<br>
            org.springframework.expression.spel.SpelEvaluationException:<br>
            EL1021E:(pos 14): A problem occurred whilst attempting to
            access the<br>
            property 'dataSource': 'Unable to access property
            'dataSource' through<br>
            getter'<br>
            ... 73 common frames omitted<br>
            Caused by: java.lang.reflect.InvocationTargetException: null<br>
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
            Method)<br>
            ~[na:1.7.0_45]<br>
            at<br>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br>
            ~[na:1.7.0_45]<br>
            at<br>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>
            ~[na:1.7.0_45]<br>
            at java.lang.reflect.Method.invoke(Method.java:606)
            ~[na:1.7.0_45]<br>
            at<br>
org.springframework.expression.spel.support.ReflectivePropertyAccessor$OptimalPropertyAccessor.read(ReflectivePropertyAccessor.java:495)<br>
            ~[spring-expression-3.1.0.RELEASE.jar:3.1.0.RELEASE]<br>
            ... 74 common frames omitted<br>
            Caused by:
            org.springframework.beans.factory.BeanCreationException:<br>
            Error creating bean with name 'jndiDataSource' defined in
            URL<br>
            [<a moz-do-not-send="true" 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%21/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>]:<br>
            Invocation of init method failed; nested exception is<br>
            javax.naming.NameNotFoundException: Name [jdbc/mysql] is not
            bound in<br>
            this Context. Unable to find [jdbc].<br>
            <br>
            However, I see that the MySQL configuration looks different
            here :<br>
            <br>
            <a moz-do-not-send="true" class="moz-txt-link-freetext"
              href="https://wiki.evolveum.com/display/midPoint/MySQL">https://wiki.evolveum.com/display/midPoint/MySQL</a><br>
            <br>
            Which does not use the new DS - and this is what I had
            earlier and it works.<br>
            <br>
          </div>
        </div>
      </blockquote>
      <br>
      <div class="moz-signature">-- <br>
        Deepak Natarajan<br>
        Director<br>
        <br>
        Trilobyte Systems ApS<br>
        <br>
        Falkoner Alle 1, 3            Fredrikinkatu 61A, 6th Floor<br>
        2000 Frederiksberg         Business Center Papula<br>
        Denmark                          00100 Helsinki<br>
                                                Finland<br>
        <br>
        Tel : +45 29375068<br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="http://www.trilobytesystems.com">http://www.trilobytesystems.com</a><br>
        <br>
        <br>
      </div>
      <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. 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>
</pre>
  </body>
</html>