• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.cinemasurvey.dao.entity.Logi

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Please helm me to handle this exception




log4j:WARN Please initialize the log4j system properly.
[TestNG] Running:
C:\User\AppData\Local\Temp\testng-eclipse--1736054659\testng-customsuite.xml

Hibernate: select login0_.LOGIN_ID as LOGIN1_23_0_, role1_.ROLE_ID as ROLE1_28_1_, login0_.AUDIT_CREATED_DT as AUDIT2_23_0_, login0_.AUDIT_MODIFIED_DT as AUDIT3_23_0_, login0_.EMPLOYEE_ID as EMPLOYEE12_23_0_, login0_.AUDIT_USER as AUDIT13_23_0_, login0_.IP_ADDRESS as IP4_23_0_, login0_.LAST_LOGIN_ATTEMPT as LAST5_23_0_, login0_.LAST_SUCCESSFUL_LOGIN as LAST6_23_0_, login0_.NO_OF_ATTEMPTS as NO7_23_0_, login0_.password as password23_0_, login0_.PASSWORD_EXP_DT as PASSWORD9_23_0_, login0_.AUDIT_ROLE as AUDIT14_23_0_, login0_.SECURITY_ANSWER as SECURITY10_23_0_, login0_.SECURITY_QUESTION_ID as SECURITY15_23_0_, login0_.username as username23_0_, role1_."ROLE" as ROLE2_28_1_, role1_.ROLE_STATUS_ID as ROLE3_28_1_ from Login login0_ inner join "ROLE" role1_ on login0_.AUDIT_ROLE=role1_.ROLE_ID
Hibernate: select employee0_.EMPLOYEE_ID as EMPLOYEE1_8_5_, employee0_.AUDIT_CREATED_DT as AUDIT2_8_5_, employee0_.AUDIT_MODIFIED_DT as AUDIT3_8_5_, employee0_.DESIGNATION_ID as DESIGNA11_8_5_, employee0_.dob as dob8_5_, employee0_.doj as doj8_5_, employee0_.AUDIT_USER as AUDIT12_8_5_, employee0_.EMPLOYEE_STATUS_ID as EMPLOYEE13_8_5_, employee0_.FIRST_NAME as FIRST6_8_5_, employee0_.gender as gender8_5_, employee0_.IP_ADDRESS as IP8_8_5_, employee0_.LAST_NAME as LAST9_8_5_, employee0_.MIDDLE_NAME as MIDDLE10_8_5_, employee0_.AUDIT_ROLE as AUDIT14_8_5_, designatio1_.DESIGNATION_ID as DESIGNAT1_6_0_, designatio1_.designation as designat2_6_0_, employee2_.EMPLOYEE_ID as EMPLOYEE1_8_1_, employee2_.AUDIT_CREATED_DT as AUDIT2_8_1_, employee2_.AUDIT_MODIFIED_DT as AUDIT3_8_1_, employee2_.DESIGNATION_ID as DESIGNA11_8_1_, employee2_.dob as dob8_1_, employee2_.doj as doj8_1_, employee2_.AUDIT_USER as AUDIT12_8_1_, employee2_.EMPLOYEE_STATUS_ID as EMPLOYEE13_8_1_, employee2_.FIRST_NAME as FIRST6_8_1_, employee2_.gender as gender8_1_, employee2_.IP_ADDRESS as IP8_8_1_, employee2_.LAST_NAME as LAST9_8_1_, employee2_.MIDDLE_NAME as MIDDLE10_8_1_, employee2_.AUDIT_ROLE as AUDIT14_8_1_, employeest3_.EMPLOYEE_STATUS_ID as EMPLOYEE1_16_2_, employeest3_.status as status16_2_, role4_.ROLE_ID as ROLE1_28_3_, role4_."ROLE" as ROLE2_28_3_, role4_.ROLE_STATUS_ID as ROLE3_28_3_, status5_.STATUS_ID as STATUS1_33_4_, status5_.status as status33_4_ from Employee employee0_ left outer join Designation designatio1_ on employee0_.DESIGNATION_ID=designatio1_.DESIGNATION_ID left outer join Employee employee2_ on employee0_.AUDIT_USER=employee2_.EMPLOYEE_ID left outer join EMPLOYEE_STATUS employeest3_ on employee2_.EMPLOYEE_STATUS_ID=employeest3_.EMPLOYEE_STATUS_ID left outer join "ROLE" role4_ on employee2_.AUDIT_ROLE=role4_.ROLE_ID left outer join Status status5_ on role4_.ROLE_STATUS_ID=status5_.STATUS_ID where employee0_.EMPLOYEE_ID=?
Hibernate: select designatio0_.DESIGNATION_ID as DESIGNAT1_6_0_, designatio0_.designation as designat2_6_0_ from Designation designatio0_ where designatio0_.DESIGNATION_ID=?
Hibernate: select securityqu0_.SECURITY_QUESTION_ID as SECURITY1_30_0_, securityqu0_.question as question30_0_ from SECURITY_QUESTION securityqu0_ where securityqu0_.SECURITY_QUESTION_ID=?
Hibernate: select employee0_.EMPLOYEE_ID as EMPLOYEE1_8_5_, employee0_.AUDIT_CREATED_DT as AUDIT2_8_5_, employee0_.AUDIT_MODIFIED_DT as AUDIT3_8_5_, employee0_.DESIGNATION_ID as DESIGNA11_8_5_, employee0_.dob as dob8_5_, employee0_.doj as doj8_5_, employee0_.AUDIT_USER as AUDIT12_8_5_, employee0_.EMPLOYEE_STATUS_ID as EMPLOYEE13_8_5_, employee0_.FIRST_NAME as FIRST6_8_5_, employee0_.gender as gender8_5_, employee0_.IP_ADDRESS as IP8_8_5_, employee0_.LAST_NAME as LAST9_8_5_, employee0_.MIDDLE_NAME as MIDDLE10_8_5_, employee0_.AUDIT_ROLE as AUDIT14_8_5_, designatio1_.DESIGNATION_ID as DESIGNAT1_6_0_, designatio1_.designation as designat2_6_0_, employee2_.EMPLOYEE_ID as EMPLOYEE1_8_1_, employee2_.AUDIT_CREATED_DT as AUDIT2_8_1_, employee2_.AUDIT_MODIFIED_DT as AUDIT3_8_1_, employee2_.DESIGNATION_ID as DESIGNA11_8_1_, employee2_.dob as dob8_1_, employee2_.doj as doj8_1_, employee2_.AUDIT_USER as AUDIT12_8_1_, employee2_.EMPLOYEE_STATUS_ID as EMPLOYEE13_8_1_, employee2_.FIRST_NAME as FIRST6_8_1_, employee2_.gender as gender8_1_, employee2_.IP_ADDRESS as IP8_8_1_, employee2_.LAST_NAME as LAST9_8_1_, employee2_.MIDDLE_NAME as MIDDLE10_8_1_, employee2_.AUDIT_ROLE as AUDIT14_8_1_, employeest3_.EMPLOYEE_STATUS_ID as EMPLOYEE1_16_2_, employeest3_.status as status16_2_, role4_.ROLE_ID as ROLE1_28_3_, role4_."ROLE" as ROLE2_28_3_, role4_.ROLE_STATUS_ID as ROLE3_28_3_, status5_.STATUS_ID as STATUS1_33_4_, status5_.status as status33_4_ from Employee employee0_ left outer join Designation designatio1_ on employee0_.DESIGNATION_ID=designatio1_.DESIGNATION_ID left outer join Employee employee2_ on employee0_.AUDIT_USER=employee2_.EMPLOYEE_ID left outer join EMPLOYEE_STATUS employeest3_ on employee2_.EMPLOYEE_STATUS_ID=employeest3_.EMPLOYEE_STATUS_ID left outer join "ROLE" role4_ on employee2_.AUDIT_ROLE=role4_.ROLE_ID left outer join Status status5_ on role4_.ROLE_STATUS_ID=status5_.STATUS_ID where employee0_.EMPLOYEE_ID=?
Hibernate: select employeest0_.EMPLOYEE_STATUS_ID as EMPLOYEE1_16_0_, employeest0_.status as status16_0_ from EMPLOYEE_STATUS employeest0_ where employeest0_.EMPLOYEE_STATUS_ID=?
FAILED: hqlTest
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.cinemasurvey.dao.entity.Login
at com.cinemasurvey.test.login.LoginDAOTest.hqlTest(LoginDAOTest.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)



 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall move this discussion to somewhere more appropriate; this location is for discussion about the conduct of the forum and website.
I have added code tags (not to the Exception printout, because the lines would be too long) and removed some of the excess balnk lines, and doesn't it look good now .

Obviously whatever you are returning from that method in line 34 isn't a Login. You would have to go through the method to work out what it really returns.
Why are you storing the password as a String? Even worse, in a Serializable object? That is a serious security hazard.
 
reply
    Bookmark Topic Watch Topic
  • New Topic