Hi.
I run into one problem when I use overridden methods in a class that extends from a
parameterized class. If I declare in the superclass one method, then I override such
method in the specific type subclass, and then I use this method as an action, I get this
exception:
| javax.faces.el.EvaluationException: More than one method matched
#{userAction.select(userItem)}. Method name or number of p
| arams must be unique.
|
Here is my code:
Super class:
| public class UserActionT<T> implements Serializable {
|
| @In
| private EntityManager entityManager;
|
| private T entity;
|
|
| @Begin(ifOutcome = "Success")
| public String select(T selectedUser) {
| try {
| setInstance(entityManager.find(getEntityClass(), getId(selectedUser)));
| return "Success";
| } catch (EntityNotFoundException e) {
| return "Fail";
| }
| }
|
| public void setInstance(T instance) {
| entity = instance;
| }
|
| public T getInstance(){
| return entity;
| }
| protected Class<T> getEntityClass() {
| return (Class<T>) getInstance().getClass();
| }
| private Object getId(Object instance) {
| Object id = null;
| if (instance.getClass().isAnnotationPresent(Entity.class)) {
| for (Field field : instance.getClass().getDeclaredFields()) {
| if (field.isAnnotationPresent(Id.class)) {
| try {
| field.setAccessible(true);
| id = field.get(instance);
| } catch (IllegalAccessException e) {
| throw new IllegalArgumentException("The object instance
must have an @Id field");
| }
|
| }
| }
| } else {
| throw new IllegalArgumentException("The object instance must be an
annotated @Entity class");
| }
| return id;
| }
| @End
| public String cancel() {
| return "Success";
| }
|
|
Sub class:
| @Name("userAction")
| @Scope(ScopeType.CONVERSATION)
| @Restrict("#{s:hasRole('admin')}")
| public class UserActionExtended extends UserActionT<User> {
|
| @In(required = false)
| @Out(required = false)
| private User user;
|
|
|
| @Override
| @Begin(ifOutcome = "Success")
| public String select(User selectedUser) {
| return super.select(selectedUser);
| }
|
|
| @Override
| @End
| public String cancel() {
| return "userList";
| }
|
|
| @Override
| public void setInstance(User instance) {
| user = instance;
| }
|
| @Override
| public User getInstance() {
| return user;
| }
| }
|
.xhtml
| //inside a column of a dataTable which var name is userItem
| <s:link value="#{messages['Common.view']}"
action="#{userAction.select(userItem)}"/>
|
pages.xml
| <page view-id="/user/list.xhtml">
| <restrict>#{s:hasRole('admin')}</restrict>
| <end-conversation/>
| <navigation from-action="#{userAction.select(userItem)}">
| <rule if-outcome="Success">
| <redirect view-id="/user/edit.xhtml"/>
| </rule>
| <rule if-outcome="Fail">
| <redirect view-id="/user/list.xhtml"/>
| </rule>
| </navigation>
| </page>
|
|
I was having similar problems related to javassist (duplicated method exception), but I
solved this updating the thirdparty-all.jar with the javassit 3.4, and these exceptions
disappear.
At this time the problem seems somtehing related to EL expressions, but I don't know
what exactly is.
Maybe someone has some workaround for this problem, or even better knows how can I make
this work.
Any help is highly appreciated.
Thanks in advance.
Finally:
My environment:
Seam 1.2.1.GA
ajax4jsf 1.1.1
richfaces 3.0.1
Tomcat 5.5.17
The exception stacktrace is:
| 21:50:17,992 ERROR [SeamPhaseListener] uncaught exception
| javax.faces.el.EvaluationException: More than one method matched
#{userAction.select(userItem)}. Method name or number of p
| arams must be unique.
| at
org.jboss.seam.actionparam.ActionParamBindingHelper.findParamTypes(ActionParamBindingHelper.java:104)
| at
org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:55)
| 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.core.Pages.callAction(Pages.java:499)
| at org.jboss.seam.core.Pages.enterPage(Pages.java:282)
| at
org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:265)
| at
org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:203)
| at
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:57)
| 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.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:126)
| at
org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:248)
| 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.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| 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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| 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:66
| 4)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
| at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
| at java.lang.Thread.run(Thread.java:595)
| 21:50:18,008 ERROR [DebugPageHandler] redirecting to debug page
| javax.faces.el.EvaluationException: More than one method matched
#{userAction.select(userItem)}. Method name or number of p
| arams must be unique.
| at
org.jboss.seam.actionparam.ActionParamBindingHelper.findParamTypes(ActionParamBindingHelper.java:104)
| at
org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:55)
| 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.core.Pages.callAction(Pages.java:499)
| at org.jboss.seam.core.Pages.enterPage(Pages.java:282)
| at
org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:265)
| at
org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:203)
| at
org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:57)
| 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.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:126)
| at
org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:248)
| 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.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| 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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| 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:66
| 4)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
| at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041735#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...