You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@juddi.apache.org by Ravi Rangaswamy <rr...@yahoo.com> on 2003/01/16 11:38:08 UTC
[juddi-Users] Help with running jUddi with Oracle
Hi,
I am trying to get jUddi run with Oracle. To do this, I followed these steps.
1. I added the segment in CATALINA_HOME/conf/server.xml inside the <context> element.
<!-- Orcale JDBC datasource for jUDDI -->
<Resource name="jdbc/juddidb" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/juddidb">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@localhost:1521:orcl</value>
</parameter>
<parameter>
<name>username</name>
<value>juddiUser</value>
</parameter>
<parameter>
<name>password</name>
<value>juddiUser</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
</ResourceParams>
<!-- End of Orcale JDBC datasource for jUDDI -->
2. I added this segment in CATALINA_HOME/web-apps/juddi/WEB_INF/web.xml inside the <web-app> element.
<!-- Orcale JDBC datasource for jUDDI -->
<resource-ref>
<description>Oracle Datasource</description>
<res-ref-name>jdbc/juddidb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When I start Tomcat and invoke a action on jUDDI, I get the exception
Cannot load JDBC driver class 'null'
java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:523)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
So, to further debug, I added the segment from Step 2 to CATALINA_HOME/web-apps/examples/WEB_INF/web.xml and created a jsp (shown at the end of the mail) to see if it was picking up the configuration parameters. When this jsp is executed, I get the following displayed with the parameters as specified in server.xml.
DriverClassName: oracle.jdbc.driver.OracleDriver Url: jdbc:oracle:thin:@localhost:1521:orcl Username: juddiUser Password: juddiUser MaxActive: 20 MaxWait: 5000 NumActive: 3 numIdle: 0
If I place the same jsp under CATALINA_HOME/web-apps/juddi/jsp/..... and run the jsp, I get nulls for each param
DriverClassName: null Url: null Username: null Password: null MaxActive: 8 MaxWait: -1 NumActive: 0 numIdle: 0
Can anyone tell me what I am doing wrong?
Thanks,
Ravi.
Test jsp
--------
<%@ page language="java" import="java.sql.*,javax.naming.InitialContext,javax.naming.Context,javax.sql.DataSource,org.apache.commons.dbcp.BasicDataSource" %>
<body bgcolor="white">
<font color="red">
<%
Connection conn = null;
try {
InitialContext initialContext = new InitialContext();
Context context = (Context)initialContext.lookup("java:comp/env");
DataSource ds = (DataSource)context.lookup("jdbc/juddidb");
out.print(" DriverClassName: " + ((BasicDataSource) ds).getDriverClassName());
out.print(" Url: " + ((BasicDataSource) ds).getUrl());
out.print(" Username: " + ((BasicDataSource) ds).getUsername());
out.print(" Password: " + ((BasicDataSource) ds).getPassword());
out.print(" MaxActive: " + ((BasicDataSource) ds).getMaxActive());
out.print(" MaxWait: " + ((BasicDataSource) ds).getMaxWait());
out.print(" NumActive: " + ((BasicDataSource) ds).getNumActive());
out.print(" numIdle: " + ((BasicDataSource) ds).getNumIdle());
} catch (Exception e) {
e.printStackTrace();
}
%>
---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now