javax.el.ELException 未找到方法
javax.el.ELException Method not found
我正在开发一个使用 Primefaces JSF 的 Web 应用程序,在前端使用托管 bean,在后端使用 SQL 服务器。我已经开发该应用程序 2 个月了,并在我们办公室的不同环境中对其进行了测试。不同的环境是指不同的 java 7 版本和 Tomcat 7 版本,一切都运行良好。
试图从我的家用 PC 继续开发,但现在出现错误
javax.el.ELException: /custsession_detailed.xhtml @67,122 value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment) }": 找不到方法: class al.durandal.com.jsf.IdToStringTypeComponent.returnPackagetName(java.lang.String)
我 100% 确定方法就在那里。在这两种环境中,Java 版本和 Tomcat 版本是相同的。
package al.durandal.com.jsf;
@ManagedBean(name="IdToString")
@ViewScoped
public class IdToStringTypeComponent extends ManagedComponent {
/**
*
*/
private static final long serialVersionUID = -233667982117424411L;
private PackagesType packageType;
private StatusType statusType;
private static Logger logger =Logger.getLogger(IdToStringTypeComponent.class.getName());
@Autowired
private transient StatusTypeDAO statusTypeDAO;
@Autowired
private transient StatusTypeService statusTypeService;
@Autowired
private transient PackagesTypeDAO packagesTypeDAO;
public List<StatusType> listAllStatusTypes(){
return new java.util.ArrayList<StatusType>(statusTypeDAO.findAllStatusTypes());
}
public StatusType getStatusType() {
return statusType;
}
public void setSatusType(StatusType statType) {
this.statusType = statType;
}
@Transactional
public StatusType loadStatusTypeByPrimaryKey(Integer sidKey) {
statusType = statusTypeDAO.findStatusTypeByPrimaryKey(sidKey);
return statusType;
}
public String returnProductName(Integer statusCode){
statusType=statusTypeDAO.findStatusTypeByPrimaryKey(statusCode);
if(statusType!=null)
return statusType.getStatusName();
else
return "Empty";
}
public String returnPackagetName(Integer pkgCode){
packageType =packagesTypeDAO.findPackagesTypeByIdPackage(pkgCode);
if(packageType!=null)
return packageType.getName();
else
return "Not Available";
}
@Override
public void postConstruct() {
// TODO Auto-generated method stub
statusType= new StatusType();
}
public void setStatusValues(int statusId){
System.out.println("statusId "+statusId);
statusType = new StatusType();
statusType = loadStatusTypeByPrimaryKey(statusId);
System.out.println("statusType" + statusType);
System.out.println("Ja ku jam ketu");
setSatusType(statusType);
}
public int setMaxStatusType(){
int statusTypeNo=statusTypeService.countStatusTypeMax();
statusType = new StatusType();
System.out.println("statusTypeNo " +statusTypeNo);
statusType.setSid(statusTypeNo);
return statusTypeNo;
}
@Transactional
public void saveStatusType(StatusType statustype) {
logger.info("Saving Status Type: "+statustype.toString());
FacesMessage message = null;
FacesContext context = FacesContext.getCurrentInstance();
boolean save=false;
try {
//crmNotesService.saveCrmNotes(crmNotes);
statusTypeService.saveStatusType(statustype);
logger.info("Saving...");
//statustype.unset();
//statusType.setSid(statusTypeService.countStatusTypeMax());
//
//statustype.setSid(statusTypeService.countStatusTypes());
save = true;
}
catch(Exception e)
{
logger.info("FAILED during saving...");
logger.info("Excpetions are: "+e.toString());
throw e;
}
if(save) {
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "OK!","Saved Succesfully !");
} else {
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Error!", "Unable to save !");
}
context.addMessage(null,message );
}
}
调用函数的xmthl文件
<h:form style="width: auto !important;padding-top: 5px;">
<p:accordionPanel>
<p:tab title="#{usersmsgs['custdet.lmenu.geninfo']}">
<p:panelGrid columns="2" style="width:100%;">
<h:outputText value="#{usersmsgs['custdet.lmenu.cif']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().customerNo}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.hostbr']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().localBranch}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.namesurn']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().customerName}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.fathname']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().fatherName}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.birthday']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().birthday}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.age']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().age}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.gender']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().gender}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.city']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().city}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.education']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().education}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.profession']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().profession}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.workcomp']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().workingCompany}" />
</p:panelGrid>
</p:tab>
<p:tab title="#{usersmsgs['custdet.lmenu.contactinfo']}">
<p:panelGrid columns="2" style="width:100%;" >
<h:outputText value="#{usersmsgs['custdet.lmenu.address']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().address}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.email']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().email}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.telno']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().telNo}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.mobno']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().mobNo}" />
</p:panelGrid>
</p:tab>
<p:tab title="#{usersmsgs['custdet.lmenu.bankinfo']}">
<p:panelGrid columns="2" style="width: auto !important;padding-top: 2cm;padding-bottom: 70%;">
<h:outputText value="#{usersmsgs['custdet.lmenu.packagesSegment']}" />
<h:outputText value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment)}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.personalincome']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().personalIncome}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.monthlysal']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().monthlySalary}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.actualexpother']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().exposureOtherBanks}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.actualexpoaba']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().exposureAba}" />
</p:panelGrid>
</p:tab>
</p:accordionPanel>
</h:form>
问题出在这一行
<h:outputText value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment)}" />
并且日志显示正在查找的方法接受 String 参数
returnPackagetName(java.lang.String)
而您的 bean 中的方法接受 Integer
returnPackagetName(Integer pkgCode)
我正在开发一个使用 Primefaces JSF 的 Web 应用程序,在前端使用托管 bean,在后端使用 SQL 服务器。我已经开发该应用程序 2 个月了,并在我们办公室的不同环境中对其进行了测试。不同的环境是指不同的 java 7 版本和 Tomcat 7 版本,一切都运行良好。 试图从我的家用 PC 继续开发,但现在出现错误
javax.el.ELException: /custsession_detailed.xhtml @67,122 value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment) }": 找不到方法: class al.durandal.com.jsf.IdToStringTypeComponent.returnPackagetName(java.lang.String)
我 100% 确定方法就在那里。在这两种环境中,Java 版本和 Tomcat 版本是相同的。
package al.durandal.com.jsf;
@ManagedBean(name="IdToString")
@ViewScoped
public class IdToStringTypeComponent extends ManagedComponent {
/**
*
*/
private static final long serialVersionUID = -233667982117424411L;
private PackagesType packageType;
private StatusType statusType;
private static Logger logger =Logger.getLogger(IdToStringTypeComponent.class.getName());
@Autowired
private transient StatusTypeDAO statusTypeDAO;
@Autowired
private transient StatusTypeService statusTypeService;
@Autowired
private transient PackagesTypeDAO packagesTypeDAO;
public List<StatusType> listAllStatusTypes(){
return new java.util.ArrayList<StatusType>(statusTypeDAO.findAllStatusTypes());
}
public StatusType getStatusType() {
return statusType;
}
public void setSatusType(StatusType statType) {
this.statusType = statType;
}
@Transactional
public StatusType loadStatusTypeByPrimaryKey(Integer sidKey) {
statusType = statusTypeDAO.findStatusTypeByPrimaryKey(sidKey);
return statusType;
}
public String returnProductName(Integer statusCode){
statusType=statusTypeDAO.findStatusTypeByPrimaryKey(statusCode);
if(statusType!=null)
return statusType.getStatusName();
else
return "Empty";
}
public String returnPackagetName(Integer pkgCode){
packageType =packagesTypeDAO.findPackagesTypeByIdPackage(pkgCode);
if(packageType!=null)
return packageType.getName();
else
return "Not Available";
}
@Override
public void postConstruct() {
// TODO Auto-generated method stub
statusType= new StatusType();
}
public void setStatusValues(int statusId){
System.out.println("statusId "+statusId);
statusType = new StatusType();
statusType = loadStatusTypeByPrimaryKey(statusId);
System.out.println("statusType" + statusType);
System.out.println("Ja ku jam ketu");
setSatusType(statusType);
}
public int setMaxStatusType(){
int statusTypeNo=statusTypeService.countStatusTypeMax();
statusType = new StatusType();
System.out.println("statusTypeNo " +statusTypeNo);
statusType.setSid(statusTypeNo);
return statusTypeNo;
}
@Transactional
public void saveStatusType(StatusType statustype) {
logger.info("Saving Status Type: "+statustype.toString());
FacesMessage message = null;
FacesContext context = FacesContext.getCurrentInstance();
boolean save=false;
try {
//crmNotesService.saveCrmNotes(crmNotes);
statusTypeService.saveStatusType(statustype);
logger.info("Saving...");
//statustype.unset();
//statusType.setSid(statusTypeService.countStatusTypeMax());
//
//statustype.setSid(statusTypeService.countStatusTypes());
save = true;
}
catch(Exception e)
{
logger.info("FAILED during saving...");
logger.info("Excpetions are: "+e.toString());
throw e;
}
if(save) {
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "OK!","Saved Succesfully !");
} else {
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Error!", "Unable to save !");
}
context.addMessage(null,message );
}
}
调用函数的xmthl文件
<h:form style="width: auto !important;padding-top: 5px;">
<p:accordionPanel>
<p:tab title="#{usersmsgs['custdet.lmenu.geninfo']}">
<p:panelGrid columns="2" style="width:100%;">
<h:outputText value="#{usersmsgs['custdet.lmenu.cif']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().customerNo}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.hostbr']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().localBranch}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.namesurn']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().customerName}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.fathname']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().fatherName}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.birthday']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().birthday}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.age']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().age}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.gender']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().gender}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.city']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().city}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.education']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().education}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.profession']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().profession}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.workcomp']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().workingCompany}" />
</p:panelGrid>
</p:tab>
<p:tab title="#{usersmsgs['custdet.lmenu.contactinfo']}">
<p:panelGrid columns="2" style="width:100%;" >
<h:outputText value="#{usersmsgs['custdet.lmenu.address']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().address}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.email']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().email}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.telno']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().telNo}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.mobno']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().mobNo}" />
</p:panelGrid>
</p:tab>
<p:tab title="#{usersmsgs['custdet.lmenu.bankinfo']}">
<p:panelGrid columns="2" style="width: auto !important;padding-top: 2cm;padding-bottom: 70%;">
<h:outputText value="#{usersmsgs['custdet.lmenu.packagesSegment']}" />
<h:outputText value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment)}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.personalincome']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().personalIncome}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.monthlysal']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().monthlySalary}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.actualexpother']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().exposureOtherBanks}" />
<h:outputText value="#{usersmsgs['custdet.lmenu.actualexpoaba']}" />
<h:outputText value="#{SearchComponent.returnCustomerProfile().exposureAba}" />
</p:panelGrid>
</p:tab>
</p:accordionPanel>
</h:form>
问题出在这一行
<h:outputText value="#{IdToString.returnPackagetName(SearchComponent.returnCustomerProfile().packagesSegment)}" />
并且日志显示正在查找的方法接受 String 参数
returnPackagetName(java.lang.String)
而您的 bean 中的方法接受 Integer
returnPackagetName(Integer pkgCode)