Persistência no Derby "Me Ajudem"

Olá,

Estou fazendo alguns exemplos de persistência e está me dando o seguinte erro:

Alguem poderia me ajudar??

Exception in thread “main” Local Exception Stack:
Exception [TOPLINK-4003] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
at oracle.toplink.essentials.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:101)
at oracle.toplink.essentials.sessions.DefaultConnector.loadDriver(DefaultConnector.java:183)
at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:9
at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
at teste.lib.TestaPersistencia.main(TestaPersistencia.java:25)

Por favor, nao replique o tópico…http://www.guj.com.br/posts/list/71334.java
Se alguem souber, vai te ajudar…

Creio que ele não esta achando o driver de conexao : Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
tem certeza que o driver do Derby esta no lib do seu projeto ??

[quote=vanderlanio]Creio que ele não esta achando o driver de conexao : Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
tem certeza que o driver do Derby esta no lib do seu projeto ??
[/quote]

Você tinha razão… porém agora está dando o seguinte erro:

java.lang.IllegalStateException:
Exception Description: Transaction is currently active
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.begin(EntityTransactionImpl.java:74)


public class TestaPersistencia {
public static void main (String args[]){
javax.persistence.EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory(“AlunoGUIPU”);
javax.persistence.EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
try {
EntityTransaction tx = em.getTransaction();
tx.begin();
Aluno aluno = new Aluno();
aluno.setId(3);
aluno.setMatricula(45645);
aluno.setNome(“Valdomiro”);
em.persist(aluno);
tx.commit();
} catch (Exception e) {
e.printStackTrace();
em.getTransaction().rollback();
} finally {
em.close();
emf.close();
}
}

}

Vá nas propriedades do projeto, em bibliotecas, Adicionar Jar/Pasta, e Adicione o jar que normalmente está em C:\Program Files\Sun\JavaDB\lib\derbyclient.jar.