[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Disabling EclipseLink Connection Pooling
|
I figured out what's causing the problem. I have two persistence.xml files on the classpath and it seems to be picking different ones up randomly. For some reason it always picked the right one in EclipseLink 1.2, one was in a JAR file and the other was in the WEB-INF/classes folder and it used to pick the one in the WEB-INF/classes folder every time. Now the behaviour has changed and the precedence that WEB-INF/classes used to have seems to be gone.
I understand that ideally you wan't only one persistence.xml in your classpath, but when using third-party libraries, this is a bit unavoidable.
Thanks,
On Fri, Dec 10, 2010 at 7:22 AM,
<patric@xxxxxxxxxxx> wrote:
I am having a similar problem with eclipselink 2.1.1.
I also want to disable the eclipselink connection pool because I want to provide the correct Connection by Properties during EntityManager creation. (exclusive isolated session mode)
My session customizer is always called (it's defined in the persistence.xml), but unfortunately, this doesn't help, because the connection pool configuration is set before the session customizer fires (see EntityManagerSetupImpl.java:859 which will lead to ServerSession.java:187).
All this end up that acquireClientConnection() (ServerSession.java:252) will enter the "connection pool mode"-branch.
When I replace EclipseLink 2.1.1 jar with EclipseLink 1.1.2 jar and do not change anything else, the other branch inside acquireClientConnection() (disabled connection pool) is used.
So something changed from EclipseLink 1.1.x to 2.x - maybe by accident?
Best regards,
Patric
Zitat von Zarar Siddiqi <zarars@xxxxxxxxx>:
Looked into this more, and as Andrei suggested, the customizer is randomly
being called (or not called). It's quite weird. Is there another way to
specify a session customizer? Looked through the docs and couldn't find
much.
On Wed, Dec 8, 2010 at 10:55 AM, Andrei Ilitchev <andrei.ilitchev@xxxxxxxxxx
wrote:
I you sure that your customizer is called?
On 12/8/2010 10:07 AM, Zarar Siddiqi wrote:
Thanks for the reply, but that didn't do it.
I downloaded the source and debugged it to the point where I see the
following call on line 104 in DatabaseLogin.java:
this.useDefaultDriverConnect();
That's the which is calling this method:
public void useDefaultDriverConnect() {
setConnector(new DefaultConnector());
}
which is causing the DefaultConnector to be set.
I tried searching for a dontUseDefaultDriverConnect() method but can't
find it.
Still stuck. Will look into it more but if something jumps out, do let
me know.
Thanks,
On Tue, Dec 7, 2010 at 10:06 PM, Michael O'Brien
<michael.obrien@xxxxxxxxxx <mailto:michael.obrien@xxxxxxxxxx>> wrote:
Zarar,
May help - try setting the new connector on both the read and
write connection pool, as it looks like the failure is due to
DefaultConnector deferring to using RESOURCE_LOCAL jdbc properties
for a direct connection.
JNDIConnector readConnector =
(JNDIConnector)((DatabaseLogin)((ServerSession)session).getReadConnectionPool().getLogin()).getConnector();
or
(JNDIConnector)((DatabaseLogin)((ServerSession)session).getReadConnectionPool().getLogin()).setConnector(new
JNDIConnector(dataSource));
thank you
/Michael
On 2010-12-07 17:33, Zarar Siddiqi wrote:
Using 2.1.1. Trying to completely disable connection pooling by
EclipseLink as it's handled externally, but I randomly get the
following exception where it tries to get a connection on its own
but fails.
Exception Description: Unable to acquire a connection from driver
[null], user [null] and URL [null]. Verify that you have set the
expected driver class and URL. Check your login, persistence.xml
or sessions.xml resource. The jdbc.driver property should be set
to a class that is compatible with your database platform
at
org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:376)
at
org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:91)
In my session customizer I have:
session.getLogin().setConnector(new
JNDIConnector(dataSource)); // I get dataSource from Spring
session.getLogin().useExternalConnectionPooling();
My persistence.xml looks like:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="db">
<properties>
<property name="eclipselink.target-database"
value="ca.utoronto.sis.sws.db.ExtendedDB2MainframePlatform"/>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.logger" value="SLF4JSessionLog"/>
<property name="eclipselink.session.customizer"
value="EclipseLinkSessionCustomizer"/>
</properties>
</persistence-unit>
</persistence>
Any idea why it's trying to go and do this on its own when I tell
it not to?
Thanks,
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Zarar Siddiqi
416-737-9024
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Zarar Siddiqi
416-737-9024
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Zarar Siddiqi
416-737-9024