on 2016 Sep 01 3:46 AM
Hi,
I created one Java application and deployed into my trial account. In web.xml. I add one resource reference for named data source "DefaultDB", after deployment, I bind this datasource DefaultDB to one MDC database(also trial instance) under the same account. In my code I used JNDI look-up to get the data source. I got error as below:
java.sql.SQLException: Cannot create JDBC driver of class '' for connect URL 'null‘
code is as below:
try{
InitialContext ctx = new InitialContext();
DataSource ds2 = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");
return ds2;
}catch(NamingException e){
return null;
}
From the exception, for non-cloud Java application, it can be solved by adding resource definition(driver class, URL, user and password" in server.xml. But my understanding is this part should be handled by HCP. From data source binding, HCP could manipulate the needed info to add the resource definition in server.xml.
Are there any additional setting should be done?
Thanks!
Patrick
Request clarification before answering.
Hi Patrick,
it looks like the data source binding doesn't setup correctly. The connection URL shouldn't be 'null'.
Please check Binding Databases and the samples for JPA/JDBC around the documentation also.
Regards
Xu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
9 | |
9 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.