Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

mysql in embedded tomcat - JNDI?

 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm migrating an app from stand-alone tomcat to jboss/tomcat.
I'm slowly getting to know JBoss and its configuration and deployment issues, but it's not easy finding the right docs and getting help. I've just given up on the JBoss.org forum, which the biggest newbie graveyard I've ever seen.
Anyway, if anyone can enlighten me on this issue, I'd appreciate it:
I've got a fair amount of code already running with struts in this app using JDBC in a tomcat JNDI resource connection pool. I can't find a way to set this up under jboss/tomcat.
Do I change over to using the xxxx-ds.xml, with a datasource pointing to mysql? That is a connection pool, right?
If not, where do I set up my existing commons.dbcp.BasicDatasourceFactory? The server.xml in /jbossweb-tomcat50.sar/ is obviously wrong, judging by the fact that it had no effect.
Thanks
Adam
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And do I need a resource-ref element in my webapp's web.xml for it?
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved this myself. For the sake of the archives, yes I did use a local-tx-datasource entry in my mysql-ds.xml file and it created a nice JBoss connection pool. And I didn't need a resource-ref in my web.xml.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you get the datasource in your servlet? through jndi?? I get name not bound.
 
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might still WANT a resource ref though, then you can access a local java:/comp/env/jdbc name rather than the global name. You don't have to, but I think it's a good idea in general to not hardcode lookups of global jndi names.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, that's right. Global JNDI. Norm, is that less efficient than calling it up via the local name?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic