Thursday, July 26, 2012

EJB Lookup In a Backing Bean

I struggled with a fundamental issue today while working on the presentation layer of my application.  The application is deployed as two separate binaries (view WAR and services JAR), so the code in the backing bean must do EJB lookup through JNDI.  If you're using WebLogic, you can get the exact values to place into the @EJB attributes by first looking in the JNDI tree structure of WebLogic.  To do this:

1) Goto the WebLogic admin console
2) Domain --> Environment --> Servers --> your_server
3) In Configuration --> General tab, click "View JNDI Tree"

Once you're in here, find your EJB on the left that you are trying to inject into your backing bean.  Expand the tree out all the way (it will expand once for each level in the package name).  When you come to the last element (which should be the name of your interface), click on it.  You will see an item that looks like this:


Binding Name:ManagersAssist-Services-ManagersAssistSessionBean#com.aires.ma.services.ManagersAssistSession



To easily map this into your EJB, you use the following setup:


    @EJB(name = "ManagersAssistSession", mappedName = "ManagersAssist-Services-ManagersAssistSessionBean")
    private ManagersAssistSession maBean;


You can see that the "name" attribute corresponds to the name of your interface, which in this case is "ManagersAssistSession", or the last value in the binding name after "com.aires.ma.services".  The "mappedName" attribute corresponds to the full name of the first part of the binding name.  If you follow this convention, you should never have a problem looking up and injecting EJBs into your JSF backing/managed beans.

Saturday, April 23, 2011

Well I haven't really used this page for much. Just recently I put together a "Hackintosh" system, and have been familiarizing myself with Xcode. As an initial project, I'm planning to create an OS X application called "Grade Keeper." I actually wrote this same app in college about 9 years ago in Visual Basic as a project for my Human Interface Design class. I'm completely new to objective-C, so learning the syntax will take some time. Overall, I do like how well put together Apple's developer site is. They have plenty of examples and articles to get your going. It's the best knowledge base I've come across yet for any development platform.

Friday, February 12, 2010

Hello World

Because my intent is to post mainly about my programming experiences, I found it appropriate to start off with a "Hello, world" blog post. Cheesy, yes, but appropriate.