Tratamento de erros ao usar JPA

Gostaria como tratar exceções relacionadas a conexão com o banco de dados ao usar a JPA.

Coloquei um try/catch no createEntityManagerFactory() mas não consigo capturar nada. Pelas exceções geradas talvez o problema seja com o Firebird, mesmo porque o mesmo código captura exceção quando o banco de dados é MySQL. Preciso de uma solução portável, segue abaixo o código e o stack trace.

Obrigado,
Felipe

	public static void setPersistenceUnit(String persistenceUnit) 
	{
		SGPersistence.persistenceUnit = persistenceUnit;
		try
		{
			entityManagerFactory = Persistence.createEntityManagerFactory(persistenceUnit);
			entityManager = entityManagerFactory.createEntityManager();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "ops");
			System.exit(0);
		}
	}
14/05/2007 11:16:23 org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.2.1.GA
14/05/2007 11:16:23 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.2.1.GA
14/05/2007 11:16:23 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.2
14/05/2007 11:16:23 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
14/05/2007 11:16:23 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
14/05/2007 11:16:23 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
14/05/2007 11:16:25 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: br.com.spdata.hibernate.Scclient
14/05/2007 11:16:25 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity br.com.spdata.hibernate.Scclient on table SCCLIENT
14/05/2007 11:16:26 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: br.com.spdata.hibernate.Sctecnic
14/05/2007 11:16:26 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity br.com.spdata.hibernate.Sctecnic on table SCTECNIC
14/05/2007 11:16:26 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: br.com.spdata.hibernate.Scprocli
14/05/2007 11:16:26 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity br.com.spdata.hibernate.Scprocli on table SCPROCLI
14/05/2007 11:16:26 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: br.com.spdata.hibernate.Scprodut
14/05/2007 11:16:26 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity br.com.spdata.hibernate.Scprodut on table SCPRODUT
14/05/2007 11:16:27 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
14/05/2007 11:16:27 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
14/05/2007 11:16:27 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
14/05/2007 11:16:27 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.firebirdsql.jdbc.FBDriver at URL: jdbc:firebirdsql:192.168.1.7:/home/fkj/twe/databases/spdata.gdb
14/05/2007 11:16:27 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=SYSDBA, password=****, autocommit=true, release_mode=auto}
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
WARNING: Could not obtain connection metadata
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error for file %.0s"open"
null
Error while trying to open file
null
Reason: I/O error for file %.0s"open"
null
Error while trying to open file
null
	at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:122)
	at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:131)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
	at net.sf.swinggoodies.util.SGPersistence.setPersistenceUnit(SGPersistence.java:73)
	at br.com.spdata.portaltecnico.LoginForm.init(LoginForm.java:23)
	at br.com.spdata.portaltecnico.LoginForm.<init>(LoginForm.java:18)
	at br.com.spdata.portaltecnico.LoginForm$1.run(LoginForm.java:75)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
at org.firebirdsql.gds.GDSException: I/O error for file %.0s"open"
null
Error while trying to open file
null
	at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2124)
	at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2074)
	at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.internalAttachDatabase(AbstractJavaGDSImpl.java:414)
	at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscAttachDatabase(AbstractJavaGDSImpl.java:370)
	at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:89)
	at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:470)
	at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:69)
	at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:119)
	at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:131)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
	at net.sf.swinggoodies.util.SGPersistence.setPersistenceUnit(SGPersistence.java:73)
	at br.com.spdata.portaltecnico.LoginForm.init(LoginForm.java:23)
	at br.com.spdata.portaltecnico.LoginForm.<init>(LoginForm.java:18)
	at br.com.spdata.portaltecnico.LoginForm$1.run(LoginForm.java:75)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
14/05/2007 11:16:28 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.FirebirdDialect
14/05/2007 11:16:28 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
14/05/2007 11:16:28 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
14/05/2007 11:16:28 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
14/05/2007 11:16:28 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
14/05/2007 11:16:28 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
14/05/2007 11:16:29 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured