| Author |
Error in configuration/accessing JBoss datasource jdbc not bound
|
corrado martini
Greenhorn
Joined: May 27, 2010
Posts: 13
|
|
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
|
 |
Joydeep Ghatak
Ranch Hand
Joined: Sep 30, 2009
Posts: 36
|
|
Hi Martini,
Please double check the -ds.xml file.
You can refer the following link,
http://www.coderanch.com/t/549915/JBoss/JBoss-Oracle-Configuration-new-DataSource
Thanks,
Joydeep
|
“Men are only as good as their technical development allows them to be.”
|
 |
corrado martini
Greenhorn
Joined: May 27, 2010
Posts: 13
|
|
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
|
 |
Jaikiran Pai
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6720
|
|
Do you have any jar file(s) containing javax.sql.* classes in your application? If yes, remove such jars from the application packaging.
|
[My Blog] [JavaRanch Journal]
|
 |
corrado martini
Greenhorn
Joined: May 27, 2010
Posts: 13
|
|
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:
|
| Filename |
Tomcat.JPG |
Download
|
| Description |
|
| Filesize |
75 Kbytes
|
| Downloaded: |
7 time(s) |
|
 |
Jaikiran Pai
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6720
|
|
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
Joined: May 27, 2010
Posts: 13
|
|
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
Joined: May 27, 2010
Posts: 13
|
|
|
This is correct link link
|
 |
corrado martini
Greenhorn
Joined: May 27, 2010
Posts: 13
|
|
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
Saloon Keeper
Joined: Jul 20, 2005
Posts: 6720
|
|
Glad to know you got it working
|
 |
 |
|
|
subject: Error in configuration/accessing JBoss datasource jdbc not bound
|
|
|