jQuery in Action, 2nd edition*
The moose likes JBoss/WildFly and the fly likes mysql in embedded tomcat - JNDI? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "mysql in embedded tomcat - JNDI?" Watch "mysql in embedded tomcat - JNDI?" New topic
Author

mysql in embedded tomcat - JNDI?

Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
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


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
And do I need a resource-ref element in my webapp's web.xml for it?
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
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.
John Myers
Greenhorn

Joined: Mar 22, 2004
Posts: 5
How did you get the datasource in your servlet? through jndi?? I get name not bound.
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
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

Joined: Oct 09, 2001
Posts: 565
Yup, that's right. Global JNDI. Norm, is that less efficient than calling it up via the local name?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mysql in embedded tomcat - JNDI?
 
Similar Threads
servlet/jsp container vs. app server
JDBC Connection Pooling
Tomcat, MySQL,JSP/Servlets -> Connection Pooling
JBoss 3.2.x, MySQL and Connection Pooling Question
How to access a DataSource in JBoss Remoting ?