[jboss-user] [JBoss Seam] - error : In attribute requires value for component , why ?

EddieLee do-not-reply at jboss.com
Fri Oct 27 23:42:14 EDT 2006


Content.java

  | package com.vsoft.aixinweb.view ;
  | 
  | import java.util.Date;
  | 
  | import javax.ejb.Stateless;
  | import javax.faces.context.FacesContext;
  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.log.Log;
  | 
  | import com.vsoft.aixinweb.persistent.dao.ContentDaoImpl;
  | import com.vsoft.aixinweb.persistent.model.Content;
  | 
  | /**
  |  * @author Eddie L
  |  *
  |  */
  | @ Stateless
  | @ Name ( "contentAction" )
  | @Scope(ScopeType.EVENT)
  | public class ContentAction implements IfContentAction
  | {
  | 	@ In
  | 	private Content			content ;
  | 
  | 	@ In
  | 	private ContentDaoImpl	contentDaoImpl ;
  | 
  | 	@ In
  | 	private FacesContext	facesContext ;
  | 
  | 	@ Logger
  | 	private Log				log ;
  | 	
  | 	/* (non-Javadoc)
  | 	 * @see com.vsoft.aixinweb.view.IfContentAction#addContent()
  | 	 */
  | 	public String addContent()
  | 	{
  | 		content.setCreateDate ( new Date() );
  | 		contentDaoImpl.insertContent ( this.content );
  | 		return "success";
  | 	}
  | 	
  | 	public void setContentDaoImpl ( ContentDaoImpl contentDaoImpl )
  | 	{
  | 		this.contentDaoImpl = contentDaoImpl ;
  | 	}
  | 	
  | }
  | 


ContentDaoImpl.java

  | package com.vsoft.aixinweb.persistent.dao ;
  | 
  | import java.util.Iterator;
  | import java.util.List;
  | import java.util.Map;
  | 
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | import javax.persistence.Query;
  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.log.Log;
  | 
  | import com.vsoft.aixinweb.persistent.model.Content;
  | 
  | /**
  |  * @author Eddie L
  |  *
  |  */
  | @ Stateless
  | @ Name ( "contentDaoImpl" )
  | @Scope(ScopeType.APPLICATION)
  | public class ContentDaoImpl implements ContentDao
  | {
  | 
  | 	@ PersistenceContext
  | 	private EntityManager	em ;
  | 
  | 	@ Logger
  | 	private Log				log ;
  | 
  | 	public void delContent ( Content content )
  | 	{
  | 		log.info ( "ContentDaoImpl delContent content.id : "
  | 				+ content.getId ( ).toString ( ) ) ;
  | 		em.remove ( content ) ;
  | 	}
  | 
  | 	public Content getOneRecord ( String id )
  | 	{
  | 		Query q = em.createQuery ( "from Content c where c.id = ?1" ) ;
  | 		q.setParameter ( 1 , id ) ;
  | 		return ( Content ) q.getSingleResult ( ) ;
  | 	}
  | 
  | 	public List < Content > getRecord ( String sql ,
  | 			Map < String , Object > filter , int ... is )
  | 	{
  | 		Query q = em.createQuery ( sql ) ;
  | 		Iterator iterator = filter.keySet ( ).iterator ( ) ;
  | 		while ( iterator.hasNext ( ) )
  | 		{
  | 			String element = ( String ) iterator.next ( ) ;
  | 			q.setParameter ( element , filter.get ( element ) ) ;
  | 		}
  | 		if ( is.length > 0 )
  | 		{
  | 			q.setFirstResult ( is [ 0 ] ) ;
  | 			q.setMaxResults ( is [ 1 ] ) ;
  | 		}
  | 		
  | 		return q.getResultList ( );
  | 	}
  | 
  | 	public void insertContent ( Content content )
  | 	{
  | 		em.persist ( content ) ;
  | 	}
  | 
  | 	public void updateContent ( Content content )
  | 	{
  | 		em.merge ( content ) ;
  | 	}
  | 
  | }
  | 


