aspose file tools*
The moose likes JBoss/WildFly and the fly likes DB connection doesn't seem to work after migration from Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "DB connection doesn Watch "DB connection doesn New topic
Author

DB connection doesn't seem to work after migration from Tomcat

Bojan Tomic
Greenhorn

Joined: Apr 08, 2008
Posts: 25
Hi.

I'm having a problem deploying my web application (.war) to JBoss 5.0.1. Previously, it was running on Tomcat 6.

Since I was depending on a pooled DataSource, in order to migrate to JBoss, I added a mysql-ds.xml to 'deploy' directory and added jboss-web.xml to WEB-INF.
Here's how they look like:

mysql-ds.xml


web.xml


jboss-web.xml


Deploying mysql-ds.xml returns no erros. It gets bound to the MySqlDS JNDI name. Still, when I attempt to do a


ds is null. Did I misconfigure something? Any idea is welcome...
Just to remind, I'm on JBoss 5.0.1.

Thanks for your time.

[EDIT]
In case it is helpful, here's the original Context.xml that worked under Tomcat:
Javid Jamae
Author
Ranch Hand

Joined: May 14, 2008
Posts: 198
Try taking the / out of your jndi-name in your jboss-web.xml:



Author: JBoss in Action, javidjamae.com, @javidjamae on Twitter
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

ds is null


Getting a null datasource (instead of a NameNotFoundException) from JNDI lookup usually ends up being a classloader issue. Do you have any jar files in your application which contain javax.sql.* classes or any JBoss specific jar files? If yes, remove them from the application packaging.

[My Blog] [JavaRanch Journal]
Bojan Tomic
Greenhorn

Joined: Apr 08, 2008
Posts: 25
Thanks you both for the advices. In the end, it turned out to be a classloading issue. I removed the DB drivers from the app package, put the JAR into server/default/lib only, restared JBoss and it works fine.

Thanks you again for your time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DB connection doesn't seem to work after migration from Tomcat