Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328184

Summary: driverTemplate's jarList attribute doesn't support multiple jars in the format of [plugin]/jar
Product: [Tools] Data Tools Reporter: Shenxue Zhou <shenxue.zhou>
Component: ConnectivityAssignee: Brian Fitzpatrick <bfitzpat>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.7   
Target Milestone: 1.8.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Partial fix to parse multiple jars none

Description Shenxue Zhou CLA 2010-10-19 17:41:47 EDT
Build Identifier:  M20100909-0800

When I specify multiple jar files in the jarList attribute of driverTemplate extension, if I use the format of [plugin]/jar, then only the first jar file's path gets resolved. Further, when you edit the driver definition, only one jar file is listed in the JAR List tab.

Here is my jarList attr:

jarList="[oracle.database.driver.jdk14]/ojdbc14.jar; [oracle.database.driver.jdk14]/xdb.jar; [oracle.database.driver.jdk14]/xmlparserv2.jar"

Reproducible: Always
Comment 1 Brian Fitzpatrick CLA 2010-10-19 17:46:57 EDT
I'll take a look at this one.
Comment 2 Shenxue Zhou CLA 2010-10-19 17:50:40 EDT
Created attachment 181231 [details]
Partial fix to parse multiple jars
Comment 3 Shenxue Zhou CLA 2010-10-19 17:56:14 EDT
Brain,

I just attached a patch which fixed the parsing of multiple jar files. But it's only a partial fix to the problem. In [workspace]\.metadata\.plugins\org.eclipse.datatools.connectivity\driverStorage.xml, prop_jarList only listed one jar file.

What I need is to be able to specify multiple jar files in the jarList and when creating connections, the passed class loader would contain the multiple jar file paths.

Do you have an estimate on how soon this can be fixed? I'm blocked by this...

Thanks!

Shenxue
Comment 4 Brian Fitzpatrick CLA 2010-10-20 14:02:45 EDT
The earliest it could be fixed would be in the 1.8.2 stream, which will release in February. I'll see if I can get something working in the next couple of days so you can test it with nightly builds at least.
Comment 5 Brian Fitzpatrick CLA 2010-10-21 12:41:35 EDT
That's weird. With your patch on linux, it works fine with my sample with three jars...

It goes from this in the plugin.xml:
            jarList="[org.eclipse.datatools.mysql.wrapper]/lib/mysql-connector-java-5.1.13-bin.jar;[org.eclipse.datatools.mysql.wrapper]/lib/sqljdbc.jar;[org.eclipse.datatools.mysql.wrapper]/lib/sqljdbc4.jar"

To this in the driverStorage.xml:
            prop_jarList="/NotBackedUp/bfitzpat/workspaces/newwsJune222010/org.eclipse.datatools.mysql.wrapper/lib/mysql-connector-java-5.1.13-bin.jar:/NotBackedUp/bfitzpat/workspaces/newwsJune222010/org.eclipse.datatools.mysql.wrapper/lib/sqljdbc.jar:/NotBackedUp/bfitzpat/workspaces/newwsJune222010/org.eclipse.datatools.mysql.wrapper/lib/sqljdbc4.jar"
            
Now I haven't tried loading the multiple jars yet. And I don't have anything to test against - no Oracle dbs and I don't have the multi-jar driver for Oracle. Is there an easy way for me to try and reproduce this?
Comment 6 Brian Fitzpatrick CLA 2010-10-21 12:42:05 EDT
Now keep in mind I'm trying on the trunk stream (1.9) which may have a few fixes since 1.7...
Comment 7 Shenxue Zhou CLA 2010-10-21 13:04:24 EDT
Brian,

The partial fix I made was based on the HEAD (TRUNK) branch. I just tried it again in a brand new space and I'm still only seeing one one jar file in the prop_jarList field of the driverStorage.xml.

Could you try bringing up "Edit Driver Definition" dlg? Do you see multiple jar files in the JAR List tab? I only see one.

I'm running on windows XP. I wonder whether the platform difference is contributing to this issue. Just glancing the DriverManager class, it uses path delimiters.

I don't have another way to reproduce it other than using oracle db. When we can get past the above issue and you're ready to add the multiple jars to the class loader, I'd be happy to test your patch. Does this work for you?

Thank you so much!

Shenxue
Comment 8 Brian Fitzpatrick CLA 2010-10-21 13:25:19 EDT
Yeah, I see multiple jars in the edit driver definition. 

And yes, DriverManager does use path delimiters, but if you look to the top, 

	public static final String PATH_DELIMITER = "" + File.pathSeparatorChar; //$NON-NLS-1$
	public static final char PATH_DELIMITER_CHAR = File.pathSeparatorChar;

So we should be ok from a platform-specific file path perspective. 

Where can I grab the Oracle drivers from and I'll see if I can reproduce what you're seeing here, minus the class loader parts...

And as far as the classloader goes, if you looke at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection, it has a method getJarListAsArray that should be parsing the entire list and adding it to the URL class loader down below in createClassLoader(ClassLoader parentCL)
Comment 9 Shenxue Zhou CLA 2010-10-21 14:14:55 EDT
Brian,

Yes I do see that path delimiter should not contribute to the problem.

My problem was actually caused by a driver migration class that I forgot about. Now that I fixed the problem in the migration class, I do see three jars in my jar list and the driverStorage.xml. Sorry for the confusion.

I'll test the driver class loader and let you know how it goes.

Thanks!

Shenxue
Comment 10 Shenxue Zhou CLA 2010-10-21 15:34:35 EDT
(In reply to comment #9)
> Brian,
> 
> Yes I do see that path delimiter should not contribute to the problem.
> 
> My problem was actually caused by a driver migration class that I forgot about.
> Now that I fixed the problem in the migration class, I do see three jars in my
> jar list and the driverStorage.xml. Sorry for the confusion.
> 
> I'll test the driver class loader and let you know how it goes.
> 
> Thanks!
> 
> Shenxue

Brian,

I just tested the driver class loader and verified that it contained three jar file paths and it worked as expected. So once you apply the patch I submitted, then you can consider this bug fixed.

Thanks,

Shenxue
Comment 11 Brian Fitzpatrick CLA 2010-10-21 15:51:08 EDT
Delivered to o.e.d.connectivity in HEAD as tag v201010220349

Delivering to 1.8.2 branch next...
Comment 12 Brian Fitzpatrick CLA 2010-10-21 15:56:23 EDT
Delivered to 1.8.2 branch - o.e.d.connectivity tag v201010220354

Thanks for the patch Shenxue!