Javax. servlet. ServletException: [Ljava. lang. Object;

Source: Internet
Author: User
Tags apache tomcat
HTTP Status 500-

TypeException report

Message

Description The server encountered an internal error () that prevented it from fulfilling this request.

Exception

javax.servlet.ServletException: [Ljava.lang.Object;org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:709)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)com.zq.utils.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:24)

 

Root cause

java.lang.ClassCastException: [Ljava.lang.Object;com.zq.struts.user.action.UserAction.userLogin(UserAction.java:403)com.zq.struts.user.action.UserAction.doExecute(UserAction.java:118)com.zq.struts.action.BaseAction.execute(BaseAction.java:98)org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:709)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)com.zq.utils.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:24)

 

Note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

 

 

 

The following content is taken from the Internet)

String SQL = "select {P. *} from Personreg P where P. name =: name and P. password =: password ";
The collection returned by the list () method of the preceding Query stores the elements of the object array, which only stores the Personreg object.
It should be if (iterator. hasNext ()){
Object [] row = (Object []) iterator. next ();
Personreg personreg = (Personreg) row [0];
System. out. println (personreg. getId ());
}

In addition, String hql = "from Personreg P where P. name =: name and P. password =: password ", here, because your statement uses an alias. attribute name, so you must specify the alias before. Otherwise, the syntax is incorrect. Or you can use String hql = "from Personreg where name =: name and password =: password ".

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.