Message Boards

Datasource binding in Liferay 7.4.2 GA3

thumbnail
Mikael Andersson, modified 2 Years ago.

Datasource binding in Liferay 7.4.2 GA3

New Member Posts: 12 Join Date: 2/1/20 Recent Posts

Prior to 7.4.2 GA3 I've configured datasources to my external databases in [tomcat-home]/conf/context.xml (Context section, each datasource configured as a Resource). This has worked fine with 7.3.x and 7.4.x until 7.4.2.

With 7.4.2 when my portlet creates an org.springframework.context.ApplicationContext I'm getting

javax.naming.NameNotFoundException: Name [ExternalDS] is not bound in this Context. Unable to find [ExternalDS].

It looks like something has changed in 7.4.2 compared to previous releases.

Any ideas about what has been changed and might cause this error?

Brian Zuppardi, modified 2 Years ago.

RE: Datasource binding in Liferay 7.4.2 GA3

New Member Posts: 2 Join Date: 3/3/20 Recent Posts

Did you ever get anywhere with this? I am having a similar issue when testing our upgrade from 7.2 to 7.4 DXP. We use JNDI and context.xml to define our datasources, including the Liferay database itself. I can't get it to create the context on portal startup after upgradin the DB and the new image. I'm guessing a differnt version of Tomcat and requiring a slightly different setup?

thumbnail
Mikael Andersson, modified 2 Years ago.

RE: RE: Datasource binding in Liferay 7.4.2 GA3

New Member Posts: 12 Join Date: 2/1/20 Recent Posts

Hello Brian!

I have not found a way to use Tomcat JNDI to connect to external databases which was and is my primary need. I'm not sure but I think this does not relate to Tomcat versions but to the change in Liferay architecture where Liferay portlets no more see Tomcat classloader.

At the moment I have a working alternate solution using HikariCP connection pool.

I have not found any documentation about the change if the change was in Liferay.

Please share your information if you find any news on the DXP side.

Cheers!

 

Brian Zuppardi, modified 2 Years ago.

RE: RE: Datasource binding in Liferay 7.4.2 GA3

New Member Posts: 2 Join Date: 3/3/20 Recent Posts

Hi Mikael!

I thought you might find Friday's blog post from David Nebinger of some interest... https://liferay.dev/blogs/-/blogs/setting-up-jndi-in-liferay-7-4?s=09

I was able to get my existing JNDI configuration to work (context.xml) all I had to do was change the location where I was copying the mysql jdbc driver jar into the container from /opt/liferay/tomcat/lib/ext to /opt/liferay/tomcat/lib

Good luck,

Brian

thumbnail
Mikael Andersson, modified 2 Years ago.

RE: RE: Datasource binding in Liferay 7.4.2 GA3

New Member Posts: 12 Join Date: 2/1/20 Recent Posts

Thanks Brian!

I saw the blog post but have not had time to test anything yet. We use Spring Framework over here and I think there have been some challenges with switching class loaders. I will test this in the near future and reply the results.

Many thanks for your reply.