Hi Phil,
I have a
strange problem that once in a while the Oracle Driver is loaded from
the wrong classloader and EclipseLink cannot use it.
I am importing the oracle driver packages into my project and set the
EntityManagerFactory like this
properties.put(PersistenceUnitProperties.CLASSLOADER,
this.getClass().getClassLoader());
in a class that is in the same bundle as the oracle imports. This works
in 80% of the time. But sometimes (due to some race conditions I
assume) the classloader that was used by the oracle bundle to register
itself with the driver manager seems to be the wrong one.
Passing a ClassLoader that can see the driver you're referencing
should always work. Internally there is an attempt to use the
DriverManager which fails in OSGi but then we try to load the class
using the provided ClassLoader. Are you getting an exception or just
seeing a log message? In EclipseLink 1.1 the log level of the message
indicating the DriverManager usage failure has been dropped lower so
you shouldn't see it at FINE anymore.
I am
using org.eclipse.persistence.jpa.osgi.PersistenceProvider.
Anyway it would be better this whole old DriverManager thing would be
replaced by proper OSGi services. The Oracle driver would just register
itself as a driver in the OSGi system. Dreams :)
Dreams can come true! ;-) There is an OSGi specification coming for
obtaining JDBC Drivers which should make life easier for everyone--I'm
definitely looking forward to it.
Shaun
Thanks for any input on this issue,
Phil
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Shaun Smith | Principal Product Manager
Phone: ++19055023094 | |
Oracle Oracle Server Technologies, Oracle
TopLink
ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga,
Ontario | L5R 3P4
Oracle is committed to developing practices and products that
help protect the environment
|