无法将[java.lang.String]类型的值转换为所需的[java.lang.Long]类型

无法将[java.lang.String]类型的值转换为所需的[java.lang.Long]类型,java,spring,hibernate,spring-mvc,spring-boot,Java,Spring,Hibernate,Spring Mvc,Spring Boot,我正在使用Java8和Spring4.3.1.RELEASE,Hibernate5.2.1.Final和MySQL在Wildfly 10服务器上运行 我有一些Java代码,当我在Windows机器上运行服务器时,这些代码正在工作。但是,由于我将完全相同的代码移动到MacOS(Sierra)机器上,我得到了以下结果 我得到以下错误: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: 无法将[

我正在使用
Java8
Spring4.3.1.RELEASE
Hibernate5.2.1.Final
MySQL
Wildfly 10
服务器上运行

我有一些Java代码,当我在Windows机器上运行服务器时,这些代码正在工作。但是,由于我将完全相同的代码移动到MacOS(Sierra)机器上,我得到了以下结果

我得到以下错误

org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: 无法将[java.lang.String]类型的值转换为所需类型 [java.lang.Long];嵌套异常为java.lang.NumberFormatException: 对于输入字符串:“null”

在我看来,由于将
字符串
分配给
,似乎出现了错误。正如您在下面的代码中所看到的,
avatar
列是一个带有
@Lob
注释的
字节[]

更多详情:

19:07:23,287 WARN  [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] (default task-3) Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Long]; nested exception is java.lang.NumberFormatException: For input string: "null"
19:07:23,423 WARN  [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] (default task-5) Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Failed to decode VALUE_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character ':' (code 0x3a) in base64 content
 at [Source: java.io.PushbackInputStream@57905ec8; line: 19, column: 20]
 at [Source: java.io.PushbackInputStream@57905ec8; line: 19, column: 13] (through reference chain: com.jobs.spring.domain.Person["avatar"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Failed to decode VALUE_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character ':' (code 0x3a) in base64 content
 at [Source: java.io.PushbackInputStream@57905ec8; line: 19, column: 20]
 at [Source: java.io.PushbackInputStream@57905ec8; line: 19, column: 13] (through reference chain: com.jobs.spring.domain.Person["avatar"])
19:07:29,140 INFO  [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (default task-6) HHH000397: Using ASTQueryTranslatorFactory
我的代码如下:

Person.java

import javax.persistence.*;
    ...

@Entity
@Table(name = "person")
@XmlRootElement(name = "person")
public class Person extends AbstractDomain<Long> {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Size(min = 1, max = 45)
    @Column(name = "UID")
    private String uid;

    @Basic(fetch = FetchType.LAZY)
    @Lob
    @Column(name = "AVATAR", nullable = true)
    private byte[] avatar;

    @XmlElement
    public byte[] getAvatar() {
        return avatar;
    }

    public void setAvatar(byte[] avatar) {
        this.avatar = avatar;
    }
}
import javax.persistence.*;
...
@实体
@表(name=“person”)
@XmlRootElement(name=“person”)
公共类Person扩展了抽象域{
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
私人长id;
@尺寸(最小值=1,最大值=45)
@列(name=“UID”)
私有字符串uid;
@基本(fetch=FetchType.LAZY)
@高球
@列(name=“AVATAR”,nullable=true)
私有字节[]化身;
@XmlElement
公共字节[]getAvatar(){
返回化身;
}
公共void setAvatar(字节[]avatar){
this.avatar=化身;
}
}
MySQL人员表


非常感谢您的帮助。

它说您提供的输入字符串为空,所以这就是为什么您会得到数字格式例外。您是对的。为这个简单的问题道歉。我认为问题在于我的客户端正在向RESTful服务传递一个空值。
base64内容中的非法字符“:”(代码0x3a)
它表示您提供的输入字符串为空,所以这就是为什么您得到一个数字格式例外您是对的。为这个简单的问题道歉。我认为问题在于我的客户端正在向RESTful服务传递空值。
base64内容中的非法字符“:”(代码0x3a)