1

I am using javaee6/ejb3.1 api with glassfish embedded server. my application structure is ui-controller module ejbs calls biz-controller ejbs. with the global jndi name format is java:global/myapp/mymodule/myejb.

But when I try to unit test both modules without packaging application on embedded server; get different application name for jndi which is related to temp folder ...

Please find the console log here..

The jndi names generated are like.. java:global/ejb-app1138741107347091524/controllers/ArticleService every time I run the test

java:global/ejb-appXXXXXXXXXXXXXXXXXX/controllers/ArticleService

XXXXXXXX in ejb-app name in jndi name gets changed...

    FINE: [Application] -C:-DOCUME~1-daunddig-LOCALS~1-Temp-ejb-app1138741107347091524- , uid: 84898074169442304
Jan 19, 2011 6:26:46 PM com.sun.enterprise.deployment.Application setUniqueId
FINE: Ejb  classes.jar:ArticleFacadeImpl id = 84898074169442304
Jan 19, 2011 6:26:46 PM com.sun.enterprise.deployment.Application setUniqueId
FINE: Ejb  controllers-0_0_1-SNAPSHOT.jar:ArticleService id = 84898074169442305
Jan 19, 2011 6:26:46 PM com.sun.ejb.containers.BaseContainer initializeHome
INFO: Portable JNDI names for EJB ArticleFacadeImpl : [java:global/ejb-app1138741107347091524/ui-boundaries/ArticleFacadeImpl!dd.ecb.jee6.fa
cades.ArticleFacade, java:global/ejb-app1138741107347091524/ui-boundaries/ArticleFacadeImpl]
Jan 19, 2011 6:26:46 PM com.sun.ejb.containers.BaseContainer initializeHome
INFO: Portable JNDI names for EJB ArticleService : [java:global/ejb-app1138741107347091524/controllers/ArticleService!dd.ecb.jee6.services.i
mpl.ArticleService, java:global/ejb-app1138741107347091524/controllers/ArticleService]
Community
  • 1
  • 1
  • The container is mandated to map the bean to java:global/[]// Where defaults to the bundle name (.ear file name) without the bundle extension. This can be overridden in application.xml. Also, is applicable only if the bean is packaged inside a .ear file. Here my application is not bundled in a jar and i am doing unit testing from maven and eclipse. the application name is the generated temporary folder name –  Jan 20 '11 at 06:58

1 Answers1

1

solved the issue by configuring applciation name at the time of creating ejb container in javase code...

 prop.put(javax.ejb.embeddable.EJBContainer.APP_NAME, "ecb-app");       
 facade = (ArticleFacade)EJBContainer.createEJBContainer(prop).getContext().lookup("java:global/ecb-app/ui-boundaries/ArticleFacadeImpl");