[jboss-user] [JNDI and Naming] - Unable to override JNDI name for session bean

keigwin do-not-reply at jboss.com
Thu Aug 27 18:38:59 EDT 2009


I'm using JBossAS 5.1.0 and have just upgraded the Eclipse projects for an existing application to support EJB3.  I then converted one of the session beans in the app to an EJB3-style declaration.  I've been able to successfully call this bean if I use JBoss' default JNDI name for the bean. 

Now I need to override the JNDI name and have had no luck doing this.  The mappedName attribute in the @Stateless annotation seems to have no effect on the name the bean is bound to.  For example, with the bean declared this way:

@Stateless(mappedName="com.sellcore.service.GeographyService")
  | public class GeographyService implements GeographyServiceLocal
  | {

the JBoss management console shows it is still bound to the default name:

  +- UnitTestsEAR (class: org.jnp.interfaces.NamingContext)
  |   |   +- GeographyService (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- local-com.sellcore.facade.common.GeographyServiceLocal (class: Proxy for: com.sellcore.facade.common.GeographyServiceLocal)
  |   |   |   +- local (class: Proxy for: com.sellcore.facade.common.GeographyServiceLocal)

where UnitTestsEAR is the EAR containing the bean and its client WAR.

The appserver logs show that the new name is found by JBoss:

15:12:13,249 INFO  [JBossASKernel] Added bean(jboss.j2ee:ear=UnitTestsEAR.ear,jar=SellCoreService.jar,name=PrintApplication,service=EJB3) to KernelDeployment of: SellCoreService.jar
  | 15:12:13,249 INFO  [JBossASKernel] installing bean: jboss.j2ee:ear=UnitTestsEAR.ear,jar=SellCoreService.jar,name=GeographyService,service=EJB3
  | 15:12:13,249 INFO  [JBossASKernel]   with dependencies:
  | 15:12:13,249 INFO  [JBossASKernel]   and demands:
  | 15:12:13,249 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
  | 15:12:13,249 INFO  [JBossASKernel]   and supplies:
  | 15:12:13,249 INFO  [JBossASKernel] 	jndi:UnitTestsEAR/GeographyService/local-com.sellcore.facade.common.GeographyServiceLocal
  | 15:12:13,249 INFO  [JBossASKernel] 	jndi:UnitTestsEAR/GeographyService/local
  | 15:12:13,249 INFO  [JBossASKernel] 	jndi:com.sellcore.service.GeographyService
  | 15:12:13,249 INFO  [JBossASKernel] 	Class:com.sellcore.facade.common.GeographyServiceLocal

But the value I specified as the mappedName is not used at binding time, as shown later in the log:

15:12:13,937 INFO  [SessionSpecContainer] Starting jboss.j2ee:ear=UnitTestsEAR.ear,jar=SellCoreService.jar,name=GeographyService,service=EJB3
  | 15:12:13,937 INFO  [EJBContainer] STARTED EJB: com.sellcore.service.common.GeographyService ejbName: GeographyService
  | 15:12:13,952 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
  | 
  | 	UnitTestsEAR/GeographyService/local - EJB3.x Default Local Business Interface
  | 	UnitTestsEAR/GeographyService/local-com.sellcore.facade.common.GeographyServiceLocal - EJB3.x Local Business Interface

I know I'm probably doing something really ignorant, but I can't figure out what.  I'd really appreciate any assistance!

Thanks,

K-

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252161#4252161

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252161



More information about the jboss-user mailing list