Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try taking the / out of your jndi-name in your jboss-web.xml:

 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic