[JNDI and Naming] - Unable to override JNDI name for session bean
by keigwin
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
16 years, 8 months
[EJB 3.0 Users] - Getting the ejbName inside an interceptor
by pete.muir@jboss.org
This is for JBoss EJB 3 integration code, so we can use JBoss interfaces, not just EJB standard interfaces.
Inside an interceptor instance, I need access to the ejbName of the EJB being intercepted (so I can use this as a unique key to look up other info on the EJB). Currently I am doing this ugly hack:
try {
| guidField = StatefulSessionContextImpl.class.getDeclaredField("containerGuid");
| guidField.setAccessible(true);
| } catch (Exception e) {
| throw new RuntimeException(e);
| }
|
| ...
|
| try {
| String guid = (String) guidField.get(sessionContext);
| Container container = Ejb3Registry.getContainer(guid);
| return container.getEjbName();
| } catch (Exception e) {
| throw new RuntimeException(e);
| }
Any suggestions on how to improve?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252158#4252158
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252158
16 years, 8 months
[JBoss Portal Users] - Re: Role based landing page/portal for user
by pathuri
Hi vivek_saini07,
I wish I had known this issue 4 months ago to ask for help :-) We are new to portal and are working our way thru.
We are on to building a large CRM based application using JBoss Portal and came across this issue only few days ago.
Thanks a lot for the lead. I think these details are valuable and we will see if we can make the necessary changes and make it to work.
Thanks again.
"vivek_saini07" wrote : Well... 4 months old thread!! what made u posting here after so long time??
|
| Had you asked me it four months back, I would have told u this in more detail as I had lots of time (and energy) at that time.
|
| In short, we did it by modifying customizationManagerService. There are number of threads in this forum explaining how to do this.
|
| In that class somewhere it is written that a portal named "Template" would always be copied to dashboard of logged in user.
|
| U can change that piece, some conditional tweak........... on certain condition copy this portal ....otherwise copy some other portal.
|
| We maintained a table in DB that had mapping between users and their portal.
|
| And after doing all this, there is a property in property file of "conf" folder (this is documented in reference guide) by setting that property user will always land to his dashboard after log-in instead of (public)portal.
|
| Hope this would help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252138#4252138
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252138
16 years, 8 months