Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Moving from ToplinkLink Essentials (SessionCustomizer problem)
Moving from ToplinkLink Essentials (SessionCustomizer problem) [message #388482] Mon, 01 June 2009 10:54 Go to next message
Pavel Zelenka is currently offline Pavel ZelenkaFriend
Messages: 61
Registered: July 2009
Member
Hi,

I moved from Toplink Essentials to EclipseLink with Tomcat 6.0.18 and have
this problem:

I created two web applications both uses EclipseLink. Due to using
non-jta-datasources I created in both applications
JPAEclipseLinkSessionCustomizer class as shown here:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_ Tutorial

When I start one application everything works fine. As soon as I run the
other application which uses EclipseLink I got exception:

Exception EclipseLink-28014 (Eclipse Persistence Services -
1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.EntityManagerSetupExcepti on
Exception Description: Exception was thrown while processing property
(eclipselink.session.customizer) with value
(hlaseni.JPAEclipseLinkSessionCustomizer).
Internal Exception: java.lang.ClassCastException:
hlaseni.JPAEclipseLinkSessionCustomizer cannot be cast to
org.eclipse.persistence.config.SessionCustomizer

Can anyone help?

Thanks

PERSISTENCE.XML
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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_1_0.xsd">
<persistence-unit name="hlaseniPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
<non-jta-data-source>java:comp/env/jdbc/Hlaseni</non-jta-data-source >
<class>hlaseni.entity.Zmeny</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.session.customizer"
value="hlaseni.JPAEclipseLinkSessionCustomizer"/>
<property name="eclipselink.logging.level" value="INFO"/>
</properties>
</persistence-unit>
</persistence>

JPAEclipseLinkSessionCustomizer class:
package hlaseni;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.eclipse.persistence.config.SessionCustomizer;
import org.eclipse.persistence.sessions.JNDIConnector;
import org.eclipse.persistence.sessions.Session;

public class JPAEclipseLinkSessionCustomizer implements SessionCustomizer
{
public void customize(Session session) throws Exception {
JNDIConnector connector = null;
Context context = null;
try {
context = new InitialContext();
if (null != context) {
connector = (JNDIConnector) session.getLogin().getConnector(); // possible
CCE
connector.setLookupType(JNDIConnector.STRING_LOOKUP);
System.out.println("_JPAEclipseLinkSessionCustomizer: configured " +
connector.getName());
} else {
throw new Exception("_JPAEclipseLinkSessionCustomizer: Context is null");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Re: Moving from ToplinkLink Essentials (SessionCustomizer problem) [message #388484 is a reply to message #388482] Mon, 01 June 2009 13:35 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Can you confirm that you placed the eclipselink.jar in $TOMCAT_HOME$/lib
along with javax_persistence_1.0.0.jar. Can you also confirm that your
customizer (hlaseni.JPAEclipseLinkSessionCustomizer) is packaged
separately in each WAR file?

Doug
Re: Moving from ToplinkLink Essentials (SessionCustomizer problem) [message #388494 is a reply to message #388484] Tue, 02 June 2009 06:20 Go to previous messageGo to next message
Pavel Zelenka is currently offline Pavel ZelenkaFriend
Messages: 61
Registered: July 2009
Member
Hi,
javax.persistence_1.0.0.jar and persistence_1_0.xsd are in
$TOMCAT_HOME$/lib. Eclipselink.jar is in webapp/WEB-INF/lib. Each
application has its own customizer class.
Thanks for reply.
Re: Moving from ToplinkLink Essentials (SessionCustomizer problem) [message #389401 is a reply to message #388494] Wed, 03 June 2009 05:53 Go to previous message
Pavel Zelenka is currently offline Pavel ZelenkaFriend
Messages: 61
Registered: July 2009
Member
solution found here:
http://forums.oracle.com/forums/thread.jspa?threadID=907216& amp;tstart=0
Previous Topic:QueryValueHolder Strategy for Better Memory Management
Next Topic:ReadObjectQuery Problem
Goto Forum:
  


Current Time: Thu Apr 18 12:57:50 GMT 2024

Powered by FUDForum. Page generated in 0.01517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top