[JBoss Seam] - Re: Error in trying to injecting the bean
by cormet
Hi tony,
THanks for the reply. I changed the code by adding outjecting annotation and still using EVENT scope:
AccountAction.java:
| @Scope(EVENT)
| @Name("accountAction")
| public class AccountAction implements Serializable{
| private static final long serialVersionUID = 5884510664142728026L;
|
| @Logger
| private Log log;
|
| @In("#{accountDao}")
| AccountDao accountDao;
|
| @In("#{me}")
| User me;
|
| @Out(value="accountTreeList", required=false)
| private AccountTreeDisplay parentAccountDisplay;
|
| @DataModel(value="accountList")
| private List<AccountTreeDisplay> accountList;
|
| @In(create=true) @Out
| private GeneralJournal generalJournal;
|
| public void recordJournal() throws Exception {
| if(journalId == null || journalId.equals("")) {
| // recording new journal
| } else {
| // reload existing journal
| }
| }
|
| public String createGeneralJournal() throws Exception {
| log.debug("createGeneralJournal :: # :: " + generalJournal.getNumber());
| return null;
| }
| }
|
and i got these error which saying that generalJournal is null and looks like @In(create=true) is ignoring the object creation. Do u think i am should used conversation instead of event????
3:41:57,821 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.faces.el.PropertyNotFoundException: /pages/account/journal/record.xhtml @18,81 value="#{generalJournal.number}": Target Unreachable, identifier 'generalJournal' resolved to null
at com.sun.facelets.el.LegacyValueBinding.getType(LegacyValueBinding.java:96)
at org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:58)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:310)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:604)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.getConvertedValue(HtmlTextRendererBase.java:191)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:396)
at javax.faces.component.UIInput.validate(UIInput.java:350)
at javax.faces.component.UIInput.processValidators(UIInput.java:184)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627)
at javax.faces.component.UIForm.processValidators(UIForm.java:73)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:149)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$201(AjaxViewRoot.java:53)
at org.ajax4jsf.framework.ajax.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:315)
at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:53)
at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:191)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.processValidators(AjaxViewRoot.java:329)
at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048552#4048552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048552
18 years, 11 months
[JBoss Seam] - Re: Error in trying to injecting the bean
by tony.herstell@gmail.com
The scope is event?
@Scope(EVENT)
Is that right?
Don't you not want this to be in a Conversation (preferred) or Session?
What is behind your choice of Event Scope?
Are you just jumping straight into the page (i.e. main page)?
You might not have been near the bean yet if so and not had a generalJournal created for you.
Also, you are not Outjecting the bean to your view...
| @In(create=true)
| private GeneralJournal generalJournal;
|
so
| value="#{generalJournal.number}"
|
might have a hard job finding it in the view!
You have two choices here
Outject it...
| @In(create=true) @Out
| private GeneralJournal generalJournal;
|
or
have a method on AccountAction that exposes a calss variable that contains it.
Both seem to work... but you have to do:
value="#{accountAction.generalJournal.number}"
to access the number.
I hope this helps you track down the problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048548#4048548
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048548
18 years, 11 months