views:

540

answers:

3

Hello

We are using

  • Seam 2.2.0
  • Java 1.6.14
  • Weblogic 10.3.1.0 (named 11g Doh!)

I have looked at

However I still do not understand how to inject an EJB3 bean into a JSF backing bean. It seems to me that I have to (correct me if I am wrong)

  1. Annotate with @Name my backing bean
  2. Annotate with @Name my EJB3 bean
  3. Use the @In annotation in the backing bean
  4. Put an empty seam.properties file in the WAR that contains the backing bean
  5. Put an empty seam.properties file in the JAR that contains the EJB
  6. Set up a Seam interceptor in ejb-jar.xml of the EJB

Don't I need to setup some JNDI URL somewhere? How exactly does Seam will find the EJB? The interceptor is enough?

Also this means that I have to add a seam dependency in my EJB archive (because of the @Name annotation). So the web layer (Seam) "spills" into my business logic (EJB). Is this the recommended approach?

Am I missing something here?

Answer: Apparently you can set the JNDI pattern in

  1. The EJB itself with the @JndiName annotation or
  2. The web.xml file or
  3. The components.xml file or
  4. The seam.properties file as Nathan suggested (This is what I did)
+3  A: 

Three things:

1) There is no backing bean separate from the EJB session bean anymore.

2) There is a JNDI url, the pattern is set in seam.properties (the example for JBoss in Java Persistence with Hibernate looks like

org.jboss.seam.core.init.jndiPattern=caveatEmptor/#{ejbName}/local

Seam extends the expression language evaluator with a version that knows about its new scopes and knows to where to look for the EJBs.

3) Seam isn't a web framework, it is more like an application stack that makes JSF, EJB3 and Hibernate all play better together, so it shouldn't hurt that you have Seam annotations in your EJBs.

Nathan Hughes
Thanks! Number 2 worked like a charm. I never remembered that the hibernate book contains a chapter of seam.
kazanaki
+1  A: 

My answer is a compilation about you want

See Enabling WebLogic 10.3.2 (11g) (both answers) And Enabling @Stateless @In-@Out-jection

And see here what Seam reference documentation says how you should deploy your Seam application when using Weblogic

Arthur Ronald F D Garcia
Thank you for your answer but bullet point 2 by Nathan solved my problem!
kazanaki
+1  A: 

Most of these answers are available in the Seam hotel booking example. Your configuration may be different because you are using WebLogic rather than JBoss.

Arbi
Welcome to stackoverflow @Arbi :-)
Shervin