Seam with EJB3 Remote in separate projects
rene.felder Jul 30, 2009 4:27 PMWe generated a Seam project using seam gen and added an EJB3 component and separated the .war project from the .ear project so that we have two separate projects. The EJB3 component comes up fine as we can see in the logfile, but we were not able to connection seam to the EJB 3 Remote Interface:
Logfile EJB3 Startup:
2009-07-30 15:20:52,174 INFO [org.jboss.ejb3.JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateful.StatefulContainer 2009-07-30 15:20:52,174 INFO [org.jboss.ejb3.JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=info-ear.ear,jar=info-service.jar,name=NachrichtenList,service=EJB3 with dependencies: 2009-07-30 15:20:52,174 INFO [org.jboss.ejb3.JmxKernelAbstraction] persistence.units:ear=info-ear.ear,jar=info-service.jar,unitName=info_seamgen 2009-07-30 15:20:52,206 INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: at.sozvers.itsv.seucc.info.service.impl.NachrichtenList ejbName: NachrichtenList
EJB 3 Code:
@Name("nachrichtenList") @Scope(ScopeType.SESSION) @Stateful public class NachrichtenList extends EntityQuery<Nachrichten> implements INachrichtenList { ... }
@Remote public interface INachrichtenList extends Serializable { public abstract Nachrichten getNachrichten(); }
Within the JNDI View the EJB 3 is listed correct:
+- info-ear (class: org.jnp.interfaces.NamingContext) | +- NachrichtenList (class: org.jnp.interfaces.NamingContext) | | +- remote (class: java.lang.Object) | | +- remoteStatefulProxyFactory (proxy: $Proxy372 implements interface org.jboss.ejb3.ProxyFactory)
So it 'seam's that the EJB3 came up correct! So now we connected Seam to the EJB 3 component, so we set up the components.xml file with following jndi-pattern:
<core:init debug="true" jndi-pattern="info-ear/#{ejbName}/remote"/>
Now in the logfile we can see that the components.xml file is read correct:
2009-07-30 14:52:56,487 INFO [org.jboss.seam.init.Initialization] reading /WEB-INF/components.xml
Now we wanted to use the component in our xhtml file:
<h:inputText id="inhalt" value="#{nachrichtenList.nachrichten.inhalt}" onblur="resetBGColor(this)" onfocus="setBGColor(this)" class="form_input_6spalten" maxlength="20" tabindex="1" title="Inhalt" />
But we get the result that the component resolved to null:
Caused by: javax.el.PropertyNotFoundException: /NachrichtenList.xhtml @35,25 value="#{nachrichtenList.nachrichten.inhalt}": Target Unreachable, identifier 'nachrichtenList' resolved to null at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
So now we read the documentation and all tutorials to find out what went wrong. We also tried to use the ejb-ref approach. So we definied the ejb-ref in the web.xml:
<ejb-ref> <ejb-ref-name>info-ear/NachrichtenList/remote</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <remote>at.sozvers.itsv.seucc.info.service.impl.INachrichtenList</remote> <home>at.sozvers.itsv.seucc.info.service.impl.INachrichtenList</home> </ejb-ref>
We also integrated the seam interceptor within the ejb-jar.xml:
<interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
Nothing changed! It 'seams's that Seam is not able to connect to a remote EJB 3 that is not located in the same ear file. Is this possible? Or are we doing something wrong?
Rene