[jboss-dev-forums] [JBoss AS Development Deployment Framework] - Jdbc Driver could not be instanced in Jboss5.1

Ricky_Ru do-not-reply at jboss.com
Wed Nov 11 00:41:31 EST 2009


Hi friends,

Putting nzjdbc.jar(netezza database jdbc driver) in server/default/lib, I use this call to create the driver
Class.forName("org.netezza.Driver").newInstance(). But I got a NoClassDefFoundError. Actually, I got the reason. the Driver has a static block which contains the following code and was executed when I was trying to load it.

String str2 = Driver.class.getResource("Driver.class").getPath();
int i = str2.lastindexOf("!");
str2 = str2.substring(0,i);

In jboss5.1, the first line of code will return /d:/nzjdbc.jar/org/netezza/Driver.class which does NOT contain "!" so, i will be -1, and the StringIndexOutOfBoundsException will be thrown at third line.
I got a workaround for it that setting the nzjdbc.jar to system classpath or specifying nzjdbc.jar to  wrapper.java.classpath.

But in jboss4.2.0, the first line code will return file:/d/nzjdbc.jar!/org/netezza/Driver.class which contains the "!", so, everything was ok.

My question is there any configuration in jboss to let server load the class with the JarClassLoader so that that code will return the path containing !

Thanks,

Ricky Ru

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264942#4264942

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264942



More information about the jboss-dev-forums mailing list