π SPRING ERRORS and SOLUTIONS π
org .springframework .web .util .NestedServletException : Request processing failed ; nested exception is org .modelmapper .MappingException : ModelMapper mapping errors :
1 ) Converter org .modelmapper .internal .converter .CollectionConverter @ 9 b93001 failed to convert java .util .List to java .util .List .
set modelMapper . getConfiguration ( ) . setAmbiguityIgnored ( true ) ;
Ref - [ Gist Thread ] ( https ://github.com/modelmapper/modelmapper/issues/239)
java .lang .ClassCastException : org .hibernate .hql .internal .ast .tree .SqlNode cannot be cast to org .hibernate .hql .internal .ast .tree .FromReferenceNode
if package name starts with in means change to com ( since in is reserved for IN India in Hibernate )
Error creating bean with name 'entityManagerFactory' : Invocation of init method failed ; nested exception is javax .naming .NameNotFoundException :
Caused by : org .springframework .beans .factory .NoSuchBeanDefinitionException : No qualifying bean of type 'javax.persistence.EntityManagerFactory' available
Check weather ypu have defined persistence . xml
Error configuring application listener of class org .springframework .web .context .ContextLoaderListener
Add maven dependencies in the projects web deployment assembly
StateTransferException : java .io .EOFException : Read past end of file
(or )
Could not write method invocation failure for method public abstract XYX on bean named abcBean for appname due to : java .io .NotSerializableException : xyzVo
Please Check xyzVo implements Serializable
Unable to locate appropriate constructor on class
Please Check for Constructer in the respective class and make sure it is in Public
javax .servlet .ServletException : Could not resolve view with name 'common_error' in servlet with name 'appServlet'
Please Check weather you have deployed latest war / ear or remove war / ear and redeploy
java .lang .IllegalArgumentException :org .hibernate .QueryException :NOT ALL named parameters have been SET :[ username ]
Please Check for the parameters set for the query
resultList . setParameter ( "username" , username ) ;
entityManager .merge (classname ); runs Select instead of Update
(or )
Transactional Required : update or delete
Please Check for the @Transactional Annotation in Service Impl
Hibernate - Batch update returned unexpected row count from update : 0 actual row count : 0 expected : 1
It also can happen when you tries to UPDATE a PRIMARY KEY .
java .sql .SQLException Parameter index out of range (1 > number of parameters , which is 0 )
Please Check for Entity Class Weather all the Field names Given Correctly
@Column ( name = " ' REGISTRATION_NO '" ) this also cause this error
private String registrationNo ;
List view Not Sowing Properly in Production But works Perfect in Staging /Local
Please Check for the select Query , If it has Cross Joins without Condtions / AND Conditions then it Wont work in Production
Remove unwanted cross joins or Add Conditions
errors .rejectValue ("Class.studentName" , "" ,"Enter proper Student Name" ); //Displays Error Messages as studentName Instead of Enter proper Student Name
if error code is Empty then it looks for . Property File for the Correspondent field Class . studentName i . e Student Name if no correspondent file found then it returns the default Message
So use errors . rejectValue ( "Class.studentName" , "Class.studentName.errorMessage" , "Enter proper Student Name" ) ;
In PropertiesFiles
Class . studentName = studentName
Class . studentName . errorMessage = Enter proper Student Name refer interface MessageSource for more details
Not enough space to render crosstab
Check the Jasper Report for the CrossTab Table
javax .persistence .TransactionRequiredException : Executing an update /delete query
for Every Add , Delete , Update Add this Annotation in ServivceImpl
@Transactional ( propagation = Propagation . REQUIRED , rollbackFor = Exception . class , readOnly = false )
Servlet .service () for servlet XYZ threw exception : java .lang .OutOfMemoryError : PermGen space
Restart the Server to Clear the memory
Exception .ServiceException : : A different object with the same identifier value was already associated with the session
Entity With AutoIncrement Doesent Have a Annotaions @GeneratedValue ( strategy = GenerationType . IDENTITY )
Clean and Refresh the project Files
Break points Not Working Properyly .....
Check weather the App and Web Servers Runs in Debug Mode or Try CTRL + ALT + B in eclipse
javax .resource .ResourceException : Could not create connection ....
com .mysql .jdbc .exceptions .jdbc4 .CommunicationsException : Communications link failure
Check the Data Base Connection ( mostly happens While Building War / Ear )
Caused by : com .mysql .jdbc .MysqlDataTruncation : Data truncation : Data too long for column 'XYZ' at row 1
Length of submitted data is larger than the kength of the Field in DataBase .
Neither BindingResult nor plain target object for bean name 'xyxBo' available as request attribute
Data is not available in DB / Data is Deleted for the Requsted Object in DataBase
( or )
Model View name is Incorrect