This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I tried to inject a stateless session bean into the JSF managed bean using netbeans 6.1+glassfish v2. First I create an enterprise application with an ejb module and a web module,then create a Remote stateless session bean in the ejb module,and add a business method. Next I add JSF Framework to the web module and add a java class and using netbeans context menu to config it as the managed bean in the face-config.xml,then I open the managed bean class and select context menu :enterprise resource->call enterprise bean and select the session bean I created. After that these two lines add to the file
but when I use the managed bean , I found the testBean is null.
I have search the web and found some usage(DI) like this, Are there something wrong with what I'm doing?
ps:I know the Seam framework and the jndi lookup can fix it, but here I just want to know why can't I inject ejb into my managed bean?
The JSF bean manager isn't as comprehensive as something like Spring. It's intended to create POJOs via no-argument constructors, not via factory/finder techniques. That's your first problem.
I'm not sure, but the idea of injecting a stateless session bean sounds questionable, anyway. Normally, as I recall (they haven't let me use EJBs where I work), a stateless session EJB is acquired from a pool, used, and released fairly quickly, not locked down and held. So, while injecting a SSEJB into a Request-scope object is OK, it wouldn't be suitable for a Session or Application scope object.
Customer surveys are for companies who didn't pay proper attention to begin with.