OK, I took factory out of context.xml, now I get Resource Instance again,
but this time I have the trace!
2010-01-26 05:11:30:*WARNING*Connection to jdbc/MySql:: connect Other
exception: Cannot create resource instance
2010-01-26
05:11:30:Stack(10)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-26
05:11:30:Stack(9)=org.apache.jsp.AppList_jsp._jspService(AppList_jsp.java:157)
2010-01-26 05:11:30:Stack(8)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-26
05:11:30:Stack(7)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
2010-01-26 05:11:30:Stack(6)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)
2010-01-26
05:11:30:Stack(5)=org.apache.naming.NamingContext.lookup(NamingContext.java:153)
2010-01-26
05:11:30:Stack(4)=org.apache.naming.NamingContext.lookup(NamingContext.java:781)
2010-01-26
05:11:30:Stack(3)=org.apache.naming.NamingContext.lookup(NamingContext.java:140)
2010-01-26
05:11:30:Stack(2)=org.apache.naming.NamingContext.lookup(NamingContext.java:793)
2010-01-26
05:11:30:Stack(1)=javax.naming.spi.NamingManager.getObjectInstance(libgcj.so.81)
2010-01-26
05:11:30:Stack(0)=org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
2010-01-26 05:11:30:JsrSQL: Context cast successfull
line 504 is the middle line of:
503 get's executed (see above): sysout.display("JsrSQL: Context cast
successfull");
504 throws exception: javax.sql.DataSource ds =
(javax.sql.DataSource)envContext.lookup("jdbc/MySql");
505 never gets here: sysout.display("JsrSQL: DataSource
cast successfull");
----- Original Message -----
From: "Christopher Schultz" <ch...@christopherschultz.net>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, January 25, 2010 2:40 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to
javax.sql.DataSource
-----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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org