Java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp


monkee
HOME » Java

I have a jrxml file. When I run that file in IReport Designer 4.8.0, Produces report without fail.
But when I deploy the same file in JasperServer 5.0.0, it throws exception.


The server has encountered an error. Please excuse the inconvenience.
Error Message
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp
Error Trace
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setTimestamp(JRJdbcQueryExecuter.java:605) at
net.sf.jasperreports.engine.query.JRJdbcQue

Related to : Java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp
Java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp
Java

I have a jrxml file. When I run that file in IReport Designer 4.8.0, Produces report without fail.
But when I deploy the same file in JasperServer 5.0.0, it throws exception.


The server has encountered an error. Please excuse the inconvenience.
Error Message
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp
Error Trace
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setTimestamp(JRJdbcQueryExecuter.java:605) at
net.sf.jasperreports.engine.query.JRJdbcQue
Gradle - Execution failed for task 'sonarAnalyze' - java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
Java

I have this error when running sonar with my gradle build script.


gradle sonarAnalyze


15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter]
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':sonarAnalyze'.
15:41:02.934 [ERROR] [org.gradle.BuildExceptionReporter] > java.util.ArrayList cannot be cast to java.lang.String
My sonar
sonar {
server {

java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List
23/11/2014 10:00 am Java

I have a List, which I am trying to use in 2 different ways...

private List<List<List<String>>>
mListSelectedsWeekDAY;

// technique 1
for(int t = 0; t < mListSelectedsWeekDAY.get(0).get(0).size();t++){
    ...
}

// technique 2
List<String> tmpList = mListSelectedsWeekDAY.get(0).get(0);

And my list is populated like this...

mListSelectedsSDAY = new
ArrayList<List<List<String>>>(); 
for (int i = 0; i < mListTimeBand.size(); i++) { 
    List<List<String>> tmp2 = new
ArrayList<List<String>>(); 
    for (int j = 0; j <
mListTimeBand.get(i).getTimeBandDefList().getTimeBandDefini().size();
j++) { 
        List<String> tmp1 = new ArrayList<String>(); 
        if
(mListTimeBand.get(i).getTimeBandDefList().getTimeBandDefini().get(j).isAllSpeci‌​alDays())
{ 
            for (int t = 0; t < mListSDayType.size(); t++) { 
                tmp1.add(mListSDayType.get(t).getSpecialDayName()); 
            } 
        }
        tmp2.add(tmp1); 
    }

    mListSelectedsSDAY.add(tmp2); 
}

However my code it always giving the following error...

java.lang.ClassCastException: [Ljava.lang.String; cannot be
cast to java.util.List

Could someone please help me understand why this is happening.


java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.****.db.*****
20/1/2015 7:30 am Java

I am new to spring framework. I am trying to POST JSON data using RESTClient (application/json). But I am getting the following error. (Spring version 3.2)

ERROR :

2015-01-20 10:22:33,262 ERROR
[org.jboss.ejb.plugins.LogInterceptor] RuntimeException in method:
public abstract com.**.db.TnPermissionGroup
com.***.ejb.UserManagerLocal.addPermissionGroup(com.***.db.TnPermissionGroup)
throws java.lang.Exception:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast
to com.***.db.TnPermission
    at
com.***.ejb.UserManagerEJB.addPermissionGroup(UserManagerEJB.java:521)
    at
com.***.ejb.UserManagerEJB.addPermissionGroup(UserManagerEJB.java:495)

JSON Format:

{  
   "name":"Test",
   "tnPermissions":[  
      {  
         "comp_id":{  
            "permGroupId":"2",
            "functionId":"100",
            "operationType":"5"
         },
         "allow":"1"
      }
   ]
}

Controller.java

 /**************** ADD PERMISSIONGROUP
**********************/

    
@RequestMapping(method=RequestMethod.POST,consumes="application/json")
     @ResponseStatus(HttpStatus.CREATED)
     public @ResponseBody Object addPermissionGroup(@RequestBody
PermissionGroupRequestCriteria
permissiongroupRequestCriteria,BindingResult bindingResult) throws
Exception{
         TnPermissionGroup grp = null;

        try{
           
permissiongroupValidator.validate(permissiongroupRequestCriteria,
bindingResult);
            if(bindingResult.hasErrors())
            {
                Map<String,String> fieldErrorMap = new
HashMap<String,String>();
                for(FieldError fieldError :
bindingResult.getFieldErrors())
                {
                     fieldErrorMap.put(fieldError.getField(),
fieldError.getDefaultMessage());
                }
                String localizedErrorMessage =
messageSource.getMessage("permissiongroup.insert.unsuccessful", null,
currentLocale);
                ErrorResponse resp =new
ErrorResponse(localizedErrorMessage);
                resp.setErrorMessages(fieldErrorMap);
                return new
ResponseEntity<ErrorResponse>(resp,HttpStatus.BAD_REQUEST);
            }


            grp = new
TnPermissionGroup(permissiongroupRequestCriteria.getPermGroupId(),permissiongroupRequestCriteria.getName(),permissiongroupRequestCriteria.getDescription(),permissiongroupRequestCriteria.getTnPermissions());

            grp = userDelegate.addPermissionGroup(grp);

        } catch(Exception e){
            String localizedErrorMessage =
messageSource.getMessage("permissiongroup.insert.unsuccessful", null,
currentLocale);
            ErrorResponse resp = new
ErrorResponse(localizedErrorMessage);
            return new
ResponseEntity<ErrorResponse>(resp,HttpStatus.BAD_REQUEST);
        }
        argumentsToReplace[0]= grp.getName();
        String localizedErrorMessage =
messageSource.getMessage("permissiongroup.insert.successful",
argumentsToReplace, currentLocale);
        EmptySuccessResponse resp = new
EmptySuccessResponse(localizedErrorMessage);
        resp.setResource(grp);
        return new ResponseEntity<EmptySuccessResponse>(resp,
HttpStatus.CREATED); 
    }

TnPermissionGroup.java

public class TnPermissionGroup implements Serializable {

    private Integer permGroupId;

    private String name;

    private String description;

    private Set tnPermissions;

    public TnPermissionGroup() {
    }

    public TnPermissionGroup(Integer permGroupId, String name, Set
tnPermissions) {
        this.permGroupId = permGroupId;
        this.name = name;
        this.tnPermissions = tnPermissions;
    }

    /** full constructor */
    public TnPermissionGroup(Integer permGroupId, String name, String
description, Set tnPermissions) {
        this.permGroupId = permGroupId;
        this.name = name;
        this.description = description;
        this.tnPermissions = tnPermissions;
    }

    public Integer getPermGroupId() {
        return this.permGroupId;
    }

    public void setPermGroupId(Integer permGroupId) {
        this.permGroupId = permGroupId;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set getTnPermissions() {
        return this.tnPermissions;
    }

    public void setTnPermissions(Set tnPermissions) {
        this.tnPermissions = tnPermissions;
    }

    public void addPermission(TnPermission perm)
    {
        if (tnPermissions == null) {
            tnPermissions = new HashSet();
        }
        tnPermissions.add(perm);
    }

}

TnPermission.java

  public class TnPermission implements Serializable {

        private com.***.db.TnPermissionPK comp_id;

        private Byte allow;

        /** full constructor */
        public TnPermission(com.***.db.TnPermissionPK comp_id, Byte
allow) {
            this.comp_id = comp_id;
            this.allow = allow;
        }

        /** default constructor */
        public TnPermission() {
        }

        /** minimal constructor */
        public TnPermission(com.***.db.TnPermissionPK comp_id) {
            this.comp_id = comp_id;
        }

        public com.***.db.TnPermissionPK getComp_id() {
            return this.comp_id;
        }

        public void setComp_id(com.***.db.TnPermissionPK comp_id) {
            this.comp_id = comp_id;
        }

        public Byte getAllow() {
            return this.allow;
        }

        public void setAllow(Byte allow) {
            this.allow = allow;
        }
    }

TnPermissionPK.java

public class TnPermissionPK implements Serializable {

    private Integer permGroupId;
    private Integer functionId;
    private Integer operationType;

    /** full constructor */
    public TnPermissionPK(Integer permGroupId, Integer functionId,
Integer operationType) {
        this.permGroupId = permGroupId;
        this.functionId = functionId;
        this.operationType = operationType;
    }

    /** default constructor */
    public TnPermissionPK() {
    }

    public Integer getPermGroupId() {
        return this.permGroupId;
    }

    public void setPermGroupId(Integer permGroupId) {
        this.permGroupId = permGroupId;
    }

    public Integer getFunctionId() {
        return this.functionId;
    }

    public void setFunctionId(Integer functionId) {
        this.functionId = functionId;
    }

    public Integer getOperationType() {
        return this.operationType;
    }

    public void setOperationType(Integer operationType) {
        this.operationType = operationType;
    }
}

Why JSON data POST is not parsing. I think JSON format is wrong. Help me please.




HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .