DevMedia - asp.net, Java, Delphi, SQL e web Design, tudo em um só lugar!
Bem vindo a DevMedia!
LOGIN:     SENHA:
 
 
DevWare  
Novidade: DevMedia lança o DevWare - Saiba mais!

Fórum DevMedia


Autor
Mensagem
FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 25/7/2010 11:03:48 PM
 
Pessoal,
Ao tentar realizar os testes referente as aulas Loja Virtual Completa - Aula 17/18, é apresentado o seguinte erro conforme abaixo.Obs.: Segue fontes dos arquivos persistence.xml, sun-resources.xml e UserSessionTest.java Será que existe algum erro nos arquivos de configurações?


public class UserSessionTest {    private static EJBContainer container;
    public UserSessionTest() {    }
    @BeforeClass    public static void setUpClass() throws Exception {        container = javax.ejb.embeddable.EJBContainer.createEJBContainer();    }
    @AfterClass    public static void tearDownClass() throws Exception {        container.close();    }
    @Before    public void setUp() {    }
    @After    public void tearDown() {    }
    @Test    public void testSaveUser() throws Exception {        System.out.println("saveUser");        User us = new User();        us.setEmail("fabricio@gmail.com");        us.setName("Fabricio Porto");        us.setPassword("123");        us.setUsername("fporto");        Address addr = new Address();        addr.setAddress("Rua 01");        addr.setCountry(CountryType.BRASIL);        addr.setNumber(111);        addr.setNickname("Principal");        addr.setPostalcode("30290-999");        addr.setStateOfAddress("Minas Gerais");        us.AddAddress(addr);        UserSession instance = (UserSession) container.getContext().lookup("java:global/classes/UserSession");        User result = instance.saveUser(us);        assertTrue(result.getId().intValue() > 0);        assertTrue(result.getAddresses().get(0).getId().intValue() > 0);    }}----------------------------------------------------------------------------------------------------------------------------**persistence.xml**  <persistence-unit name="EcommercePU" transaction-type="JTA">    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>    <jta-data-source>jdbc/ecommerce_mysql</jta-data-source>    <properties>      <property name="eclipselink.ddl-generation" value="create-tables"/>    </properties>  </persistence-unit>
---------------------------------------------------------------------------------------------------------------------------**sun-resources.xml**<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="jdbc/ecommerce" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">    <description>Ecommerce</description>    <property name="serverName" value="localhost"/>    <property name="databaseName" value="devmedia"/>    <property name="URL" value="jdbc:mysql://localhost:3306/devmedia"/>    <property name="User" value="root"/>    <property name="Password" value="123123"/>    <property name="driverClass" value="com.mysql.jdbc.Driver"/>  </jdbc-connection-pool>  <jdbc-resource enabled="true" jndi-name="jdbc/ecommerce_mysql" object-type="user" pool-name="jdbc/ecommerce"/>
----------------------------------------------------------------------------------------------------------------------------------------- Standard Error -----------------25/07/2010 22:54:49 com.sun.enterprise.v3.server.AppServerStartup runINFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Embedded(5331ms) startup services(548ms) total(5879ms)25/07/2010 22:54:49 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread runINFO: JMXStartupService: JMXConnector system is disabled, skipping.25/07/2010 22:54:49 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegatesINFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate25/07/2010 22:54:50 AppServerStartup runINFO: [Thread[GlassFish Kernel Main Thread,5,main]] started25/07/2010 22:54:53 com.sun.enterprise.security.SecurityLifecycle <init>INFO: security.secmgroff25/07/2010 22:54:53 com.sun.enterprise.security.SecurityLifecycle onInitializationINFO: Security startup service called25/07/2010 22:54:53 com.sun.enterprise.security.PolicyLoader loadPolicyINFO: policy.loading25/07/2010 22:54:53 com.sun.enterprise.security.auth.realm.Realm doInstantiateINFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.25/07/2010 22:54:53 com.sun.enterprise.security.auth.realm.Realm doInstantiateINFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.25/07/2010 22:54:53 com.sun.enterprise.security.auth.realm.Realm doInstantiateINFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.25/07/2010 22:54:53 com.sun.enterprise.security.SecurityLifecycle onInitializationINFO: Security service(s) started successfully....25/07/2010 22:54:54 org.glassfish.api.ActionReport failureSEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare methodjava.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]        at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:111)        at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:130)        at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:96)        at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:121)        at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)        at br.com.session.UserSessionTest.setUpClass(UserSessionTest.java:32)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)        at javax.naming.InitialContext.lookup(InitialContext.java:392)        at javax.naming.InitialContext.lookup(InitialContext.java:392)        at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookup(ConnectorResourceAdminServiceImpl.java:203)        at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:429)        at org.glassfish.persistence.jpa.JPADeployer$ProviderContainerContractInfoImpl.lookupDataSource(JPADeployer.java:228)        at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)        ... 26 moreCaused by: javax.naming.NameNotFoundException: ecommerce_mysql not found        at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:172)        at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)        at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:101)        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)        ... 32 more25/07/2010 22:54:54 org.glassfish.api.ActionReport failureSEVERE: Exception while preparing the appjava.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]        at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:111)        at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:130)        at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:96)        at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:121)        at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)        at br.com.session.UserSessionTest.setUpClass(UserSessionTest.java:32)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)        at javax.naming.InitialContext.lookup(InitialContext.java:392)        at javax.naming.InitialContext.lookup(InitialContext.java:392)        at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookup(ConnectorResourceAdminServiceImpl.java:203)        at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:429)        at org.glassfish.persistence.jpa.JPADeployer$ProviderContainerContractInfoImpl.lookupDataSource(JPADeployer.java:228)        at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)        ... 26 moreCaused by: javax.naming.NameNotFoundException: ecommerce_mysql not found        at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:172)        at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)        at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:101)        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)        ... 32 more25/07/2010 22:54:54 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainerINFO: [EJBContainerProviderImpl] Cleaning up on failure ...25/07/2010 22:54:54 org.glassfish.admin.mbeanserver.JMXStartupService shutdownINFO: JMXStartupService and JMXConnectors have been shut down.25/07/2010 22:54:54 com.sun.enterprise.v3.server.AppServerStartup stopINFO: Shutdown procedure finished25/07/2010 22:54:54 AppServerStartup runINFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting25/07/2010 22:54:54 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainerSEVERE: ejb.embedded.exception_instantiatingjavax.ejb.EJBException: Failed to deploy EJB modules - see log for details        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)        at br.com.session.UserSessionTest.setUpClass(UserSessionTest.java:32)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)------------- ---------------- ---------------Testcase: br.com.session.UserSessionTest:        Caused an ERRORNo EJBContainer provider availableThe following providers:org.glassfish.ejb.embedded.EJBContainerProviderImplReturned null from createEJBContainer call.
javax.ejb.EJBException: No EJBContainer provider availableThe following providers:org.glassfish.ejb.embedded.EJBContainerProviderImplReturned null from createEJBContainer call.
        at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)        at br.com.session.UserSessionTest.setUpClass(UserSessionTest.java:32)

