[jboss-user] [JBoss Seam] - Error in trying to injecting the bean
cormet
do-not-reply at jboss.com
Thu May 24 19:23:13 EDT 2007
Hi All,
I am quite new to jboss and Currently, i am using hibernate 3.2.1, seam 1.2.1 GA. my problem is that i would like to inject the bean called "generalJournal" when it is submited. However I got error saying that:
javax.faces.el.EvaluationException: Exception while invoking expression #{accountAction.recordJournal}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
at org.jboss.seam.pages.Page.enter(Page.java:229)
at org.jboss.seam.core.Pages.enterPage(Pages.java:276)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:276)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:73)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:126)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
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)
Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value: accountAction.generalJournal
at org.jboss.seam.Component.getValueToInject(Component.java:1919)
at org.jboss.seam.Component.injectAttributes(Component.java:1368)
at org.jboss.seam.Component.inject(Component.java:1195)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at com.medansoft.accountingsystem.controller.AccountAction_$$_javassist_1.recordJournal(AccountAction_$$_javassist_1.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
... 42 more
It complaint that the "generalJournal" is null, but i do put "create=true" which asking seam to create when it is null. iam quite confuse with the documentation provided :(. Can anyone give me some guideline about it?
Cheers,
here are my code:
home.xhtml
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:c="http://java.sun.com/jsp/jstl/core"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
| <body>
| <ui:composition template="/WEB-INF/pages/templates/master.xhtml">
| <ui:define name="body">
| <s:link value="Account List" view="/pages/account/home.xhtml"/>
| <s:link value="Record Journal" view="/pages/account/journal/record.xhtml"/>
| </ui:define>
| </ui:composition>
| </body>
| </html>
|
record.xhtml:
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:c="http://java.sun.com/jsp/jstl/core"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
| xmlns:jp="http://www.jenia.org/jsf/popup">
| <body>
| <ui:composition template="/WEB-INF/pages/templates/master.xhtml">
| <ui:define name="body">
| <h:form>
| <s:decorate id="journalDecorate" template="edit.xhtml">
| <ui:define name="label">General Journal #:</ui:define>
| <h:inputText id="journal" value="#{generalJournal.number}" required="true">
|
| </h:inputText>
| </s:decorate>
| <s:decorate id="dateDecorate" template="edit.xhtml">
| <ui:define name="label">Date:</ui:define>
| <h:inputText id="date" value="#{generalJournal.date}" required="true" readonly="true">
|
| </h:inputText>
| <jp:popupCalendar for="date" format="dd/MM/yyyy">
| <h:outputText value="Popup calendar" />
| </jp:popupCalendar>
| </s:decorate>
| <s:decorate id="memoDecorate" template="edit.xhtml">
| <ui:define name="label">Memo:</ui:define>
| <h:inputText id="menu" value="#{generalJournal.memo}" required="true">
|
| </h:inputText>
| </s:decorate>
|
| <div class="buttonBox">
| <h:commandButton id="create" type="submit" value="Create" action="#{accountAction.createGeneralJournal}"/>
|
| <s:button id="cancel" value="Cancel" view="/pages/home/home.xhtml"/>
| </div>
|
| </h:form>
| </ui:define>
| </ui:composition>
| </body>
| </html>
|
pages.xml
| <!DOCTYPE pages PUBLIC
| "-//JBoss/Seam Exceptions Configuration DTD 1.2//EN"
| "http://jboss.com/products/seam/pages-1.2.dtd">
|
| <pages login-view-id="/login.xhtml">
| <page view-id="/pages/account/home.xhtml" action="#{accountAction.accountHome}"/>
| <page view-id="/pages/account/journal/record.xhtml" action="#{accountAction.recordJournal}"/>
|
|
| <page view-id="/pages/*" login-required="true"/>
|
| <exception class="org.jboss.seam.security.NotLoggedInException">
| <redirect view-id="/login.xhtml">
| <message>You must be logged in to perform this action</message>
| </redirect>
| </exception>
|
| <exception class="org.jboss.seam.security.AuthorizationException">
| <end-conversation/>
| <redirect view-id="/security_error.xhtml">
| <message>You do not have the necessary security privileges to perform this action.</message>
| </redirect>
| </exception>
| </pages>
|
AccountAction.java
| @Name("accountAction")
| @Scope(EVENT)
| 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)
| 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;
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048520#4048520
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048520
More information about the jboss-user
mailing list