Hi, list.
I'm using Tapestry 5.0.15.
I wrote a bit of code:
String driver = "
org.postgresql.Driver";
String url = "jdbc:postgresql://localhost/sample";
String username = "hoge";
String password = "hogo";
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, driver);
Context context = new InitialContext(properties);
DataSource ds = (DataSource)context.lookup(url);
Connection con = ds.getConnection(username, password);
in my service class, and got an exception:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.postgresql.Driver [Root exception is
java.lang.ClassCastException:
org.postgresql.Driver]
How do I let it work to?
On struts & Tomcat, we can use META-INF/context.xml
and just write:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/sample");
How do I write on Tapestry? (or Jetty???)
Thanks.
Ken.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)