Testcase: br.com.session.UserSessionTest:        Caused an ERRORnulljava.lang.NullPointerException        at br.com.session.UserSessionTest.tearDownClass(UserSessionTest.java:37)


DYEGO SOUZA DO CARMO
 

 


País: Brasil
Estado: PR
Cidade: xxxxx
Mensagens: 1836
 Postado em: 26/7/2010 12:32:39 PM
 
Opa !

O que acontece é que não existe o contexto de JDBC chamado "jdbc/ecommerce_mysql" no glassfish...

é só criar , reiniciar e pronto...

o estranho é que o netbeans deveria ter criado isso para  voce...

tutorial de como criar, voce pode tanto optar pela criacao via website ou via linha de comando :


http://weblogs.java.net/blog/felipegaucho/archive/2010/03/04/glassfish-v3-resources-administration-cli-tool-asadmin


FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 26/7/2010 11:55:35 PM
 
Dyego,
O JDBC ja estava criado, mas eu recriei direto na console do Glassfish e mesmo assim o erro persiste, recriei minha unidade de persistencia e mesmo assim o erro persiste, coloquei o jar do MySql na pasta lib do Glassfish e nada. Criei o pool de conexão e o JDBC direto no netbeans e mesmo assim não funcionou. Teria mais alguma coisa a ser feita?

DYEGO SOUZA DO CARMO
 

 


País: Brasil
Estado: PR
Cidade: xxxxx
Mensagens: 1836
 Postado em: 28/7/2010 11:18:01 AM
 
Poste arqui o seu sun-resources.xml

Valeuz !


FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 28/7/2010 01:20:02 PM
 
Opa,     sun-resources.xml   <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd">
<resources>
  <!-- MySql Configuration -->
 <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="jdbc/ecommerce" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
    <description>Ecommerce</description>
    <property name="serverName" value="localhost"/>
    <property name="databaseName" value="devmedia"/>
    <property name="URL" value="jdbc:mysql://localhost:3306/devmedia"/>
    <property name="User" value="root"/>
    <property name="Password" value="123123"/>
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
  </jdbc-connection-pool>
  <jdbc-resource enabled="true" jndi-name="jdbc/ecommerce_mysql" object-type="user" pool-name="jdbc/ecommerce"/>
</resources>

DYEGO SOUZA DO CARMO
 

 


País: Brasil
Estado: PR
Cidade: xxxxx
Mensagens: 1836
 Postado em: 29/7/2010 04:48:59 PM
 
Esqueci , cole o seu domain.xml do diretorio do glassfish (do seu dominio)



FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 30/7/2010 09:52:58 AM
 

Dyego,

          Consegui resolver o erro alterando o domain.xml, testei o metodo e funcionou blz, so não entendi porque o netbeans não criou isso pra mim, existe alguma coisa que podemos fazer para que o netbeans crie pra mim?           Outra coisa, quando to inserindo um usuário o incremento do id não esta sequêncial Ex.: 1, 51, 151, 201...., como faço pra corrigir isso?      

DYEGO SOUZA DO CARMO
 

 


País: Brasil
Estado: PR
Cidade: xxxxx
Mensagens: 1836
 Postado em: 5/8/2010 01:33:34 PM
 
Muito estranho mesmo.. ele deveria ter gerado , isto é bug...

Quanto ao auto-incremento voce esta usando que bd ? o Derby ou trocou para MySQL (conforme os videos)

FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 5/8/2010 01:45:46 PM
 
opa,   Banco MySql (conforme videos)
Thales Ramalho de Souza
 


