gpt4 book ai didi

java.lang.NoSuchMethodError : fr. la.juserright.metier.Ressource.(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

转载 作者:行者123 更新时间:2023-11-29 05:56:06 27 4
gpt4 key购买 nike

我的 DAO 总是抛出这个异常:java.lang.NoSuchMethodError: fr.la.juserright.metier.Ressource.<init>(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

RessourceDAO:

public List<Ressource> readAll() throws SQLException {
List<Ressource> __ressource = new ArrayList<Ressource>();
PreparedStatement _stmt = null;
ResultSet _rs = null;

try {
_stmt = this.cnxUserRight.getCnx().prepareStatement(
"SELECT * FROM ressource");
_rs = _stmt.executeQuery();
while (_rs.next()) {
Ressource _ressourcetmp = this.getRessource(_rs);
__ressource.add(_ressourcetmp);
}
} catch (NamingException e) {
e.printStackTrace();
} finally {
if (null != _rs) {
_rs.close();
}
if (null != _stmt) {
_stmt.close();
this.cnxUserRight.closeCnx();
}
}
return __ressource;
}

public Ressource getRessourceByPathForUpdate(String Path, int idressource)
throws SQLException {
Ressource _ressource = null;
PreparedStatement _stmt = null;
ResultSet _rs = null;

try {
_stmt = this.cnxUserRight
.getCnx()
.prepareStatement(
"SELECT * FROM ressource WHERE path like ? and idressource not like ?;");
_stmt.setString(1, Path);
_stmt.setInt(2, idressource);
_rs = _stmt.executeQuery();
if (_rs.next()) {
_ressource = this.getRessource(_rs);
} else {
_ressource = null;
}
} catch (NamingException e) {
e.printStackTrace();
} finally {
if (null != _rs) {
_rs.close();
}
if (null != _stmt) {
_stmt.close();
this.cnxUserRight.closeCnx();
}
}
return _ressource;
}

private Ressource getRessourceForChild(int _idChild) throws SQLException {
Ressource _ressource = null;
PreparedStatement _stmt = null;
ResultSet _rs = null;
try {
_stmt = this.cnxUserRight.getCnx().prepareStatement(
"SELECT * FROM ressource " + "WHERE idressource = ("
+ "SELECT idressource "
+ "FROM ressource_ressource "
+ "WHERE idressource_ressource = ?);");
_stmt.setInt(1, _idChild);
_rs = _stmt.executeQuery();
if (_rs.next()) {
_ressource = this.getRessource(_rs);
}
} catch (NamingException e) {
e.printStackTrace();
} finally {
if (null != _rs) {
_rs.close();
}
if (null != _stmt) {
_stmt.close();
this.cnxUserRight.closeCnx();
}
}
return _ressource;
}

private List<Ressource> getRessourceForMOM(int _idmere) throws SQLException {
List<Ressource> _ressource = new ArrayList<Ressource>();
PreparedStatement _stmt = null;
ResultSet _rs = null;

String _sql = "SELECT * FROM ressource "
+ "WHERE idressource_ressource = ("
+ "SELECT idressource_ressource " + "FROM ressource_ressource "
+ "WHERE idressource = " + _idmere + ");";
try {

_stmt = this.cnxUserRight.getCnx().prepareStatement(_sql);
_rs = _stmt.executeQuery();
while (_rs.next()) {
_ressource.add(this.getRessource(_rs));
}
} catch (NamingException e) {
e.printStackTrace();
} finally {
if (null != _rs) {
_rs.close();
}
if (null != _stmt) {
_stmt.close();
this.cnxUserRight.closeCnx();
}
}
return _ressource;
}

private Ressource getRessource(ResultSet _rs) throws SQLException {

int _idRessource = _rs.getInt("idressource");
String _path = _rs.getString("path");
String _menu = _rs.getString("menu");
String _description = _rs.getString("description");
int _idressource_ressource = _rs.getInt("idressource_ressource");
Ressource _ressource;
if (_idressource_ressource != 0) {
_ressource = new Ressource(_idRessource, _path, _menu,
_description,
this.getRessourceForChild(_idressource_ressource));
} else {
List<Ressource> _ressourceList = this
.getRessourceForMOM(_idressource_ressource);
_ressource = new Ressource(_idRessource, _path, _menu,
_description, _ressourceList);
}
return _ressource;
}

堆栈跟踪:

ATTENTION: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception java.lang.NoSuchMethodError: fr.la.juserright.metier.Ressource.<init>(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
at fr.la.juserright.dao.RessourceDAO.getRessource(RessourceDAO.java:451)
at fr.la.juserright.dao.RessourceDAO.readAll(RessourceDAO.java:86)
at fr.la.juserright.service.RessourceModule.getAllRessource(RessourceModule.java:33)
at fr.la.juserright.service.ServiceUserRight.getAllRessource(ServiceUserRight.java:132)
at fr.la.juserright.managedbean.ressourceBean.refreshlist(ressourceBean.java:102)
at fr.la.juserright.managedbean.ressourceBean.<init>(ressourceBean.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:103)
at com.sun.el.parser.AstValue.getTarget(AstValue.java:149)
at com.sun.el.parser.AstValue.getType(AstValue.java:84)
at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:200)
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
at org.primefaces.component.datatable.DataTable.isLazy(DataTable.java:968)
at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:191)
at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:108)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:57)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:45)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:51)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)

如果你有我感兴趣的想法。

最佳答案

java.lang.NoSuchMethodError: fr.la.juserright.metier.Ressource.(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V

这意味着 fr.la.juserright.metier.Ressource 的以下构造函数当前运行时类路径中根本不存在该类。

public Ressource(int arg1, String arg2, String arg3, String arg4, int arg5) {}

但是到目前为止给出的代码似乎没有在任何地方使用该构造函数。两个new Resource()调用 ResourceDAO类使用 RessourceList<Ressource>作为第 5 个参数。

显然运行时类路径是脏的,你正在运行一个过时的版本 RessourceDAO一直,而 Ressource类已在运行时类路径中正确更新。

清理、重建、重新部署和重启。

请注意,此问题与 JSF 无关。底层异常不是来自 javax.faces包,但仅来自 java.lang包,这基本上表示基本的 Java 语言/运行时问题。

关于java.lang.NoSuchMethodError : fr. la.juserright.metier.Ressource.<init>(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12069875/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com