Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a JNDI Datasource on Undertow?

I have a running Spring application that already works on Weblogic and JBoss, and I'm adding the option to run it by itself with Spring Boot.

As it has a Java EE architecture, it has a container-managed datasource that is looked up by a JNDI name, and I wanted to keep it that way.

I see that Spring Boot has the ability to use a EE container called Undertow, that it turns out to be the Wildfly EE engine.

I've done A LOT of research on how to define this JNDI Datasource in Undertow with config files and stuff, but I can't find any documentation on that on Undertow's website and neither on WildFly documentation.

Has someone already done that? I need to know how to define this Datasource with a config file or something.

like image 718
ViniciusPires Avatar asked Aug 24 '16 21:08

ViniciusPires


People also ask

What is DataSource JNDI name?

A JNDI DataSource object is a file that contains the configuration details necessary to connect to a database. The DataSource object must be registered on a JNDI server, where it is identified using a JNDI name. You can register your DataSource object directly on your application server via its JNDI service.

Does Spring boot use JNDI?

jndi-name in the Spring application properties. Spring Boot creates a JdbcTemplate that uses the data source that is named in application.


1 Answers

I don't think Undertow supports that - it's just a web server, nothing else, and very far from being a JEE container. Wildfly, on the other hand, is a JEE container and it uses Undertow as a web engine and builds up other JEE stuff around it.

Here's a quote from Undertow's official documentation:

On thing that makes Undertow unique is that it has no concept of a global container. Instead an Undertow server is assembled by the embedding application. This makes Undertow extremely flexible, and the embedding application can basically just pick the parts that they need, and assemble them in whatever way makes sense.

An Undertow server is basically composed of three things, one (or more) XNIO worker instance, one or more connectors, and a handler chain to handle incoming requests.

like image 103
Miloš Milivojević Avatar answered Sep 24 '22 18:09

Miloš Milivojević