[teiid-commits] teiid SVN: r3814 - in trunk/client/src/main: resources/org/teiid/jdbc and 1 other directory.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Mon Jan 23 14:06:21 EST 2012
Author: rareddy
Date: 2012-01-23 14:06:21 -0500 (Mon, 23 Jan 2012)
New Revision: 3814
Modified:
trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
Log:
TEIID-1900: Added checks to make sure the Module library is available for the Teiid driver to load the needed classes.
Modified: trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2012-01-23 18:52:20 UTC (rev 3813)
+++ trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2012-01-23 19:06:21 UTC (rev 3814)
@@ -71,10 +71,10 @@
try {
final Module module = Module.getCallerModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.teiid")); //$NON-NLS-1$
Thread.currentThread().setContextClassLoader(module.getClassLoader());
+ return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, PropertiesUtils.getBooleanProperty(info, USE_CALLING_THREAD, true)), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
} catch (ModuleLoadException e) {
- Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
- }
- return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, PropertiesUtils.getBooleanProperty(info, USE_CALLING_THREAD, true)), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
+ throw new TeiidRuntimeException(JDBCPlugin.Util.gs("teiid_module_load_failed")); //$NON-NLS-1$
+ }
} finally {
Thread.currentThread().setContextClassLoader(tccl);
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2012-01-23 18:52:20 UTC (rev 3813)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2012-01-23 19:06:21 UTC (rev 3814)
@@ -71,7 +71,7 @@
}
private ConnectionProfile socketProfile = new SocketProfile();
- private ConnectionProfile embeddedProfile = new EmbeddedProfile();
+ private ConnectionProfile embeddedProfile;
public static TeiidDriver getInstance() {
return INSTANCE;
@@ -102,6 +102,14 @@
try {
if (conn == ConnectionType.Embedded) {
+ if (embeddedProfile == null) {
+ try {
+ getClass().getClassLoader().loadClass("org.jboss.modules.Module"); //$NON-NLS-1$
+ } catch(ClassNotFoundException e) {
+ throw new TeiidSQLException(JDBCPlugin.Util.gs("module_load_failed")); //$NON-NLS-1$
+ }
+ embeddedProfile = new EmbeddedProfile();
+ }
myConnection = embeddedProfile.connect(url, info);
} else {
myConnection = socketProfile.connect(url, info);
Modified: trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
===================================================================
--- trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2012-01-23 18:52:20 UTC (rev 3813)
+++ trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2012-01-23 19:06:21 UTC (rev 3814)
@@ -157,4 +157,13 @@
client_prop_missing=Client URL connection property missing "{0}". Please add the property to connection URL.
system_prop_missing=System property "{0}" missing, please add using -D option on the VM startup script.
-JDBC.forward_only_resultset=Continuous queries must be forward only and return a result set.
\ No newline at end of file
+JDBC.forward_only_resultset=Continuous queries must be forward only and return a result set.
+module_load_failed=Teiid Embedded mode Driver failed to load. You must only create this type of connection in the same \
+VM as the Teiid Server. Use following driver fragment xml inside the JBoss AS configuration file\
+ <drivers>\
+ <driver name="teiid-local" module="org.jboss.teiid">\
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>\
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>\
+ </driver> \
+ </drivers>
+teiid_module_load_failed=Failed to load "org.jboss.teiid" module.
\ No newline at end of file
More information about the teiid-commits
mailing list