Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » (no subject)
(no subject) [message #683410] Mon, 13 June 2011 17:05 Go to next message
AmFreak Missing name is currently offline AmFreak Missing nameFriend
Messages: 25
Registered: June 2011
Junior Member

how can i catch Eclipse Link exceptions?
For example if i start my application and the server insn't running i get:

[EL Severe]: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLNonTransientConnectionException: Fehler beim Herstellen der Verbindung zum Server localhost am Port 1527. Nachricht: Connection refused: connect.
Error Code: 40000
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(
at org.eclipse.persistence.sessions.DefaultConnector.connect(
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(
at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(
at org.eclipse.persistence.sessions.server.ConnectionPool.startUp(
at org.eclipse.persistence.sessions.server.ServerSession.connect(
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(
at de.fh.stockgrabber.model.StockGrabberEntityManagerFactory.createEntityManager(
at de.fh.stockgrabber.model.StockGrabberEditorModel.<init>(
at de.fh.stockgrabber.project.model.ProjectsModel.<init>(
at de.fh.stockgrabber.views.MainView.createPartControl(
at org.eclipse.ui.internal.ViewReference.createPartHelper
[many more]

The code crashes when i try to create the EntityManager:

try {
em = StockGrabberEntityManagerFactory.createEntityManager();
transaction = em.getTransaction();
} catch (Exception e) {

The Exception is catched (the app exists), but it doesn't stop the output as seen above. So how can i handle this; or can't i cause it's an "Internal Exception"?
Re: (no subject) [message #685889 is a reply to message #683410] Mon, 20 June 2011 14:17 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1382
Registered: July 2009
Senior Member

I'm not sure of the question, as it looks like you are handling the exception. In this case, EclipseLink is throwing an instance of org.eclipse.persistence.exceptions.DatabaseException which is caught in your try/catch block. It is being logged at the severe log level, so if you don't want it logged, you will need to turn logging off using the
<property name="eclipselink.logging.level" value="OFF"/> peristence property as described here:

Best Regards,
Previous Topic:Maven repository incomplete
Next Topic:eclipselink-orm.xml and Eclipse JPA views
Goto Forum:

Current Time: Sat Apr 17 15:56:06 GMT 2021

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

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

Back to the top