• 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

Error in configuration/accessing JBoss datasource jdbc not bound

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello , I'm trying to use JBOSS for my Java struts application. But this error makes me mad!!
The connection with Db2 database is ok when using Tomcat 7.0.11 installed on my PC , but in my company I have to use JBOSS so I've istalled JBOSS rel 5.1.0

First the datasource is this: db2-ds.xml:

Second file web.xml contains:

Third file jboss-web.xml:

Fourth, java code in servlet action:

Fifth server.log:


Any advice is very appreciated, thanks in advance
 
Ranch Hand
Posts: 43
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martini,

Please double check the -ds.xml file.
You can refer the following link,

https://coderanch.com/t/549915/JBoss/JBoss-Oracle-Configuration-new-DataSource

Thanks,
Joydeep

 
corrado martini
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry the file jboss-web.xml is


Now the error is javax.servlet.ServletException: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource cannot be cast to javax.sql.DataSource

I've just find in this link:
comunity Jboss

I've done all things indicated: the driver's file ( .jar and .zip) are placed in correct directory: C:\Programmi\JBOSS\jboss-5.1.0.GA\server\default\lib

In file server log I see those lines:


But a run-tine, when java servlet try to access datasource I have same error:

javax.servlet.ServletException: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource cannot be cast to javax.sql.DataSource
 
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
Do you have any jar file(s) containing javax.sql.* classes in your application? If yes, remove such jars from the application packaging.
 
corrado martini
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok I have an example, project named "prova" developed with Tomcat Application server with Db2 libraries placed under WEB-INF\lib . And this is OK: look at this screen shot:
Tomcat.JPG
[Thumbnail for Tomcat.JPG]
 
Jaikiran Pai
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
You'll have to remove that jar from the application being deployed. You can still have it in your compile time classpath but just not in the deployed application packaging.
 
corrado martini
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well , I have on this link , previous image is not clear, sorry

the situationscreen shot Tomcat & Jboss configuration in Netbeans IDE

In JBoss application. I have removed Db2 jar file from WEB-INF/lib and put in Jboss lib directory C:\Programmi\JBOSS\jboss-5.1.0.GA\server\default\lib
 
corrado martini
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is correct link link
 
corrado martini
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solve the problem. Your suggestion /advice was right I have to remove db2 driver's jar included in the application
I firstly remove these jar files using Netbeans IDE interface ( I have Netbeans 7.0 version), but even if I removed these file is included in .war file that I deployed.

Finally I realize the mistake opening my application war , using winrar, I erased the db2 drivers files and the connection with db2 database is OK
I beg your pardon for the delay of my reply but in these days I was off to work for personal problem, so have a good 2012 and thanks a lot.
 
Jaikiran Pai
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
Glad to know you got it working
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic