• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Author
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try taking the / out of your jndi-name in your jboss-web.xml:

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic