NoSuchMethodError但一切似乎都没问题

时间:2014-04-28 16:50:47

标签: jsf el

我是richfaces的新手,我正在使用JBoss EAP 5.1.1中的richfaces 3.3.3.final进行开发。

我有一个EAR应用程序,它给了我这个错误:

2014-04-28 11:25:16,028 WARN  [org.richfaces.component.UIDatascroller] (http-0.0.0.0-8080-3) Datascroller ordenesNizaForm:tblOrdenes:scroller: The requested page #0 isn't found in the model containing 1 pages. Paging is reset to page #1
2014-04-28 11:25:16,029 WARN  [org.richfaces.component.UIDatascroller] (http-0.0.0.0-8080-3) Datascroller ordenesNizaForm:tblOrdenesSeleccionadas:scroller2: The requested page #0 isn't found in the model containing 1 pages. Paging is reset to page #1
2014-04-28 11:25:16,044 INFO  [ec.gob.iepi.controladores.OrdenNizaController] (http-0.0.0.0-8080-3) iniciando...
2014-04-28 11:25:16,045 INFO  [ec.gob.iepi.controladores.OrdenNizaBean] (http-0.0.0.0-8080-3) inicializando datos...
2014-04-28 11:25:16,046 INFO  [ec.gob.iepi.controladores.OrdenNizaController] (http-0.0.0.0-8080-3) ejecutar Busqueda inicial...
2014-04-28 11:25:16,056 SEVERE [facelets.viewhandler] (http-0.0.0.0-8080-3) Error Rendering View[/pages/main.xhtml]
com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean ordenNizaController
    at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:226)
    at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:108)
    at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)
    at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:230)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:61)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:107)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:285)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:242)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:180)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:127)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:180)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:127)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.faces.spi.InjectionProviderException: unable to process invokePostConstruct.
    at org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider.invokePostConstruct(JBossDelegatingInjectionProvider.java:94)
    at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:220)
    ... 61 more
Caused by: java.lang.reflect.InvocationTargetException
    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:597)
    at org.jboss.web.tomcat.service.TomcatInjectionContainer.processesLifecycleCallbackMetaData(TomcatInjectionContainer.java:501)
    at org.jboss.web.tomcat.service.TomcatInjectionContainer.postConstruct(TomcatInjectionContainer.java:293)
    at org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider.invokePostConstruct(JBossDelegatingInjectionProvider.java:90)
    ... 62 more
Caused by: java.lang.NoSuchMethodError: ec.gob.iepi.servicios.OrdenNizaServiceLocal.findOrdenesByCodigoClase(Ljava/lang/Integer;)Ljava/util/List;
    at ec.gob.iepi.controladores.OrdenNizaController.ejecutarBusquedaInicial(OrdenNizaController.java:86)
    at ec.gob.iepi.controladores.OrdenNizaController.iniciar(OrdenNizaController.java:57)
    ... 69 more
2014-04-28 11:25:16,100 INFO  [ec.gob.iepi.controladores.OrdenNizaController] (http-0.0.0.0-8080-3) iniciando...
2014-04-28 11:25:16,100 INFO  [ec.gob.iepi.controladores.OrdenNizaBean] (http-0.0.0.0-8080-3) inicializando datos...
2014-04-28 11:25:16,100 INFO  [ec.gob.iepi.controladores.OrdenNizaController] (http-0.0.0.0-8080-3) ejecutar Busqueda inicial...
2014-04-28 11:30:55,230 INFO  [javax.servlet.ServletContextListener] (http-0.0.0.0-8080-2) Welcome to Seam 2.2.4.EAP5
2014-04-28 11:30:57,891 WARN  [org.jboss.seam.Component] (http-0.0.0.0-8080-2) Component class should be serializable: sessionInfoAction
2014-04-28 11:30:57,941 WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] (http-0.0.0.0-8080-2) no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.

我必须使用请求参数(来自URL)从另一个应用程序(BPM进程)调用此应用程序。

我的托管bean有请求范围,这个参数有以下参数(faces-config.xml):

<managed-bean>
  <managed-bean-name>ordenNizaController</managed-bean-name>
  <managed-bean-class>ec.gob.iepi.controladores.OrdenNizaController</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  <managed-property>
   <property-name>ordenNizaBean</property-name>
   <property-class>ec.gob.iepi.controladores.OrdenNizaBean</property-class>
   <value>#{ordenNizaBean}</value>
  </managed-property>
  <managed-property>
   <property-name>codigoClase</property-name>
   <property-class>java.lang.String</property-class>
   <value>#{param.codigoClase}</value>
  </managed-property>
  <managed-property>
   <property-name>codigoSolicitud</property-name>
   <property-class>java.lang.String</property-class>
   <value>#{param.codigoSolicitud}</value>
  </managed-property>
 </managed-bean>

一切似乎都没问题,我使用这个服务来填充数据库中的列表(postgresql):       

  @EJB(mappedName="ordenes-niza-EAR/OrdenNizaServiceImpl/local")
    private OrdenNizaServiceLocal ordenNizaService; 

当我启动Jboss时没有出现错误,但在运行时,它会收到错误。我的@PostConstruct方法调用了两次,我认为是由于请求范围。

这是我的托管bean,其范围是请求:

package ec.gob.iepi.controladores;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import org.apache.log4j.Logger;

import ec.gob.iepi.accesodatos.AccesoDatosProceso;
import ec.gob.iepi.exception.DaoException;
import ec.gob.iepi.exception.EntidadException;
import ec.gob.iepi.exception.ServiceException;
import ec.gob.iepi.modelo.OrdenNiza;
import ec.gob.iepi.servicios.OrdenNizaServiceLocal;

