title: Can't seem to get a JNDI JDBC resource working in Liferay
body: <p>No joy in the Liferay forum on this issue and the clock is ticking on this project.  This may be caused by my lack of knowledge of Spring.</p>
  
  <p>I have a JNDI global resource defined in server.xml and a resource link in context.xml in my Tomcat 7 /conf folder. I KNOW the JNDI resource is being loaded because I see the validation query being run as the server starts up. So far so good.</p>
  
  <p>I have a portlet that just provides services to other portlets. In that portlet I have a hibernate.cfg.xml which has a session-factory that also points to the JDBC resource (don't know if this is needed or not). I also have an ext-spring.xml file in the services portlet that has the following:</p>
  
  <pre><code>&lt;bean id="liferayHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration" &gt;
  &lt;property name="dataSource" ref="MyJDBCResource" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="MyJDBCResource" class="org.springframework.jndi.JndiObjectFactoryBean" &gt;
  &lt;property name="jndiName" value="java:comp/env/jdbc/MyJDBCResource" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Adding the above in ext-spring.xml fixed an issue with a bean error on that services portlet upon deployment. In that service builder built portlet, a services jar was created and I put that service jar in the Tomcat_Home/lib/ext folder so that I could use the services provided by the portlet in my portlet. So far so good. But, when I invoke the portlet method which calls the services provided by the other portlet with the JNDI references, I get a "user lacks privilege or object not found" error. It is <em>definitely</em> object not found. When the query is run I see absolutely NO activity on the JDBC connection specified by the JNDI resource entry and in drilling down on the connection properties I only see the HSQLDB driver in use. It <em>should</em> be using the MSSQL driver specified in my global resource JNDI entry as far as I understand it.</p>
  
  <p>SO WHAT AM I DOING WRONG? Do I need to add some configuration entries in the portlet that <em>invokes</em> the services? </p>
  
  <p>This seems so simple. In reading the many posts that give instructions on using JNDI/JDBC resources I seem to have followed them correctly. Is there some trick to using JNDI/JDBC resources in LR 6.1.1 and Tomcat 7 that I have missed?</p>
  
  <p>Thanks (and really hoping for some answers!).</p>