JiveJdon3.0 配置檔案問題
各位好:
我是剛開始Jive 的學習,下面有一個問題我不理解其意圖是什麼,請各位不惜指教:
下面是jive_config.xml 的配置片段
<connectionProvider>
<className>com.jivesoftware.forum.database.DefaultConnectionProvider</className>
</connectionProvider>
<locale>
<country/>
<language>zh</language>
</locale>
<database>
<defaultProvider>
<driver>org.gjt.mm.mysql.Driver</driver>
<serverURL>jdbc:mysql://localhost:3306/Jive?useUnicode=true&characterEncoding=UTF-8</serverURL>
<username>my</username>
<password>my</password>
<minConnections>5</minConnections>
<maxConnections>50</maxConnections>
<connectionTimeout>0.5</connectionTimeout>
</defaultProvider>
</database>
<setup>true</setup>
</jive>
下面是呼叫的程式碼片段:
ConnectionManager.java
...
public static Connection getConnection() throws SQLException {
if (connectionProvider == null) {
synchronized (providerLock) {
if (connectionProvider == null) {
// Attempt to load the connection provider classname as
// a Jive property.
String className =
JiveGlobals.getJiveProperty("connectionProvider.className");
if (className != null) {
// Attempt to load the class.
try {
Class conClass = Class.forName(className);
setConnectionProvider((ConnectionProvider)conClass.newInstance());
}
catch(Exception e) {
e.printStackTrace();
System.err.println("Warning: failed to create the " +
"connection provider specified by connection" +
"Provider.className. Using the default pool.");
setConnectionProvider(new DefaultConnectionProvider());
}
}
else {
setConnectionProvider(new DefaultConnectionProvider());
}
}
}
}
Connection con = connectionProvider.getConnection();
if (con == null) {
System.err.println("WARNING: ConnectionManager.getConnection() " +
"failed to obtain a connection.");
}
// See if profiling is enabled. If yes, wrap the connection with a
// profiled connection.
//if (profilingEnabled) {
//return new ProfiledConnection(con);
//}
//else {
return con;
//}
}
從我在後臺輸出來看,知道是資料庫連線失敗!所以才會出現空指標的問題,資料庫連線是由ConnectionManager 這個類呼叫XMLProperties.java 中的getJiveProperty("connectionProvider.className");方法來得到一個Connection 的。
而這個<className>com.jivesoftware.forum.database.DefaultConnectionProvider</className>
的節點內容並沒有相關的連線設定,而是在別的地方設定的。
請問:
com.jivesoftware.forum.database.DefaultConnectionProvider
這句如何解釋?
謝謝!
我是剛開始Jive 的學習,下面有一個問題我不理解其意圖是什麼,請各位不惜指教:
下面是jive_config.xml 的配置片段
<connectionProvider>
<className>com.jivesoftware.forum.database.DefaultConnectionProvider</className>
</connectionProvider>
<locale>
<country/>
<language>zh</language>
</locale>
<database>
<defaultProvider>
<driver>org.gjt.mm.mysql.Driver</driver>
<serverURL>jdbc:mysql://localhost:3306/Jive?useUnicode=true&characterEncoding=UTF-8</serverURL>
<username>my</username>
<password>my</password>
<minConnections>5</minConnections>
<maxConnections>50</maxConnections>
<connectionTimeout>0.5</connectionTimeout>
</defaultProvider>
</database>
<setup>true</setup>
</jive>
下面是呼叫的程式碼片段:
ConnectionManager.java
...
public static Connection getConnection() throws SQLException {
if (connectionProvider == null) {
synchronized (providerLock) {
if (connectionProvider == null) {
// Attempt to load the connection provider classname as
// a Jive property.
String className =
JiveGlobals.getJiveProperty("connectionProvider.className");
if (className != null) {
// Attempt to load the class.
try {
Class conClass = Class.forName(className);
setConnectionProvider((ConnectionProvider)conClass.newInstance());
}
catch(Exception e) {
e.printStackTrace();
System.err.println("Warning: failed to create the " +
"connection provider specified by connection" +
"Provider.className. Using the default pool.");
setConnectionProvider(new DefaultConnectionProvider());
}
}
else {
setConnectionProvider(new DefaultConnectionProvider());
}
}
}
}
Connection con = connectionProvider.getConnection();
if (con == null) {
System.err.println("WARNING: ConnectionManager.getConnection() " +
"failed to obtain a connection.");
}
// See if profiling is enabled. If yes, wrap the connection with a
// profiled connection.
//if (profilingEnabled) {
//return new ProfiledConnection(con);
//}
//else {
return con;
//}
}
從我在後臺輸出來看,知道是資料庫連線失敗!所以才會出現空指標的問題,資料庫連線是由ConnectionManager 這個類呼叫XMLProperties.java 中的getJiveProperty("connectionProvider.className");方法來得到一個Connection 的。
而這個<className>com.jivesoftware.forum.database.DefaultConnectionProvider</className>
的節點內容並沒有相關的連線設定,而是在別的地方設定的。
請問:
com.jivesoftware.forum.database.DefaultConnectionProvider
這句如何解釋?
謝謝!
相關文章
- angular版本更新與配置檔案問題Angular
- 請教spring 配置檔案問題Spring
- 檔案存放問題
- 解決properties、xml等配置檔案無法找到問題XML
- 關於配置檔案中的預設值的問題
- jar檔案換成exe檔案問題?JAR
- 日誌檔案問題
- 【問題】 檔案搜尋
- 關於websphere讀取war配置檔案出錯的問題Web
- oracle控制檔案及引數檔案問題Oracle
- 使用主題檔案(包含CSS檔案)時遇到的問題CSS
- 又是hosts檔案的問題
- 常見問題--控制檔案
- Homestead 執行配置快取後模版檔案找不到問題。快取
- [20160301]firefox問題配置檔案缺失.txtFirefox
- jivejdon3.0在Tomcat5.5.26配置與執行。Tomcat
- 解決WAMP環境修改apache配置檔案不生效問題(Laravel public)ApacheLaravel
- 檔案監控效能問題【BUG】
- 檔案路徑問題( ./ 和 ../ 和 @/ )
- PHP檔案頭BOM頭問題PHP
- NDK問題 : Javah 生成.h檔案Java
- jboss建立新檔案的問題
- 有關*.properties檔案的問題
- 上傳檔案超時問題
- Git配置配置檔案Git
- 請問如何部署jboss中的配置檔案.
- PostgreSQL-訪問策略配置檔案pg_hba.conf檔案(八)SQL
- EBS中form埠及servlet , socket模式問題及form相關配置檔案ORMServlet模式
- 關於jdon論壇的jive_init.properties檔案路徑配置問題
- chrome hosts檔案管理工具 空白問題的解決--外掛無法載入hosts配置檔案Chrome
- PHP flock 檔案鎖的使用問題PHP
- hdfs檔案本地許可權問題
- 【cmd】IF ELSE 複製(copy)檔案問題
- MySQL遷移檔案的小問題MySql
- dfm檔案資料丟失問題
- linux檔案許可權問題Linux
- hibernate的hbm檔案生成問題
- myeclipse生成影射檔案的問題Eclipse