public class OrdenNizaController {

    private AccesoDatosProceso datos = new AccesoDatosProceso();

    private static final Logger log = Logger
            .getLogger(OrdenNizaController.class);

    private String texto;
    private String codigoClase;
    private ec.gob.iepi.controladores.OrdenNizaBean ordenNizaBean;

    private java.lang.String codigoSolicitud;

    @EJB(mappedName="ordenes-niza-EAR/OrdenNizaServiceImpl/local")
    private OrdenNizaServiceLocal ordenNizaService;

    @PostConstruct
    public void iniciar() {
        log.info("iniciando...");
        ordenNizaBean.incializarDatos();
        if (codigoClase != null) {
            FacesUtil.setSessionMapValue("codigoClase", codigoClase);
        }
        if (codigoClase == null) {
            codigoClase = (String) FacesUtil.getSessionMapValue("codigoClase");
        }

        if (codigoSolicitud != null) {
            FacesUtil.setSessionMapValue("codigoSolicitud", codigoSolicitud);
        }
        if (codigoSolicitud == null) {
            codigoSolicitud = (String) FacesUtil
                    .getSessionMapValue("codigoSolicitud");
        }

        ejecutarBusquedaInicial();
        ejecutarBusquedaEnTemporal();
        log.info("...iniciado");
    }

    public void ejecutarBusquedaInicial() {
        log.info("ejecutar Busqueda inicial...");

        List<OrdenNiza> listaRetorno = new ArrayList<OrdenNiza>();
        try {
            Integer codigo = Integer.parseInt(codigoClase);

            ordenNizaService.findOrdenesByCodigoClase(codigo);

            ordenNizaBean.setListaOrdenNiza(listaRetorno);
        } catch (ServiceException e) {
            log.error("Error en la consulta del controlador", e);
        } catch (EntidadException e) {
            log.error("Error en la consulta del controlador", e);
        } catch (DaoException e) {
            log.error("Error en la consulta del controlador", e);
        }

        log.info("...Busqueda inicial ejecutada");
    }

    public String getTexto() {
        return texto;
    }

    public void setTexto(String texto) {
        this.texto = texto;
    }

    public String getCodigoClase() {
        return codigoClase;
    }

    public void setCodigoClase(String codigoClase) {
        this.codigoClase = codigoClase;
    }

    public ec.gob.iepi.controladores.OrdenNizaBean getOrdenNizaBean() {
        return ordenNizaBean;
    }

    public void setOrdenNizaBean(
            ec.gob.iepi.controladores.OrdenNizaBean ordenNizaBean) {
        this.ordenNizaBean = ordenNizaBean;
    }

    public java.lang.String getCodigoSolicitud() {
        return codigoSolicitud;
    }

    public void setCodigoSolicitud(java.lang.String codigoSolicitud) {
        this.codigoSolicitud = codigoSolicitud;
    }

}

服务实施:

package ec.gob.iepi.servicios;

import java.util.HashMap;
import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import org.apache.log4j.Logger;

import ec.gob.iepi.dao.OrdenNizaDAOLocal;
import ec.gob.iepi.exception.DaoException;
import ec.gob.iepi.exception.DeleteException;
import ec.gob.iepi.exception.EntidadException;
import ec.gob.iepi.exception.FindException;
import ec.gob.iepi.exception.InsertException;
import ec.gob.iepi.exception.ServiceException;
import ec.gob.iepi.exception.UpdateException;
import ec.gob.iepi.modelo.OrdenNiza;

@Stateless
public class OrdenNizaServiceImpl implements OrdenNizaServiceLocal,
        OrdenNizaServiceRemote {
    private static final Logger log = Logger
            .getLogger(OrdenNizaServiceImpl.class);
    @EJB(mappedName="ordenes-niza-EAR/OrdenNizaDAOImpl/local")
    OrdenNizaDAOLocal ordenNizaDao;

    public List<OrdenNiza> findOrdenesByCodigoClase(Integer codigoClase)
            throws EntidadException, DaoException, ServiceException {
        try {
            List<OrdenNiza> listaOrdenes = ordenNizaDao
                    .findOrdenesByCodigoClase(codigoClase);
            return listaOrdenes;
        } catch (ServiceException e) {
            log.error("Error en la consulta", e);
            throw new ServiceException("Error en la consulta");
        }

    }

}

请帮助你。 对不起我的英语不好。 感谢

OrdenNizaServiceLocal接口:

package ec.gob.iepi.servicios;

import java.util.HashMap;
import java.util.List;

import javax.ejb.Local;

import ec.gob.iepi.exception.DaoException;
import ec.gob.iepi.exception.DeleteException;
import ec.gob.iepi.exception.EntidadException;
import ec.gob.iepi.exception.FindException;
import ec.gob.iepi.exception.InsertException;
import ec.gob.iepi.exception.ServiceException;
import ec.gob.iepi.exception.UpdateException;
import ec.gob.iepi.modelo.OrdenNiza;

@Local
public interface OrdenNizaServiceLocal {

    List<OrdenNiza> findOrdenesByCodigoClase(Integer codigoClase)
            throws EntidadException, DaoException, ServiceException;
}

我有其他正确调用的方法,与此特定方法的不同之处在于,这个方法使用本机查询,而其他方法使用休眠。

我正在使用其他方法,应用程序运行没有问题。

1 个答案:

答案 0 :(得分:0)

此例外与其名称一样清晰。 OrdenNizaServiceLocal没有方法findOrdenesByCodigoClase(Integer arg)

提取EAR并找到OrdenNizaServiceLocal.class然后对其进行反编译,您会发现此方法不存在。

这可能因为过时的jar版本而发生。 看看OrdenNizaServiceLocal类的jar。