País: Brasil
Estado: SP
Cidade: São Paulo
Mensagens: 4
 Postado em: 28/8/2010 02:21:52 AM
 
Cara, já tentei de todo jeito e não consigo configurar o meu ambiente, qualquer aplicação que eu crie acontece o esse mesmo problema, tem como vc me dizer os passos pra eu seguir e conseguir configurar meu netbeans/glassfish, pelo visto o problema persiste na versão 6.9.1. Como deve ficar o meu domains.xml?? Eu devo criar o pool pelo glassfish?? No glassfish aparece a minha conexão, mas não vi referencia a ela no domains. Se tiver como ajudar, eu agradeço. Vlw


Thales Ramalho
Analista de TI
SCJP 6.0

FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 30/8/2010 02:01:11 PM
 
Opa...   Modifique o domain.xml do diretorio do glassfish, dentro do arquivo já tem uma conexão padrão, siga a mesma ideia que vai funcionar.
Erickson
 


País: Brasil
Estado: SP
Cidade: Guarulhos
Mensagens: 1
 Postado em: 7/9/2010 11:43:18 AM
 
Eu ainda não consegui consertar o erro... Alguma ajuda?
FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 10/9/2010 10:00:29 PM
 
  Pessoal segue um trecho do domain.xml do diretorio do glassfish, o pool que criei foi EcommercePU.


   
   

   
     
     
   
   
     
     
     
     
     
     
   

     
     
     
     
     
     
   
 
 
   
     
     
 
   
 

FABRICIO PORTO
 


País: Brasil
Estado: MG
Cidade: Belo Horizonte
Mensagens: 54
 Postado em: 10/9/2010 10:02:38 PM
 

Segue novamente
/* <resources>    <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin" />    <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default" /> <jdbc-resource pool-name="EcommercePU" jndi-name="jdbc/ecommerce" />    <jdbc-connection-pool name="__TimerPool" datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource">      <property value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer" name="databaseName" />      <property value=";create=true" name="connectionAttributes" />    </jdbc-connection-pool>    <jdbc-connection-pool is-isolation-level-guaranteed="false" name="DerbyPool" datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource">      <property value="1527" name="PortNumber" />      <property value="APP" name="Password" />      <property value="APP" name="User" />      <property value="localhost" name="serverName" />      <property value="sun-appserv-samples" name="DatabaseName" />      <property value=";create=true" name="connectionAttributes" />    </jdbc-connection-pool> <jdbc-connection-pool  datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" res-type="javax.sql.DataSource" wrap-jdbc-objects="false" name="EcommercePU">      <property name="PortNumber" value="3306" />      <property name="serverName" value="localhost" />      <property name="databaseName" value="devmedia" />      <property name="URL" value="jdbc:mysql://localhost:3306/devmedia" />      <property name="Password" value="123123" />      <property name="User" value="root" />    </jdbc-connection-pool>  </resources>  <servers>    <server name="server" config-ref="server-config">       <resource-ref ref="jdbc/__TimerPool" />      <resource-ref ref="jdbc/__default" />  <resource-ref ref="jdbc/ecommerce" />    </server>  </servers>*/

PAULO HENRIQUE TADEU ALVES DE OLIVEIRA.
 


País: Brasil
Estado: MT
Cidade: cuiaba
Mensagens: 5
 Postado em: 30/10/2010 12:30:26 AM
 
Ola pessoal estou começando agora no java e estou encontrando dificuldades para analisar erros

minhas aplicação estando erro parecei na aula 17 por da erro ao executar o teste


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.live.Session;

import br.com.live.Tabelas.Endereco;
import br.com.live.Tabelas.Usuario;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author PROGRAMADOR
 */
public class SessionUsuarioTest {

    public SessionUsuarioTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of execute method, of class SessionUsuario.
     */

    @Test
    public void testSavarUsuario() throws Exception {
        System.out.println("SavarUsuario");
        Usuario us = new Usuario();
        us.setEmail("paulo@liveteenslinux.com");
        us.setNome("Paulo Henrique Tadeu");
        us.setLogin("xoops");
        us.setSenha("master");
        Endereco end = new Endereco();
        end.setDescricao("Casa");
        end.setEndereco("Rua vitoria Regia nº27");
        end.setNumero("27");
        end.setBairro("Jd. Das Palmeiras");
        end.setCidade("Cuiaba");
        end.setCep("78080-180");
        end.setComplemento("Fundos");
        end.setUF("MT");
        us.AddEndereco(end);

        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        Usuario result = instance.SavarUsuario(us);
        assertTrue(result.getId().intValue() > 0);
        assertTrue(result.getEnderecoDoUsuario().get(0).getId().intValue() > 0);
 
    }
 
