- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在运行 Spring MVC 项目,并且收到此“HTTP 状态 500 - 内部服务器错误”,其中包含以下信息:
type: Exception report
message: Internal Server Error
description: The server encountered an internal error that prevented it from fulfilling this request.
exception:
org.apache.jasper.JasperException: org.springframework.beans.NotReadablePropertyException: Invalid property 'personal' of bean class [com.demo.7d0.Members]: Bean property 'personal' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
root cause:
org.springframework.beans.NotReadablePropertyException: Invalid property 'personal' of bean class [com.demo.7d0.Members]: Bean property 'personal' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
我尝试清除网络浏览器的缓存和 Cookie(FireFox 和 Chrome),但此错误并没有消失。
我在 GlassFish 4 上运行此项目。我在 Tomcat 8 上也收到了相同的“HTTP 状态 500 - 内部服务器错误”。
“Members.java”类:
public class Members {
@NotEmpty(message = "* 'First Name' is required!")
@Size(min = 2, max = 30)
public String firstName;
@NotEmpty(message = "* 'Middle Name' is required!")
public String middleName;
@NotEmpty(message = "* 'Last Name' is required!")
public String lastName;
@Pattern(regexp = "^([Male]{4})|([Femal]{6})$", message = "* Please select a gender!")
public String gender;
@Pattern(regexp = "^[0-2]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$", message = "* Invalid date of birth. Please follow the provided example!")
public String dob;
@Pattern(regexp = "^[\\w\\-]+(\\.[\\w\\-]+)*@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}$", message = "* E-mail address is not correct!")
@NotEmpty(message = "* E-mail address is required!")
public String emailAddress;
@Pattern(regexp = "^[0-9]{4,4}$", message = "* 'Last 4 digits of SSN' has an incorrect format. Please follow the provided example!")
public String last4digitsSSN;
@Pattern(regexp = "^([0-9]{1}\\s?\\-\\s?)?\\(\\d{3}\\)\\s?\\d{3}\\s?\\-\\s?\\d{4}$", message = "* 'Phone Number' has an incorrect format. Please follow the provided example!")
public String phoneNumber;
@Pattern(regexp = "^([MobilePhn\\s]{12})|([HomePhn\\s]{10})|([WorkPhne\\s]{10})$", message = "* Please select a phone type!")
public String phoneType;
@Pattern(regexp = "^([Student]{7})|([Profes]{9})|([Cashier]{7})|([OficeClrk\\s]{12})|([Manger]{7})|([Superviso]{10})|([Acounta]{10})|([Other]{5})$", message = "* Please select an occupation!")
public String occupation;
@Pattern(regexp = "^([Yes]{3})|([No]{2})$", message = "* Are you US Citizen? Please answer!")
public String usCitizen;
@Pattern(regexp = "^([Yes]{3})|([No]{2})$", message = "* Are you at least 18 years old? Please answer!")
public String atLeast18YrsOld;
@Pattern(regexp = "^[a-zA-Z0-9\\s\\.\\'\\-]{2,35}$", message = "* Invalid address!")
@NotEmpty(message = "* Address is Required!")
private String address1;
//@Pattern(regexp = "^[a-zA-Z0-9\\s\\.\\'\\-]$", message = "* Invalid address!")
private String address2;
//@Pattern(regexp = "^[a-zA-Z0-9\\s\\.\\'\\-]$", message = "* Invalid address!")
private String address3;
@Pattern(regexp = "^[a-zA-Z\\.\\s\\-\\']{1,18}$", message = "* Invalid name for city field!")
@NotEmpty(message = "* Please enter a name for city field!")
private String city;
@Pattern(regexp = "^[a-zA-Z\\s\\-\\']{1,15}$", message = "* Invalid name for state field!")
@NotEmpty(message = "* Please enter a name for state field!")
private String state;
//@Pattern(regexp = "^([0-9]{5,5}|([0-9-]{10,10}))", message = "Postcode is not correct!")
@Pattern(regexp = "^\\d{5}([\\-\\d]{5})?$", message = "* Postcode is not correct!")
private String zipcode;
@Pattern(regexp = "^[a-zA-Z\\.\\s\\-\\']{1,25}$", message = "* Invalid name for country field!")
@NotEmpty(message = "* Please enter a name for country field!")
private String country;
@Size(min = 2, max = 30)
private String usrnm;
@Size(min = 2, max = 30)
private String pwd;
@Pattern(regexp = "^([Mr\\.]{3})|([Mrs\\.]{4})|([Ms\\.]{3})$", message = "* Please select a title!")
@NotEmpty(message="* Title is required!")
private String title;
private String comment;
@Pattern(regexp = "^[0-2]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$", message = "* Invalid date of registration. Please follow the provided example!")
private String registrationDate;
@Pattern(regexp = "^[A-Z]{1}([a-zA-Z]{1})?[A-Z]{1}$", message = "* Initials has an incorrect format. Please follow the provided example!")
@NotEmpty(message = "* Initials is required!")
@Size(min = 1, max = 3, message = "* Initials size must be between 1 character & 3 characters!")
private String initials;
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getMiddleName() {
return middleName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLastName() {
return lastName;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getGender() {
return gender;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getDob() {
return dob;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public String getEmailAddress() {
return emailAddress;
}
public void setLast4digitsSSN(String last4digitsSSN) {
this.last4digitsSSN = last4digitsSSN;
}
public String getLast4digitsSSN() {
return last4digitsSSN;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
public String getPhoneType() {
return phoneType;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
public String getOccupation() {
return occupation;
}
public void setUsCitizen(String usCitizen) {
this.usCitizen = usCitizen;
}
public String getUsCitizen() {
return usCitizen;
}
public void setAtLeast18YrsOld(String atLeast18YrsOld) {
this.atLeast18YrsOld = atLeast18YrsOld;
}
public String getAtLeast18YrsOld() {
return atLeast18YrsOld;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress1() {
return address1;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getAddress2() {
return address2;
}
public void setAddress3(String address3) {
this.address3 = address3;
}
public String getAddress3() {
return address3;
}
public void setCity(String city) {
this.city = city;
}
public String getCity() {
return city;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}
public String getZipcode() {
return zipcode;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountry() {
return country;
}
public void setUsrnm(String usrnm) {
this.usrnm = usrnm;
}
public String getUsrnm() {
return usrnm;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getPwd() {
return pwd;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getComment() {
return comment;
}
public void setRegistrationDate(String registrationDate) {
this.registrationDate = registrationDate;
}
public String getRegistrationDate() {
return registrationDate;
}
public void setInitials(String initials) {
this.initials = initials;
}
public String getInitials() {
return initials;
}
@Autowired
DataSource sqlserverDataSrc;
public void insert(String title, String firstName, String middleName,
String lastName, String gender, Date dob,
String emailAddress, int last4digitsSSN, String phoneNum,
String phoneType, String address1, String address2,
String address3, String city, String state,
String postcode, String country, String usrnm,
String pwd, String occupation, boolean usCitizen,
boolean atLeast18yrsOld, String comment, Date registrationDate,
String initials) {
String sqlQuery = "INSERT INTO Members "
+ "VALUES(?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?, ?, ?," +
" ?);";
JdbcTemplate jdbcTemplate = new JdbcTemplate(sqlserverDataSrc);
jdbcTemplate.update(sqlQuery, new Object[] {title, firstName, middleName,
lastName, gender, dob,
emailAddress, last4digitsSSN, phoneNum,
phoneType, address1, address2,
address3, city, state,
postcode, country, usrnm,
pwd, occupation, usCitizen,
atLeast18yrsOld, comment, registrationDate,
initials});
}
public void delete(String usrnm, String pwd, int last4digitsSSN) {
String sqlQuery = "DELETE FROM Members WHERE usrnm = '" + usrnm
+ "' AND pwd = '" + pwd
+ "' AND last4digitsSSN = " + last4digitsSSN + ";";
JdbcTemplate jdbcTemplate = new JdbcTemplate(sqlserverDataSrc);
jdbcTemplate.update(sqlQuery);
}
public void update(String usrnm, String pwd, int last4digitsSSN) {
String sqlQuery = "UPDATE Members SET pwd = ? WHERE usrnm = ? AND last4digitsSSN = ?";
JdbcTemplate jdbcTemplate = new JdbcTemplate(sqlserverDataSrc);
jdbcTemplate.update(sqlQuery, new Object[] {pwd, usrnm, last4digitsSSN});
}
}
'spring-servlet.xml'文件:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:annotation-config />
<!-- declaring base package -->
<context:component-scan base-package="com.demo.7d0" />
<mvc:annotation-driven />
<mvc:resources mapping="/CSS/**" location="/CSS/" />
<bean id="ViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/Views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="sqlserverDataSrc"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://7d0\SQLSERVER:1433;databaseName=demo" />
<property name="username" value="sa" />
<property name="password" value="pwd" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages"></property>
</bean>
</beans>
我应该如何修复这个错误?谢谢!
最佳答案
错误消息非常清楚:
Invalid property 'personal' of bean class [com.demo.7d0.Members]: Bean property 'personal' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
在代码中的某个位置,您尝试访问 Members
类的此属性。在代码中搜索此位置以解决问题。
因为您发布的 Members
类中没有 personal
字段,我猜您在代码中混淆了某些内容,并且可能想访问不同类中的字段.
关于java - 如何修复 'HTTP Status 500 - Internal Server Error' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28423609/
我对文档有点困惑。请纠正我。 git 状态- 显示当前本地工作目录状态 git status -u- 显示未跟踪的文件(也是本地的) git 状态 -uno- 不显示未跟踪的文件(也是本地的)?? 后
我有一个具有 12 个虚拟机资源的 ARM 模板。每个虚拟机都有 1 个与其关联的 CustomLinuxScript 扩展资源。 某些 CustomLinuxScript 扩展失败并出现错误:状态文
我有一个具有 12 个虚拟机资源的 ARM 模板。每个虚拟机都有 1 个与其关联的 CustomLinuxScript 扩展资源。 某些 CustomLinuxScript 扩展失败并出现错误:状态文
我有以下 JavaScript 代码: alert(data.status); data 是一个 JSON 对象,其字段之一是 status ( bool 字段)。 当JSON.stringify(d
我在验证表单时遇到此错误,如何解决它。 代码: app.post('/',[ check('username','Error occured in Username').trim().isEmai
我正在开发一个使用 fork() exec() wait() 的 C 程序。第一个进程有以下代码: int main(int argc, const char * argv[]) { // inser
我想在 git status 上运行 linter,但是似乎没有 pre-status 和 post-status Hook 。 如何给 git 添加一个钩子(Hook)? fine docs对此事保
我需要获取所有 current_user.friends 状态,然后按 created_at 对它们进行排序。 class User a.created_at } end current_user.
我在 Eloquent 中使用 orWhere 时遇到问题。 我有一个团队,这个团队有一些资料。我想获取状态 = 1 或状态 = 2 的所有配置文件。但我无法让它工作。 我的代码是这样的: $prof
http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT 根据这
我们在 IIS 6.0 上托管 WCF 服务的服务器之一上观察到以下行为: IIS 日志显示所用时间的值较高 (> 100000) HTTP 状态码是 200 sc-win32-status 代码显示
在 Dynamics CRM 中,潜在客户实体同时具有状态和状态原因。使用 API 我可以获得所有状态原因。我被绊倒的地方是当我的用户选择状态原因时我想倒退并找出哪个状态与所选状态原因相关联。 以下是
我很好奇返回响应和仅创建响应的区别。 我见过大量使用 return res.status(xxx).json(x) 的代码示例和res.status(xxx).json(x) . 谁能详细解释一下两者
文档并没有真正说明 status 是什么。 status 到底是什么? http://man7.org/linux/man-pages/man2/exit_group.2.html 最佳答案 来自ex
An earlier question导致了一些关于如何检查 Git 存储库是否包含脏索引或未跟踪文件的想法。我从那次讨论中采纳的答案如下: #!/bin/sh exit $(git status -
ECSHOP出现 XMlHttpRequest status:[500] Unknow status 这个错误 把/admin/templates/top.htm 这个文件中{insert_scr
我有以下代码用于通过 Twitter4J 获取推文: List statuses; Paging paging = new Paging(1, LIMIT); statuses = twitter.g
非常不言自明。我正在制作一个脚本并且遇到了被使用和解析的情况,但它们的输出似乎总是完全相同。 最佳答案 git status --branch --porcelain "显示分支的状态(ahead,
我有一张表,上面有如下记录 表A subid clickid status datetime 1 123 low 2018-07-24 20:20:44 2 123
如果确实缺少资源,我的 API 将返回以下内容 { "code": 404, "message": "HTTP 404 Not Found" } 当我使用代码 Response.sta
我是一名优秀的程序员,十分优秀!