Re: Mac OS X Connector/J classpath problem (solved)
Posted by: Timothy DiLauro
Date: December 29, 2004 11:43PM

Timothy DiLauro wrote:
> Mark Matthews wrote:
>
> > Timothy,
> >
> > Looks like you have an older version (2.0.14?)
> > lying around somewhere in your classpath. The
> > stacktraces you post don't 'line up' with the
> > sources for 3.0.x, either in method name,
> > signature or line #'s, however they do look a lot
> > like Connector/J 2.0.14, or an older 3.0.x that
> > was made before MySQL 4.1 existed.

In this case, it was 3.0.6 (MySQL-ConnectorJ-3.0.6.jar). It was in /Library/Java/Extensions, which is the Mac OS X location for jar files to be loaded by the extension class loader.

>
> Mark,
>
> I already understand that I am somehow loading a
> backlevel Connector/J, which is causing my
> problem. I do not, however, know where it is
> coming from. There are some details in the
> original post about what I have done so far in
> trying to track down the problem.
>
> > Make sure you don't have any old versions of the
> > driver lying around in jre/lib/ext or pointed to
> > by your CLASSPATH variable.
>
> The CLASSPATH shell variable is not set and,
> because I am running Mac OS X, there is no
> jre/lib/ext directory. I have looked in other
> places, but to no avail. My original post shows
> what I have done so far.
>
> Any suggestions about where I might look on the
> Mac OS X platform?
>

The place to look on Mac OS X machines is /Library/Java/Extensions .
> > Also, you shouldn't be putting JDBC drivers in the
> > bootclasspath, just refer to them with the normal
> > '-cp' switch.
> >
> > -Mark
>
> Lastly, it is not my desire to put the JDBC driver
> anywhere in the bootclasspath. I put that
> information in my post to more clearly define the
> problem that I am having.
>
> There is an example in my original post that does
> use the '-cp' switch. It is the one that fails.

Using -cp did not work because it made the "correct" mysql classes available for loading by the system class loader, which has a lower priority in the class loader delegation model than the extension class loader. Therefore the extension class loader is given the opportunity to load the (incorrect) mysql classes before the system class loader can load the right ones.

Using the "-Xbootclasspath/p:..." or "-Xbootclasspath/a:..." options worked because they caused the correct classes to be loaded by bootstrap class loader, which has a higher priority in the class loader delegation model than the extension class loader (which would have loaded the backlevel classes).

All is well now.

~Tim

>
> Any suggestions would be most welcome.
>
> Thanks.
>
> ~Tim

Options: ReplyQuote


Subject
Written By
Posted
Re: Mac OS X Connector/J classpath problem (solved)
December 29, 2004 11:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.