Skip to main content

Problem with Glassfish Internal EJB Container

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
Joel.Carrera
Offline
Joined: 2014-02-27
Points: 0

Hello developers, i have a problem with my Maven project and glassfish
i am learning the environment J2EE and i can't solve the problem:
i try do a test to my EJB with junit but to execute my app this throws the following :

Iniciando EJB Container
Feb 28, 2014 12:47:45 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl createContainer
INFO: [EJBContainerProviderImpl] Using installation location /home/carrera/Glassfish/glassfish4/glassfish
Feb 28, 2014 12:47:45 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl createContainer
INFO: [EJBContainerProviderImpl] Using config file location: file:/tmp/domain2408801510103614270xml
Feb 28, 2014 12:47:45 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl createContainer
INFO: [EJBContainerProviderImpl] Using runtime class: class com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime
Found populator: org.glassfish.kernel.embedded.EmbeddedDomainXml
Feb 28, 2014 12:47:54 AM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 5.0.0.Final
Feb 28, 2014 12:47:54 AM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: realm.loaded.successfully
Feb 28, 2014 12:47:54 AM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: realm.loaded.successfully
Feb 28, 2014 12:47:54 AM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: realm.loaded.successfully
Feb 28, 2014 12:47:55 AM org.glassfish.ha.store.spi.BackingStoreFactoryRegistry register
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
Feb 28, 2014 12:47:55 AM com.sun.enterprise.v3.server.AppServerStartup postStartupJob
INFO: GlassFish Server Open Source Edition 4.0 (89) startup time : Embedded (7,653ms), startup services(1,713ms), total(9,366ms)
Feb 28, 2014 12:47:55 AM org.glassfish.security.services.impl.authorization.AuthorizationServiceImpl initialize
INFO: Authorization Service has successfully initialized.
Feb 28, 2014 12:47:56 AM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService has disabled JMXConnector system
Feb 28, 2014 12:47:56 AM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.0 2013-05-03 14:50:15...
Feb 28, 2014 12:47:59 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
JdbcRuntimeExtension, getAllSystemRAResourcesAndPools = [GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool]
Feb 28, 2014 12:47:59 AM com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
Feb 28, 2014 12:47:59 AM org.glassfish.ha.store.spi.BackingStoreFactoryRegistry register
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
Feb 28, 2014 12:47:59 AM com.sun.enterprise.v3.server.AppServerStartup postStartupJob
INFO: GlassFish Server Open Source Edition 4.0 (89) startup time : Embedded (13,783ms), startup services(38ms), total(13,821ms)
Feb 28, 2014 12:47:59 AM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService has disabled JMXConnector system
Feb 28, 2014 12:47:59 AM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.0 2013-05-03 14:50:15...
Feb 28, 2014 12:47:59 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl skipJar
INFO: ... skipping entry with a Manifest file with a special attribute: glassfish-embedded-static-shell.jar
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding EJB module to ScatteredArchive classes
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive .cp
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive junit-4.10.jar
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive .cp
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive hamcrest-core-1.1.jar
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive javaee-api-6.0.jar
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.DeploymentElement getOrCreateApplication
INFO: [DeploymentElement] adding library to ScatteredArchive test-classes
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.EJBContainerImpl deploy
INFO: [EJBContainerImpl] Deploying app: org.glassfish.embeddable.archive.ScatteredArchive@26b9de0b
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.EJBContainerImpl deploy
INFO: [EJBContainerImpl] GlassFish status: STARTED
Feb 28, 2014 12:48:00 AM org.glassfish.ejb.embedded.EJBContainerImpl deploy
INFO: [EJBContainerImpl] Deploying as a ScatteredArchive
Feb 28, 2014 12:48:01 AM org.glassfish.deployment.common.GenericAnnotationDetector scanArchive
WARNING: NCLS-DEPLOYMENT-00009
Feb 28, 2014 12:48:01 AM org.glassfish.api.ActionReport failure
SEVERE: Archive type of /tmp/classes.jar was not recognized
Feb 28, 2014 12:48:01 AM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
JdbcRuntimeExtension, getAllSystemRAResourcesAndPools = [GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool]
Feb 28, 2014 12:48:01 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
Feb 28, 2014 12:48:01 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
JdbcRuntimeExtension, getAllSystemRAResourcesAndPools = [GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool]
Feb 28, 2014 12:48:01 AM com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished

the ejb code is :

package beans;

import javax.ejb.Stateless;

@Stateless // con esta anotacion definimos a esta clase como un EJB
public class HolaMundoEJB {

public int suma(int a, int b){
return a+b;
}

}

and the class junit code is :

package test;

import static org.junit.Assert.*;

import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;

import org.junit.Before;
import org.junit.Test;

import beans.HolaMundoEJB;

public class HolaMundoEJBTest {
private static EJBContainer contenedor;
private static Context contexto;
private static HolaMundoEJB holamundoejb;

@Before
public void iniciarContenedor() throws Exception{
System.out.println("Iniciando EJB Container");
contenedor = EJBContainer.createEJBContainer();
contexto = contenedor.getContext();
holamundoejb = (HolaMundoEJB)contexto.lookup("java:global/classes/HolaMundoEJB!beans.HolaMundoEJB");
}

@Test
public void testAddNumbers() throws Exception {
int dato1 = 3 ;
int dato2 = 5 ;
int resultado = holamundoejb.suma(dato1, dato2);
assertEquals((dato1 + dato2),resultado);
System.out.println("Operacion Terminada : "+resultado);
}
}

i'm sorry if my english is bad , am learning english .
help me with this problem please ...