Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:24:47+00:00 2026-06-15T05:24:47+00:00

Environment: Tomcat 7 JNDI Spring-MyBatis No JTA – commons pooling only Problem: Can’t get

  • 0

Environment:

Tomcat 7

JNDI

Spring-MyBatis

No JTA – commons pooling only

Problem: Can’t get the connection pooling to work as advertised. I can’t find a single example of this that doesn’t use a stand-alone Transaction manager or that doesn’t put all the settings in the war, which makes JNDI pointless. I’m told that JTA is overkill for this application and that we should stick with commons pooling. That makes sense but I don’t see a way to configure pooling, if we do it that way.

So… how do I configure connection pooling without putting the settings in the war file AND without using a stand-alone transaction manager? Can this be done without a full Java EE Application Server? We are just moving to Tomcat from another product which actually is full Java EE, so I am thinking this may be a Container vrs. Application server issue.

The weird part is that we can and have used JNDI but the pooling is definitely wrong.

Here is one example that probably works but why bother with JNDI if the settings are going to be in META-INF/context.xml?:

MyBatis JNDI Example

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:24:49+00:00Added an answer on June 15, 2026 at 5:24 am

    Even with context.xml, it’s still a container level setting. But, it’s a convenient way of deploying everything in a singe unit rather than having to create the connection pool before you deploy the WAR file.

    JNDI is meant to keep your application configuration generic. If you take your WAR and deploy it in WebSphere, for example, it will ignore the context.xml file. But WebSphere will see that you have a JDNI resource-ref in your web.xml and walk you through creating the data source. Same idea as Tomcat, just a different way of doing it.

    If you are 100% sure that this application will only run in Tomcat then you don’t have to use JNDI. But, it will save you trouble later if you do move to another container.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using tomcat 6.0.32 in a development environment with Spring Security (3.0.5). My problem
I set environment for Apache Tomcat (through setenv.sh) export JAVA_OPTS=-XX:PermSize=256m -XX:MaxPermSize=356m How can I
In my webapp which is deployed in tomcat environment, I have one spring configuration
I'm setting up a maven-spring-hibernate-mysql-tomcat environment. I would like to inject my Entity manager
I need to install Tomcat on my local mac environment. Only tutorials I am
So I've got a pretty standard spring, hibernate, tomcat environment.. yet I'm getting permgens
Based the accepted answer to this question I've setup a NetBeans/tomcat environment. In testing
I'd like to store the Tomcat v5.5 port in an environment variable and have
I'm using an environment with guice-servlet running on a tomcat and hibernate under guice-persist.
When I try to add Tomcat as a server runtime environment in eclipse, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.