tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource
Date Mon, 25 Jan 2010 20:40:51 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steve,

On 1/25/2010 2:56 PM, Steve Ryder wrote:
> Starting from the bottom up of your suggestions:
> 1)  I tried removing the try/catch.  No can do, Java compiler forces me
> to catch the exceptions.

Hmm... what method is declared as throwing "Exception" instead of
something more specific?

> 2)  However, Java does provide a getStackTrace.

Throwable.printStackTrace() will also do the trick.

> 2010-01-25
> 19:37:09:Stack(5)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> 2010-01-25
> 19:37:09:Stack(4)org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> 
> 2010-01-25
> 19:37:09:Stack(3)org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
> 2010-01-25 19:37:09:Stack(2)com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
> 2010-01-25
> 19:37:09:Stack(1)com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
> 2010-01-25 19:37:09:Stack(0)com.jsrsys.web.JsrSQL.connect(JsrSQL.java:503)

Is this the code you posted earlier? If so, which line is 503?

> 2010-01-25 19:37:09:*WARNING*Connection to jdbc/MySql:: connect Other
> exception: org.apache.naming.ResourceRef cannot be cast to
> javax.sql.DataSource

This isn't the error message you posted earlier. The one you posted
earlier was:

"
2010-01-25 15:56:06:*WARNING*Connection to jdbc/MySql:: connect Other
exception: Cannot create resource instance
"

> Removing the Class.forName code did not change anything, I still get
> the same error.

Right: the Class.forName simply wasn't necessary... I didn't expect it
to change anything.

> 2010-01-25 20:00:03:*WARNING*Connection to jdbc/MySql:: connect Other exception: org.apache.naming.ResourceRef
cannot be cast to javax.sql.DataSource
>
> 2010-01-25 20:00:03:Stack(4)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> 2010-01-25 20:00:03:Stack(3)=org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
> 2010-01-25 20:00:03:Stack(2)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
> 2010-01-25 20:00:03:Stack(1)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
> 2010-01-25 20:00:03:Stack(0)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)
> 2010-01-25 20:00:03:JsrSQL: Context cast successfull

Could you re-post the whole method? The object you get from the JNDI
context really /should/ be a javax.sql.DataSource object, not a
ResourceLink.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkteAdMACgkQ9CaO5/Lv0PAm7wCfSWyuzVUbJ1zXqaruicFBoUnS
R6wAn3JGjRZ7uMS5uf1tR8utZ7oWnzpT
=ymR0
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message