    public void testExecute() throws Exception {
        System.out.println("execute");
        String query = "";
        Object[] values = null;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        int expResult = 0;
        int result = instance.execute(query, values);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of getUsuarioById method, of class SessionUsuario.
     */
  
    public void testGetUsuarioById() throws Exception {
        System.out.println("getUsuarioById");
        int IdUsuario = 0;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        Usuario expResult = null;
        Usuario result = instance.getUsuarioById(IdUsuario);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of getAllUsuarios method, of class SessionUsuario.
     */
   
    public void testGetAllUsuarios() throws Exception {
        System.out.println("getAllUsuarios");
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        List expResult = null;
        List result = instance.getAllUsuarios();
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of getUsuarioByNome method, of class SessionUsuario.
     */
   
    public void testGetUsuarioByNome() throws Exception {
        System.out.println("getUsuarioByNome");
        String name = "";
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        List expResult = null;
        List result = instance.getUsuarioByNome(name);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of isUsuarioOK method, of class SessionUsuario.
     */
   
    public void testIsUsuarioOK() throws Exception {
        System.out.println("isUsuarioOK");
        String Login = "";
        String Senha = "";
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        boolean expResult = false;
        boolean result = instance.isUsuarioOK(Login, Senha);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of SavarUsuario method, of class SessionUsuario.
     */
   

    /**
     * Test of setUsuario method, of class SessionUsuario.
     */
  
    public void testSetUsuario() throws Exception {
        System.out.println("setUsuario");
        Usuario us = null;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        Usuario expResult = null;
        Usuario result = instance.setUsuario(us);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

   
    /**
     * Test of getEnderecosDoUsuario method, of class SessionUsuario.
     */
  
    public void testGetEnderecosDoUsuario() throws Exception {
        System.out.println("getEnderecosDoUsuario");
        Usuario us = null;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        List expResult = null;
        List result = instance.getEnderecosDoUsuario(us);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of getEndereco method, of class SessionUsuario.
     */
    //@Test
    public void testGetEndereco() throws Exception {
        System.out.println("getEndereco");
        int idEndereco = 0;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        Endereco expResult = null;
        Endereco result = instance.getEndereco(idEndereco);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of removerUsuario method, of class SessionUsuario.
     */
  
    public void testRemoverUsuario_Usuario() throws Exception {
        System.out.println("removerUsuario");
        Usuario us = null;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        instance.removerUsuario(us);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of removerUsuario method, of class SessionUsuario.
     */
   
    public void testRemoverUsuario_int() throws Exception {
        System.out.println("removerUsuario");
        int idUsuario = 0;
        SessionUsuario instance = (SessionUsuario)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/SessionUsuario");
        boolean expResult = false;
        boolean result = instance.removerUsuario(idUsuario);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }


}



-----------------=======================================================
#########################################################
Erro


init:
deps-module-jar:
deps-ear-jar:
deps-jar:
Copying 1 file to D:\netbeans\live\build\web\WEB-INF\classes\META-INF
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
Compiling 1 source file to D:\netbeans\live\build\test\classes
compile-test-single:
WARNING: multiple versions of ant detected in path for junit
         jar:file:/C:/Arquivos%20de%20programas/NetBeans%206.9.1/java/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
     and jar:file:/C:/glassfishv3/glassfish/modules/ant.jar!/org/apache/tools/ant/Project.class
Testsuite: br.com.live.Session.SessionUsuarioTest
SavarUsuario
29/10/2010 23:25:44 com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Embedded(2000ms) startup services(390ms) total(2390ms)
29/10/2010 23:25:44 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
29/10/2010 23:25:44 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
29/10/2010 23:25:44 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
29/10/2010 23:25:46 com.sun.enterprise.deployment.archivist.Archivist readAnnotations
AVISO: Error in annotation processing: java.lang.NoClassDefFoundError: build/web/WEB-INF/classes/br/com/live/Session/SessionVenda (wrong name: br/com/live/Session/SessionVenda)
29/10/2010 23:25:46 org.glassfish.api.ActionReport failure
GRAVE: Exception while deploying the app
java.lang.IllegalArgumentException: Invalid ejb jar [live.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
        at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:72)
        at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
        at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
        at com.sun.enterprise.deployment.Application.visit(Application.java:1744)
        at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
        at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
        at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:152)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at br.com.live.Session.SessionUsuarioTest.testSavarUsuario(SessionUsuarioTest.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
29/10/2010 23:25:46 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
29/10/2010 23:25:46 org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
29/10/2010 23:25:46 com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
29/10/2010 23:25:46 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
29/10/2010 23:25:46 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
GRAVE: ejb.embedded.exception_instantiating
javax.ejb.EJBException: Failed to deploy EJB modules - see log for details
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at br.com.live.Session.SessionUsuarioTest.testSavarUsuario(SessionUsuarioTest.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 5,188 sec

------------- Standard Output ---------------
SavarUsuario
------------- ---------------- ---------------
------------- Standard Error -----------------
29/10/2010 23:25:44 com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Embedded(2000ms) startup services(390ms) total(2390ms)
29/10/2010 23:25:44 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
29/10/2010 23:25:44 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
29/10/2010 23:25:44 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
29/10/2010 23:25:46 com.sun.enterprise.deployment.archivist.Archivist readAnnotations
AVISO: Error in annotation processing: java.lang.NoClassDefFoundError: build/web/WEB-INF/classes/br/com/live/Session/SessionVenda (wrong name: br/com/live/Session/SessionVenda)
29/10/2010 23:25:46 org.glassfish.api.ActionReport failure
GRAVE: Exception while deploying the app
java.lang.IllegalArgumentException: Invalid ejb jar [live.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
        at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:72)
        at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
        at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
        at com.sun.enterprise.deployment.Application.visit(Application.java:1744)
        at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
        at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
        at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:152)
        at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)
        at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at br.com.live.Session.SessionUsuarioTest.testSavarUsuario(SessionUsuarioTest.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
29/10/2010 23:25:46 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
29/10/2010 23:25:46 org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
29/10/2010 23:25:46 com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
29/10/2010 23:25:46 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
29/10/2010 23:25:46 org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
GRAVE: ejb.embedded.exception_instantiating
javax.ejb.EJBException: Failed to deploy EJB modules - see log for details
        at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
        at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at br.com.live.Session.SessionUsuarioTest.testSavarUsuario(SessionUsuarioTest.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
------------- ---------------- ---------------
Testcase: testSavarUsuario(br.com.live.Session.SessionUsuarioTest):        Caused an ERROR
No EJBContainer provider available
The following providers:
org.glassfish.ejb.embedded.EJBContainerProviderImpl
Returned null from createEJBContainer call.

javax.ejb.EJBException: No EJBContainer provider available
The following providers:
org.glassfish.ejb.embedded.EJBContainerProviderImpl
Returned null from createEJBContainer call.

        at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at br.com.live.Session.SessionUsuarioTest.testSavarUsuario(SessionUsuarioTest.java:66)


Test br.com.live.Session.SessionUsuarioTest FAILED
D:\netbeans\live\nbproject\build-impl.xml:910: Some tests failed; see details above.
FALHA NA CONSTRUÇÃO (tempo total: 8 segundos)


CASSIO CUNHA NORONHA
 


País: Brasil
Estado: SP
Cidade: São Paulo
Mensagens: 4
 Postado em: 2/11/2010 02:25:36 AM
 
Tb to estagnado nesse ponto dos testes.

O Jndi existe no glassfish, tanto que qdo mando executar a aplicação, as tabelas são criadas e não ocorre erro algum.
Mas qdo digo para testar, ele não reconhece esse jndi.

Existe alguma solução?

Obrigado.

CASSIO CUNHA NORONHA
 


País: Brasil
Estado: SP
Cidade: São Paulo
Mensagens: 4
 Postado em: 2/11/2010 03:09:57 AM
 
Bem, depois que eu consegui alterar o domain.xml de dentro do diretorio domain/domain1/config, eu inseri as linhas abaixo nele e funcionou direitinho.
No meu caso estou utilizando o postgres.

Pra alterar esse arquivo no win7 eu tive que copiar ele pra fora da pasta, alterar ele, e depois colar por cima do original que estava na pasta.

DENTRO DA TAG <resources>:
#Código
<jdbc-resource pool-name="postgres_ecom_pool" jndi-name="jdbc/ecommerce_postgres" />

<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGSimpleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="postgres_ecom_pool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
        <property name="serverName" value="localhost"/>
        <property name="portNumber" value="5432"/>
        <property name="databaseName" value="db_videoaula"/>
        <property name="User" value="postgres"/>
        <property name="Password" value="postgres"/>
        <property name="URL" value="jdbc:postgresql://localhost:5432/db_videoaula"/>
        <property name="driverClass" value="org.postgresql.Driver"/>
    </jdbc-connection-pool>


DENTRO DA TAG <servers><server name="server" config-ref="server-config"> :
#Código
<resource-ref ref="jdbc/ecommerce_postgres" />



E tb joguei o jar do jdbc do Postgres pra dentro da pasta lib do servidor Glassfish.

Funcionando ok agora.

Abraços.

FRANCISCO WILLIAM SARAIVA JUCÁ QUEIROZ FILHO
 


País: Brasil
Estado: MA
Cidade: Açailândia
Mensagens: 3
 Postado em: 2/1/2011 10:38:04 PM
 

Olá,

Meu arquivo domain do glass fish esta ok, esta criado tbm uma conexao jdbc/ecommerce_mysql no glass fish e mesmo assim nao consigo testar o userSession, acho que a versão 6.9.1 nao consegui pq esta tudo certo.    Segue  trechos do erro:   NFO: Security service(s) started successfully....
02/01/2011 21:31:31 org.glassfish.api.ActionReport failure
SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)   Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]   Segue meu domain.xml do glass fish:   <jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" res-type="javax.sql.DataSource" wrap-jdbc-objects="false" name="mysqlecompool">
      <property name="serverName" value="localhost" />
   <property name="URL" value="jdbc:mysql://localhost:3307/db_ecommerce" />
      <property name="driverClass" value="com.mysql.jdbc.Driver" />
      <property name="databaseName" value="db_ecommerce" />
      <property name="User" value="root" />
   <property name="Password" value="210344" />
     
    </jdbc-connection-pool>
    <jdbc-resource pool-name="mysqlecompool" jndi-name="jdbc/ecommerce_mysql" />
  </resources>
  <servers>
    <server name="server" config-ref="server-config">
      <application-ref ref="Ecommerce" virtual-servers="server" />
      <resource-ref ref="jdbc/__TimerPool" />
      <resource-ref ref="jdbc/__default" />
      <resource-ref ref="jdbc/sample" />
      <resource-ref ref="jdbc/ecommerce_mysql" />
   <resource-ref ref="jdbc/ecommerce" />
    </server>
  </servers>
  <configs>   Por favor ajuda!!! Quero continuar a aplicação.   Att     William Filho

FRANCISCO WILLIAM SARAIVA JUCÁ QUEIROZ FILHO
 


País: Brasil
Estado: MA
Cidade: Açailândia
Mensagens: 3
 Postado em: 2/1/2011 10:40:26 PM
 

Olá,

Meu arquivo domain do glass fish esta ok, esta criado tbm uma conexao jdbc/ecommerce_mysql no glass fish e mesmo assim nao consigo testar o userSession, acho que a versão 6.9.1 nao consegui pq esta tudo certo.    Segue  trechos do erro:   NFO: Security service(s) started successfully....
02/01/2011 21:31:31 org.glassfish.api.ActionReport failure
SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)   Caused by: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]   Segue meu domain.xml do glass fish:   <jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" res-type="javax.sql.DataSource" wrap-jdbc-objects="false" name="mysqlecompool">
      <property name="serverName" value="localhost" />
   <property name="URL" value="jdbc:mysql://localhost:3306/db_ecommerce" />
      <property name="driverClass" value="com.mysql.jdbc.Driver" />
      <property name="databaseName" value="db_ecommerce" />
      <property name="User" value="root" />
   <property name="Password" value="210344" />
     
    </jdbc-connection-pool>
    <jdbc-resource pool-name="mysqlecompool" jndi-name="jdbc/ecommerce_mysql" />
  </resources>
  <servers>
    <server name="server" config-ref="server-config">
      <application-ref ref="Ecommerce" virtual-servers="server" />
      <resource-ref ref="jdbc/__TimerPool" />
      <resource-ref ref="jdbc/__default" />
      <resource-ref ref="jdbc/sample" />
      <resource-ref ref="jdbc/ecommerce_mysql" />
   <resource-ref ref="jdbc/ecommerce" />
    </server>
  </servers>
  <configs>   Por favor ajuda!!! Quero continuar a aplicação.   Att     William Filho

WAGNER.
 


País: Brasil
Estado: MT
Cidade: Cuiabá
Mensagens: 12
 Postado em: 6/1/2011 09:06:39 PM
 
Tambem esta acontecendo o mesmo erro comigo .... 
segue o meu domain.xml :<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="10.0">  <system-applications />  <applications />  <resources>    <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin" />    <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default" />    <jdbc-connection-pool name="__TimerPool" datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource">      <property value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer" name="databaseName" />      <property value=";create=true" name="connectionAttributes" />    </jdbc-connection-pool>    <jdbc-connection-pool is-isolation-level-guaranteed="false" name="DerbyPool" datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource">      <property value="1527" name="PortNumber" />      <property value="APP" name="Password" />      <property value="APP" name="User" />      <property value="localhost" name="serverName" />      <property value="sun-appserv-samples" name="DatabaseName" />      <property value=";create=true" name="connectionAttributes" />    </jdbc-connection-pool> <jdbc-connection-pool is-isolation-level-guaranteed="false" name="mysql_devmidia_rootPool" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" res-type="javax.sql.DataSource">      <property value="3306" name="portNumber" />      <property value="adminadmin" name="Password" />      <property value="root" name="User" />      <property value="localhost" name="serverName" />      <property value="devmidia" name="DatabaseName" />  <property name="URL" value="jdbc:mysql://localhost:3306/devmidia"/>  <property name="driverClass" value="com.mysql.jdbc.Driver"/>      <property value=";create=true" name="connectionAttributes" />    </jdbc-connection-pool>  </resources>  <servers>    <server name="server" config-ref="server-config">       <resource-ref ref="jdbc/__TimerPool" />      <resource-ref ref="jdbc/__default" />  <resource-ref ref="jdbc/MysqlEcomm" />    </server>  </servers> <configs>   <config name="server-config">      <http-service>        <access-log/>        <virtual-server id="server" network-listeners="http-listener-1,http-listener-2"/>        <virtual-server id="__asadmin" network-listeners="admin-listener"/>      </http-service>      <iiop-service>        <orb use-thread-pool-ids="thread-pool-1" />        <iiop-listener address="0.0.0.0" port="3700" id="orb-listener-1" lazy-init="true"/>        <iiop-listener security-enabled="true" address="0.0.0.0" port="3820" id="SSL">          <ssl cert-nickname="s1as" />        </iiop-listener>        <iiop-listener security-enabled="true" address="0.0.0.0" port="3920" id="SSL_MUTUALAUTH">          <ssl cert-nickname="s1as" client-auth-enabled="true" />        </iiop-listener>      </iiop-service>      <admin-service auth-realm-name="admin-realm" type="das-and-server" system-jmx-connector-name="system">        <jmx-connector auth-realm-name="admin-realm" security-enabled="false" address="0.0.0.0" port="8686" name="system" />        <das-config autodeploy-enabled="true" dynamic-reload-enabled="true" deploy-xml-validation="full" autodeploy-dir="${com.sun.aas.instanceRoot}/autodeploy" />        <property value="/admin" name="adminConsoleContextRoot" />        <property value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war" name="adminConsoleDownloadLocation" />        <property value="${com.sun.aas.installRoot}/.." name="ipsRoot" />      </admin-service>      <connector-service shutdown-timeout-in-seconds="30">      </connector-service>      <web-container>        <session-config>          <session-manager>            <manager-properties />            <store-properties />          </session-manager>          <session-properties />        </session-config>      </web-container>      <ejb-container steady-pool-size="0" max-pool-size="32" session-store="${com.sun.aas.instanceRoot}/session-store" pool-resize-quantity="8">        <ejb-timer-service />      </ejb-container>      <mdb-container steady-pool-size="0" max-pool-size="32" pool-resize-quantity="8" >      </mdb-container>      <jms-service type="EMBEDDED" default-jms-host="default_JMS_host">        <jms-host name="default_JMS_host" host="localhost" port="7676" admin-user-name="admin" admin-password="admin" lazy-init="true"/>      </jms-service>      <security-service>        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">          <property value="${com.sun.aas.instanceRoot}/config/admin-keyfile" name="file" />          <property value="fileRealm" name="jaas-context" />        </auth-realm>        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">          <property value="${com.sun.aas.instanceRoot}/config/keyfile" name="file" />          <property value="fileRealm" name="jaas-context" />        </auth-realm>        <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />        <jacc-provider policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl" policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default">          <property value="${com.sun.aas.instanceRoot}/generated/policy" name="repository" />        </jacc-provider>        <jacc-provider policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory" policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" />        <audit-module classname="com.sun.enterprise.security.Audit" name="default">          <property value="false" name="auditOn" />        </audit-module>        <message-security-config auth-layer="SOAP">          <provider-config provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule" provider-type="client">            <request-policy auth-source="content" />            <response-policy auth-source="content" />            <property value="s1as" name="encryption.key.alias" />            <property value="s1as" name="signature.key.alias" />            <property value="false" name="dynamic.username.password" />            <property value="false" name="debug" />          </provider-config>          <provider-config provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule" provider-type="client">            <request-policy auth-source="content" />            <response-policy auth-source="content" />            <property value="s1as" name="encryption.key.alias" />            <property value="s1as" name="signature.key.alias" />            <property value="false" name="dynamic.username.password" />            <property value="false" name="debug" />            <property value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" name="security.config" />          </provider-config>          <provider-config provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule" provider-type="server">            <request-policy auth-source="content" />            <response-policy auth-source="content" />            <property value="s1as" name="encryption.key.alias" />            <property value="s1as" name="signature.key.alias" />            <property value="false" name="debug" />          </provider-config>          <provider-config provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule" provider-type="server">            <request-policy auth-source="content" />            <response-policy auth-source="content" />            <property value="s1as" name="encryption.key.alias" />            <property value="s1as" name="signature.key.alias" />            <property value="false" name="debug" />            <property value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" name="security.config" />          </provider-config>        </message-security-config>      </security-service>      <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" >      </transaction-service>      <monitoring-service>        <module-monitoring-levels />      </monitoring-service>      <java-config classpath-suffix="" system-classpath="" debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009">        <jvm-options>-XX:MaxPermSize=192m</jvm-options>        <jvm-options>-client</jvm-options>        <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>        <jvm-options>-XX:+LogVMOutput</jvm-options>        <jvm-options>-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log</jvm-options>        <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>        <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>        <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>        <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>        <jvm-options>-Xmx512m</jvm-options>        <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>        <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>        <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>        <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options> <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>        <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>        <!-- Configuration of various third-party OSGi bundles like             Felix Remote Shell, FileInstall, etc. -->        <!-- Port on which remote shell listens for connections.-->        <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options>        <!-- How many concurrent users can connect to this remote shell -->        <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>        <!-- From which hosts users can connect -->        <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>        <!-- Directory being watched by fileinstall. -->        <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>        <!-- Time period fileinstaller thread in ms. -->        <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>        <!-- debug level -->        <jvm-options>-Dfelix.fileinstall.debug=1</jvm-options>        <!-- should new bundles be started or installed only?              true => start, false => only install         -->        <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>        <!-- End of OSGi bundle configurations -->        <jvm-options>-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false</jvm-options>        <jvm-options>-XX:NewRatio=2</jvm-options>      </java-config>      <network-config>        <protocols>          <protocol name="http-listener-1">            <http default-virtual-server="server" max-connections="250" server-name="">              <file-cache enabled="false"></file-cache>            </http>          </protocol>          <protocol security-enabled="true" name="http-listener-2">            <http default-virtual-server="server" max-connections="250" server-name="">              <file-cache enabled="false"></file-cache>            </http>            <ssl ssl3-enabled="false" cert-nickname="s1as"></ssl>          </protocol>          <protocol name="admin-listener">            <http default-virtual-server="__asadmin" max-connections="250" server-name="">              <file-cache enabled="false"></file-cache>            </http>          </protocol>        </protocols>        <network-listeners>          <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>          <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>          <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>        </network-listeners>        <transports>          <transport name="tcp"></transport>        </transports>      </network-config>      <thread-pools>          <thread-pool name="http-thread-pool" max-queue-size="4096"></thread-pool>          <thread-pool name="thread-pool-1" max-thread-pool-size="200"/>      </thread-pools>    </config>   </configs>  <property name="administrative.domain.name" value="domain1"/></domain>



MEU ARQUIVO sun-resources.xml :
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"><resources>    <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="derby_net_ecommerce_ecomPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">        <property name="serverName" value="localhost"/>        <property name="databaseName" value="ecommerce"/>        <property name="User" value="ecom"/>        <property name="Password" value="ecom"/>        <property name="URL" value="jdbc:derby://localhost/ecommerce"/>        <property name="driverClass" value="org.apache.derby.jdbc.ClientDriver"/>    </jdbc-connection-pool>    <jdbc-resource enabled="true" jndi-name="jdbc/ecommerce" object-type="user" pool-name="derby_net_ecommerce_ecomPool"/>    <!-- MySQL Configuration -->    <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_devmidia_rootPool"      non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">        <property name="serverName" value="localhost"/>        <property name="portNumber" value="3306"/>        <property name="databaseName" value="devmidia"/>        <property name="User" value="root"/>        <property name="Password" value="adminadmin"/>        <property name="URL" value="jdbc:mysql://localhost:3306/devmidia"/>        <property name="driverClass" value="com.mysql.jdbc.Driver"/>    </jdbc-connection-pool>    <jdbc-resource enabled="true" jndi-name="jdbc/MysqlEcomm" object-type="user" pool-name="mysql_devmidia_rootPool"/></resources>erro no teste


minha classe de teste :
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package br.com.devmedia.session;
import br.com.devmedia.entity.Address;import br.com.devmedia.entity.User;import br.com.devmedia.entity.types.CountryType;import java.io.Serializable;import java.util.List;import javax.persistence.EntityManager;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;import org.junit.BeforeClass;import org.junit.Test;import static org.junit.Assert.*;
/** * * @author wagner */public class UserSessionTest {
    public UserSessionTest() {    }
    @BeforeClass    public static void setUpClass() throws Exception {    }
    @AfterClass    public static void tearDownClass() throws Exception {    }
    @Before    public void setUp() {    }
    @After    public void tearDown() {    }
    /**     * Test of saveUser method, of class UserSession.     */    @Test    public void testSaveUser() throws Exception {        System.out.println("saveUser");        User us = new User();        us.setEmail("wagnerfaria1601@gmail.com");        us.setName("Wagner Faria");        us.setPassword("123");        us.setUsername("wagner");        Address addr = new Address();        addr.setAddress("Trav prof Leonor Borralho");        addr.setCountry(CountryType.BRASIL);        addr.setNumber(123456);        addr.setNickname("Principal");        addr.setPostalCode("78005-650");        addr.setState("MT");        us.addAddress(addr);

        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        User result = instance.saveUser(us);        assertTrue(result.getId().intValue() > 0);        assertTrue(result.getAddresses().get(0).getId().intValue() > 0);    }
    /**     * Test of getUserById method, of class UserSession.     *///    @Test    public void testGetUserById() throws Exception {        System.out.println("getUserById");        int idUser = 0;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        User expResult = null;        User result = instance.getUserById(idUser);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of setUser method, of class UserSession.     *///    @Test    public void testSetUser() throws Exception {        System.out.println("setUser");        User us = null;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        User expResult = null;        User result = instance.setUser(us);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of getAllUsers method, of class UserSession.     *///    @Test    public void testGetAllUsers() throws Exception {        System.out.println("getAllUsers");        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        List expResult = null;        List result = instance.getAllUsers();        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of getUserBuName method, of class UserSession.     *///    @Test    public void testGetUserBuName() throws Exception {        System.out.println("getUserBuName");        String name = "";        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        List expResult = null;        List result = instance.getUserBuName(name);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of isUserOk method, of class UserSession.     *///    @Test    public void testIsUserOk() throws Exception {        System.out.println("isUserOk");        String username = "";        String password = "";        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        boolean expResult = false;        boolean result = instance.isUserOk(username, password);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of getAddressOfUser method, of class UserSession.     *///    @Test    public void testGetAddressOfUser() throws Exception {        System.out.println("getAddressOfUser");        User us = null;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        List expResult = null;        List result = instance.getAddressOfUser(us);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of getAddress method, of class UserSession.     *///    @Test    public void testGetAddress() throws Exception {        System.out.println("getAddress");        int idAddress = 0;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        Address expResult = null;        Address result = instance.getAddress(idAddress);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of removeUser method, of class UserSession.     *///    @Test    public void testRemoveUser_User() throws Exception {        System.out.println("removeUser");        User us = null;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        instance.removeUser(us);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }
    /**     * Test of removeUser method, of class UserSession.     *///    @Test    public void testRemoveUser_int() throws Exception {        System.out.println("removeUser");        int idUser = 0;        UserSession instance = (UserSession) javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/UserSession");        boolean expResult = false;        boolean result = instance.removeUser(idUser);        assertEquals(expResult, result);        // TODO review the generated test code and remove the default call to fail.        fail("The test case is a prototype.");    }}

FRANCISCO WILLIAM SARAIVA JUCÁ QUEIROZ FILHO
 


País: Brasil
Estado: MA
Cidade: Açailândia
Mensagens: 3
 Postado em: 17/1/2011 01:04:09 PM
 
Bom dia!   Dyego, tem como o Sr. disponibilizar o projeto ?   Não estou conseguindo ir adiante o erro persiste   SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/ecommerce_mysql' in SerialContext  [Root exception is javax.naming.NameNotFoundException: ecommerce_mysql not found]   Dai o Sr. disponibilizando o projeto refaço aqui tudinho igual ao seu, criu novamente o banco tudo desde o inicio.   Desde já agradeço.   Att   William Filho

web-03
DevMedia  |  Anuncie  |  Fale conosco
Hospedagem web por Porta 80 Web Hosting
2013 - Todos os Direitos Reservados a web-03