interface ContentDao.java

  | package com.vsoft.aixinweb.persistent.dao;
  | 
  | import java.util.List;
  | import java.util.Map;
  | 
  | import javax.ejb.Local;
  | 
  | import com.vsoft.aixinweb.persistent.model.Content;
  | 
  | /**
  |  * @author Eddie L
  |  *
  |  */
  | @Local
  | public interface ContentDao
  | {
  | 	public void insertContent(Content content);
  | 	
  | 	public void updateContent(Content content);
  | 
  | 	public void delContent(Content content);
  | 	
  | 
  | 	public Content getOneRecord(String id);
  | 	
  | 
  | 	public List<Content> getRecord(String sql, Map<String, Object> filter, int ...is );
  | 	
  | 	
  | }
  | 

interface IfContentAction.java
package com.vsoft.aixinweb.view ;
  | 
  | import javax.ejb.Local;
  | 
  | @Local
  | public interface IfContentAction
  | {
  | 
  | 	public String addContent ( ) ;
  | 
  | }


ContentAction.java

  | package com.vsoft.aixinweb.view ;
  | 
  | import java.util.Date;
  | 
  | import javax.ejb.Stateless;
  | import javax.faces.context.FacesContext;
  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.log.Log;
  | 
  | import com.vsoft.aixinweb.persistent.dao.ContentDaoImpl;
  | import com.vsoft.aixinweb.persistent.model.Content;
  | 
  | /**
  |  * @author Eddie L
  |  *
  |  */
  | @ Stateless
  | @ Name ( "contentAction" )
  | @Scope(ScopeType.EVENT)
  | public class ContentAction implements IfContentAction
  | {
  | 	@ In
  | 	private Content			content ;
  | 
  | 	@ In
  | 	private ContentDaoImpl	contentDaoImpl ;
  | 
  | 	@ In
  | 	private FacesContext	facesContext ;
  | 
  | 	@ Logger
  | 	private Log				log ;
  | 	
  | 	/* (non-Javadoc)
  | 	 * @see com.vsoft.aixinweb.view.IfContentAction#addContent()
  | 	 */
  | 	public String addContent()
  | 	{
  | 		content.setCreateDate ( new Date() );
  | 		contentDaoImpl.insertContent ( this.content );
  | 		return "success";
  | 	}
  | 	
  | 	public void setContentDaoImpl ( ContentDaoImpl contentDaoImpl )
  | 	{
  | 		this.contentDaoImpl = contentDaoImpl ;
  | 	}
  | 	
  | }

test.jsp

<h:commandButton styleClass="formButton" type="submit" value="OK"
  | 					action="#{contentAction.addContent}" />

anonymous wrote : javax.servlet.ServletException: Error calling action method of component with id _id6:_id26
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
  | 	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.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.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)
  | 11:16:36,015 INFO  [SeamExceptionFilter] killing transaction
  | 11:16:36,015 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
  | javax.faces.FacesException: Error calling action method of component with id _id6:_id26
  | 	at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
  | 	at javax.faces.component.UICommand.broadcast(UICommand.java:106)
  | 	at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
  | 	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
  | 	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.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.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: javax.faces.el.EvaluationException: /test.xhtml @59,45 action="#{contentAction.addContent}": javax.ejb.EJBTransactionRolledbackException: org.jboss.seam.RequiredException: In attribute requires value for component: contentAction.contentDaoImpl
  | 	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
  | 	at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
  | 	... 30 more
  | Caused by: javax.ejb.EJBTransactionRolledbackException: org.jboss.seam.RequiredException: In attribute requires value for component: contentAction.contentDaoImpl
  | 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
  | 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  | 	at $Proxy114.addContent(Unknown Source)
  | 	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 com.sun.el.parser.AstValue.invoke(AstValue.java:151)
  | 	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
  | 	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
  | 	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
  | 	... 31 more
  | Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: contentAction.contentDaoImpl
  | 	at org.jboss.seam.Component.getInstanceToInject(Component.java:1382)
  | 	at org.jboss.seam.Component.injectFields(Component.java:1024)
  | 	at org.jboss.seam.Component.inject(Component.java:795)
  | 	at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
  | 	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.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
  | 	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.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
  | 	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.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
  | 	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.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
  | 	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.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
  | 	... 54 more


how can i do ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981488#3981488

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981488



More information about the jboss-user mailing list