Erro de persistência de dados

3 respostas
mysqlhibernatejava
E

Estou fazendo um curso de e-comerce, porem na hora que vou testar, tento inserir um usuario ele apresenta o seguinte erro.estou usando as seguintes tecnologia, netbeans, JPA, Hibernate e Mysql.

Log do erro apresentado

Ago 22, 2016 8:49:55 AM com.sun.enterprise.security.SecurityLifecycle 

Informações: security.secmgroff

Ago 22, 2016 8:49:55 AM com.sun.enterprise.security.SecurityLifecycle onInitialization

Informações: sec.service.startup.enter

Ago 22, 2016 8:49:55 AM com.sun.enterprise.security.PolicyLoader loadPolicy

Informações: policy.loading

Ago 22, 2016 8:49:55 AM com.sun.enterprise.security.SecurityLifecycle onInitialization

Informações: sec.service.startup.exit

Ago 22, 2016 8:49:57 AM org.glassfish.api.ActionReport failure

Grave: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method

java.lang.RuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)

at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)

at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)

at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:108)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:107)

at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)

at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)

at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)

at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)

at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)

at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAs(Subject.java:356)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)

at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:138)

at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)

at session.UsuarioSessionTest.testSalvarUsuario(UsuarioSessionTest.java:134)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)

Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)

at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)

at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)

 56 more

Ago 22, 2016 8:49:57 AM org.glassfish.api.ActionReport failure

Grave: Exception while preparing the app

Ago 22, 2016 8:49:57 AM com.sun.enterprise.v3.server.ApplicationLifecycle deploy

Grave: Exception during lifecycle processing

java.lang.RuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)

at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)

at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)

at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:108)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:107)

at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)

at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)

at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)

at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)

at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)

at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAs(Subject.java:356)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)

at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:138)

at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)

at session.UsuarioSessionTest.testSalvarUsuario(UsuarioSessionTest.java:134)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)

Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)

at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)

at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)

 56 more
Ago 22, 2016 8:49:57 AM org.glassfish.deployment.admin.DeployCommand execute

Grave: Exception while preparing the app : Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : { ResourceInfo : (jndiName=java:app/promocaoJNDI__pm), (applicationName=classes) }

at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)

at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)

at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)

at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)

at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)

at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)

at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:108)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)

at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:107)

at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)

at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)

at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)

at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)

at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)

at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAs(Subject.java:356)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)

at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)

at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:138)

at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)

at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)

at session.UsuarioSessionTest.testSalvarUsuario(UsuarioSessionTest.java:134)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179)

at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)

Ago 22, 2016 8:50:03 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
Informações: [EJBContainerProviderImpl] Cleaning up on failure …
Ago 22, 2016 8:50:03 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
Informações: JMXStartupService and JMXConnectors have been shut down.
Ago 22, 2016 8:50:03 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
Informações: JMXStartupService and JMXConnectors have been shut down.
Ago 22, 2016 8:50:03 AM com.sun.enterprise.v3.server.AppServerStartup stop
Informações: Shutdown procedure finished

3 Respostas

T

Tive esse mesmo problema uma vez. No meu caso, não sei se sera o seu, o glassfish nao cria a informacao do datasource. Eu resolvi meu problema criando o datasource manualmente no glassfish. Mas tambem voce pode tentar fazer o seguinte, no lugar de apenas mandar executar o projeto no netbeans voce usa a opcao implantar. Que o netbeans vai criar as configuracoes de datasource no glassfish.

E

eu fiz isso mais não deu certo…muito estranho…mais acho q tem haver com pools de conexao. Vou ver se consigo resolver. Mais valeuuuu.

T

exato. voce tem que entrar no config do server e criar manualmente o pool e a conexao. quando tive esse problema usando a opcao de implantar o netbeans criou no automatico.

Criado 22 de agosto de 2016
Ultima resposta 23 de ago. de 2016
Respostas 3
Participantes 2