-
1. Re: Resolve JNDI names in WAS+Seam
jbalunas.jbalunas.jboss.org Aug 18, 2008 5:22 PM (in response to igorla)There were many little WAS related issues with EJB3 support. The reference guide points them out. Take a look at the reference documentation on integration with WAS here - Seam on IBM's Websphere
The issue you are seeing was a major point of contention with the integration. If you search WAS forums you can find several references to related issues. I do not remember the specific details atm, but there is a WAS trick to get it to recognize EJB3's, and referencing them.
-Jay
-
2. Re: Resolve JNDI names in WAS+Seam
igorla Aug 19, 2008 9:05 AM (in response to igorla)Ok, it seems that I found that the lack of "com.ibm.ws.runtime" in Context.URL_PKG_PREFIXES is cause to problem with ejblocal.
Since WAS is writing EJB components in JNDI with full package names (like org.jboss.seam.transaction.LocalEjbSynchronizations), I need to redefine <core:init > tag. #{ejbName} is not suited here, I need to specify something like #{ejbClass}, where I can find list of variables similar to #{ejbName}?
Thank you,
Igor -
3. Re: Resolve JNDI names in WAS+Seam
jbalunas.jbalunas.jboss.org Aug 19, 2008 3:58 PM (in response to igorla)Yup - that is certainly one of the issues with the ejblocal:/. WAS uses the full package/class name for JNDI with ejblocal. I was not able to get around this. WAS has some option that should change that behavior, but they did not function.
The only way I was able use ejb3 beens was using the steps in the reference guide. There is no #{ejbclass} element to call to get the full package/class value.
-Jay
-
4. Re: Resolve JNDI names in WAS+Seam
igorla Aug 19, 2008 4:03 PM (in response to igorla)Ok, thanks Jay.
It seems that no way besides to define all session beans in web.xml -
5. Re: Resolve JNDI names in WAS+Seam
jeckhart Mar 27, 2009 11:08 PM (in response to igorla)I realize that this thread is a bit old, but I wanted to revisit the JNDI naming confusions related Websphere.
I had followed the seam recommendations and annotated each of my EJB's with the @JndiName(com.my.package.MyBeanInterface) annotation. However, due to another (arguably silly) behavior in Websphere, you cannot access two EJB's in separate projects on the same server by their
shortname
(ie ejbLocal:com.my.package.MyBeanInterface), but you can access them via their separatelongname
such as ejbLocal:myProjectEAR/myProjectEJB/com.my.package.MyBeanInterface (WAS registers up to 4 JNDI names for each EJB, two local and two remote).Thus, using the @JndiName workaround, it would be possible to specify the
longname
and then update each longname when to match the project in Websphere: i.e. @JndiName(myProjectEAR/myProjectEJB/com.my.package.MyBeanInterface
) for my first project, then change it to @JndiName(mySecondProjectEAR/myProjectEJB/com.my.package.MyBeanInterface
) for the next. This becomes a rather tedious, repetitive effort for larger projects and is arguably counter to the simple mechanisms that Seam aims to provide.
note: Websphere provides mechanisms to override the default naming (http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/cejb_bindingsejbfp.html), but that still requires a per EJB configuration and is therefore no better or worse an option than @JndiName)Hopefully EJB 3.1 will standardize jndi behaviors for EJB's, but until then, I would like to propose an alternative that seeks to meet in the middle. By extending the #{ejbName} replacement with additional replacements for the fully qualified interface we can construct more flexible jndi-names for ejb's. I've played with some private changes to Seam (2.1.0 GA) and found the following very workable solution:
Augment <core:init jndi-pattern="...pattern..." /> from components.xml to replace:
#{ejbClass} - returns the fully qualified classname (i.e. com.my.package.MyBean) #{ejbIntLocal} - returns the fully qualified classname of the local business interface (i.e. com.my.package.MyBeanInterface) #{ejbIntRemote} - returns the fully qualified classname of the remote business interface (i.e. com.my.package.MyBeanInterfaceRemote)
Using this, I was able to set my default jndi-pattern in components.xml
<core:init debug="true" jndi-pattern="ejblocal:myProjectEAR/myProject.jar/#{ejbName}##{ejbIntLocal}" />
and when I wanted to deploy another project using the same EJB's to the server I just had to update one line, to:
<core:init debug="true" jndi-pattern="ejblocal:mySecondProjectEAR/myProject.jar/#{ejbName}##{ejbIntLocal}" />
If anybody else would find this useful, I can open a ticket in JIRA and submit the patch (presently against Seam 2.1.0GA).