Hello. I'm new to seam and i want to integrate seam capability with AndroMDA product. I use AndroMDA for generating EJB3 and DAOs. I made a simple application that allows users login and see userlist.
There are some strangeness: After user login he able to see userslist. There are an link to CreateNewUser from that page. When user created it's rediercts toViewAllUsers. All work's fine, but: When i add capability to delete User (delete button in userlist according to seam examples) i got an error: | 12:07:22,138 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception | javax.faces.FacesException: Error calling action method of component with id _id0:_id2_4:_id13 | at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:7 | 4) | at javax.faces.component.UICommand.broadcast(UICommand.java:106) | at javax.faces.component.UIData.broadcast(UIData.java:338) | 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.j | ava:252) | 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.j | ava: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.ja | va: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(Htt | p11BaseProtocol.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: Exception while invoking expression #{userService.del | eteUser} | at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153) | at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:6 | 3) | ... 25 more | Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: could not set field value: us | erService.userDataModel | at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69) | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) | at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197) | 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.jav | a: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:1 | 06) | 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 $Proxy871.deleteUser(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 org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129) | ... 26 more | Caused by: java.lang.IllegalArgumentException: could not set field value: userService.userDataModel | at org.jboss.seam.Component.setFieldValue(Component.java:1214) | at org.jboss.seam.Component.injectDataModelSelection(Component.java:909) | at org.jboss.seam.Component.injectDataModelSelection(Component.java:874) | at org.jboss.seam.Component.inject(Component.java:796) | at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionIntercept | or.java:30) | at sun.reflect.GeneratedMethodAccessor594.invoke(Unknown Source) | 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(Con | versationInterceptor.java:82) | at sun.reflect.GeneratedMethodAccessor593.invoke(Unknown Source) | 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(Busin | essProcessInterceptor.java:60) | at sun.reflect.GeneratedMethodAccessor592.invoke(Unknown Source) | 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.GeneratedMethodAccessor591.invoke(Unknown Source) | 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.GeneratedMethodAccessor656.invoke(Unknown Source) | 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(TransactionScopedE | ntityManagerInterceptor.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.invokeInOurTx(TxPolicy.java:79) | ... 46 more | Caused by: java.lang.IllegalArgumentException | at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) | at java.lang.reflect.Field.set(Field.java:656) | at org.jboss.seam.Component.setFieldValue(Component.java:1210) | ... 90 more | I try many wariants and now i'm going mad There are code of my userService class: | @Name("userService") | @Stateless | @Scope(SESSION) | | @javax.ejb.Local({com.accarda.manobobs.service.UsersServiceLocal.class}) | @javax.ejb.Remote({com.accarda.manobobs.service.UsersServiceRemote.class}) | @Interceptors(SeamInterceptor.class) | public class UsersServiceBean extends | com.accarda.manobobs.service.UsersServiceBase { | | //seam injections | @In(required=false) | private UserVO2Seam userVO2Seam; | | @Logger | private Log log; | | @DataModel | private List<UserVO2Seam> userDataModel; | @DataModelSelection | @In(required=false) | @Out(required=false) | private UserVO2Seam selectionUser; | // --------------- Constructors --------------- | | public UsersServiceBean() { | super(); | } | | | public List<UserVO2Seam> getUserDataModel() { | return userDataModel; | } | | | public void setUserDataModel(List<UserVO2Seam> userDataModel) { | this.userDataModel = userDataModel; | } | | | // -------- Business Methods Impl -------------- | protected void handleSelect() throws Exception { | // TODO Auto-generated method stub | } | /** | * @see com.accarda.manobobs.service.UsersServiceBase#createUser(com.accarda.manobobs.model.vo.UsersVO[]) | */ | protected String handleCreateUserFromSeam() throws Exception { | String result = "userlist"; | try{ | updateUser(userVO2Seam); | userDataModel = new ArrayList(getUsersDao().loadAll(UsersDao.TRANSFORM_USERSVO)); | } catch (Exception e) { | log.error(e.getMessage()); | result = "creatingerror"; | FacesMessages.instance().add("Nick name must be unique"); | } | | return result; | } | | | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#updateUser(UsersVO) | */ | protected void handleUpdateUser(UsersVO userVO) throws Exception { | getUsersDao().update(getUsersDao().usersVOToEntity(userVO)); | } | | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#deleteUser() | */ | protected void handleDeleteUser() throws Exception { | if(selectionUser != null){ | getUsersDao().remove(selectionUser.getId()); | userDataModel.remove(selectionUser); | } | } | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#createUser(com.accarda.manobobs.model.vo.UsersVO[]) | */ | protected void handleCreateUser(com.accarda.manobobs.model.vo.UsersVO userVO) | throws java.lang.Exception { | getUsersDao().create(userVO.getFirstName(), userVO.getLastName(), | userVO.getPassword(), userVO.getNickname()); | log.info("User Created"); | } | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#populateUsers() | */ | | protected void handlePopulateUsers() throws Exception { | | } | | @Factory("userDataModel") | public void findUsers() { | log.info("-------POPULATING-----USERS-------"); | try{ | userDataModel = new ArrayList(getUsersDao().loadAll(UsersDao.TRANSFORM_USERSVO)); | } catch (Throwable th) { | log.error(th); | } | | } | /** | * @see com.accarda.manobobs.service.UsersServiceBase#deleteUser(java.lang.Long) | */ | protected void handleDeleteUser(java.lang.Long id) | throws java.lang.Exception { | // TODO: put your implementation here. | throw new java.lang.UnsupportedOperationException( | "com.accarda.manobobs.service.UsersServiceBean.handleDeleteUser(java.lang.Long id) Not implemented!"); | } | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#getUser(java.lang.Long) | */ | protected com.accarda.manobobs.model.vo.UsersVO handleGetUser( | java.lang.Long id) throws java.lang.Exception { | // TODO: put your implementation here. | // Dummy return value, just that the file compiles | return null; | } | | /** | * @see com.accarda.manobobs.service.UsersServiceBase#getAllUsers() | */ | protected com.accarda.manobobs.model.vo.UsersVO[] handleGetAllUsers() | throws java.lang.Exception { | // TODO: put your implementation here. | // Dummy return value, just that the file compiles | return null; | } | | | // -------- Lifecycle Callback Impl -------------- | | } | UserServiceBase code: | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | @javax.ejb.Remote({com.accarda.manobobs.service.UsersServiceRemote.class}) | public abstract class UsersServiceBase | implements com.accarda.manobobs.service.UsersServiceRemote | { | // ------ Session Context Injection ------ | | @javax.annotation.Resource | protected javax.ejb.SessionContext context; | | // ------ Persistence Context Definitions -------- | | /** | * Inject persistence context manobonsweb | */ | @javax.persistence.PersistenceContext(unitName = "manobonsweb") | protected javax.persistence.EntityManager emanager; | | // ------ DAO Injection Definitions -------- | | /** | * Inject DAO UsersDao | */ | @javax.ejb.EJB | private com.accarda.manobobs.model.domain.UsersDao usersDao; | | // --------------- Constructors --------------- | | public UsersServiceBase() | { | super(); | } | | // ------ DAO Getters -------- | | /** | * Get the injected DAO UsersDao | */ | protected com.accarda.manobobs.model.domain.UsersDao getUsersDao() | { | return this.usersDao; | } | | // -------- Business Methods -------------- | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void createUser(com.accarda.manobobs.model.vo.UsersVO userVO) | { | if (userVO == null) | { | throw new IllegalArgumentException( | "com.accarda.manobobs.service.UsersServiceBean.createUser(com.accarda.manobobs.model.vo.UsersVO userVO) - 'userVO' can not be null"); | } | try | { | this.handleCreateUser(userVO); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.createUser(com.accarda.manobobs.model.vo.UsersVO userVO)' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #createUser(com.accarda.manobobs.model.vo.UsersVO)} | */ | protected abstract void handleCreateUser(com.accarda.manobobs.model.vo.UsersVO userVO) | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void deleteUser(java.lang.Long id) | { | if (id == null) | { | throw new IllegalArgumentException( | "com.accarda.manobobs.service.UsersServiceBean.deleteUser(java.lang.Long id) - 'id' can not be null"); | } | try | { | this.handleDeleteUser(id); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.deleteUser(java.lang.Long id)' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #deleteUser(java.lang.Long)} | */ | protected abstract void handleDeleteUser(java.lang.Long id) | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public com.accarda.manobobs.model.vo.UsersVO getUser(java.lang.Long id) | { | if (id == null) | { | throw new IllegalArgumentException( | "com.accarda.manobobs.service.UsersServiceBean.getUser(java.lang.Long id) - 'id' can not be null"); | } | try | { | return this.handleGetUser(id); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.getUser(java.lang.Long id)' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #getUser(java.lang.Long)} | */ | protected abstract com.accarda.manobobs.model.vo.UsersVO handleGetUser(java.lang.Long id) | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public com.accarda.manobobs.model.vo.UsersVO[] getAllUsers() | { | try | { | return this.handleGetAllUsers(); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.getAllUsers()' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #getAllUsers()} | */ | protected abstract com.accarda.manobobs.model.vo.UsersVO[] handleGetAllUsers() | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public java.lang.String createUserFromSeam() | { | try | { | return this.handleCreateUserFromSeam(); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.createUserFromSeam()' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #createUserFromSeam()} | */ | protected abstract java.lang.String handleCreateUserFromSeam() | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void populateUsers() | { | try | { | this.handlePopulateUsers(); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.populateUsers()' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #populateUsers()} | */ | protected abstract void handlePopulateUsers() | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void updateUser(com.accarda.manobobs.model.vo.UsersVO userVO) | { | if (userVO == null) | { | throw new IllegalArgumentException( | "com.accarda.manobobs.service.UsersServiceBean.updateUser(com.accarda.manobobs.model.vo.UsersVO userVO) - 'userVO' can not be null"); | } | try | { | this.handleUpdateUser(userVO); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.updateUser(com.accarda.manobobs.model.vo.UsersVO userVO)' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #updateUser(com.accarda.manobobs.model.vo.UsersVO)} | */ | protected abstract void handleUpdateUser(com.accarda.manobobs.model.vo.UsersVO userVO) | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void deleteUser() | { | try | { | this.handleDeleteUser(); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.deleteUser()' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #deleteUser()} | */ | protected abstract void handleDeleteUser() | throws java.lang.Exception; | | /** | * | */ | @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) | public void select() | { | try | { | this.handleSelect(); | } | catch (Throwable th) | { | throw new com.accarda.manobobs.service.UsersServiceException( | "Error performing 'com.accarda.manobobs.service.UsersService.select()' --> " + th, | th); | } | } | | /** | * Performs the core logic for [EMAIL PROTECTED] #select()} | */ | protected abstract void handleSelect() | throws java.lang.Exception; | | | // -------- Lifecycle Callbacks -------------- | | } | And finally JSP code: | <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> | <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> | <%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s"%> | <html> | <head> | <title>Users</title> | </head> | <body> | <f:view> | <h:form> | <h2>User List</h2> | <h:outputText value="No users to display" | rendered="#{userDataModel.rowCount==0}" /> | <h:dataTable var="user" value="#{userDataModel}" | rendered="#{userDataModel.rowCount>0}"> | <h:column> | <f:facet name="header"> | <h:outputText value="Nickname" /> | </f:facet> | <h:commandLink value="#{user.nickname}" action="#{userService.select}"/> | </h:column> | <h:column> | <f:facet name="header"> | <h:outputText value="First Name" /> | </f:facet> | <h:outputText value="#{user.firstName}" /> | </h:column> | <h:column> | <f:facet name="header"> | <h:outputText value="Last Name" /> | </f:facet> | <h:outputText value="#{user.lastName}" /> | </h:column> | <h:column> | <h:commandButton value="Delete" action="#{userService.deleteUser}" /> | </h:column> | </h:dataTable> | | <h3><h:outputText value="#{selectionUser.firstName}" /></h3> | <div><h:outputText value="#{selectionUser.lastName}" /></div> | | <s:link view="/user/CreateUser.jsp" value="Create User" /> | </h:form> | </f:view> | </body> | </html> | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989621#3989621 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989621 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user