Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法进入指定的URL_Java_Http_Spring Boot - Fatal编程技术网

Java 无法进入指定的URL

Java 无法进入指定的URL,java,http,spring-boot,Java,Http,Spring Boot,我有个大问题。在添加另一个控制器(工作站点)之前,我可以进入以下URL: localhost:8080/api/user/10/vacation 但是现在,在添加一个正在侦听的新控制器之后:/api/user/{id}/worksite 我无法进入localhost:8080/api/user/10/vacation 我收到此错误异常: { "timestamp": "2018-08-02T19:02:40.432+0000", "status": 500, "error": "I

我有个大问题。在添加另一个控制器(
工作站点
)之前,我可以进入以下URL:

localhost:8080/api/user/10/vacation
但是现在,在添加一个正在侦听的新控制器之后:
/api/user/{id}/worksite
我无法进入
localhost:8080/api/user/10/vacation

我收到此错误异常:

{
  "timestamp": "2018-08-02T19:02:40.432+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "HHH000142: Bytecode enhancement failed: com.springproject27.springproject.user.User; nested exception is org.hibernate.HibernateException: HHH000142: Bytecode enhancement failed: com.springproject27.springproject.user.User",
  "path": "/api/user/10/vacation"
}

包含此路径的我的控制器是:

@RestController
@RequestMapping(value = "/api/user/{userId}/vacation", produces =    "application/json")
@CrossOrigin(origins = "http://localhost:8080")
@AllArgsConstructor
@NoArgsConstructor
public class VacationController {

@Autowired
private VacationService vacationService;


@GetMapping
public List<Vacation> getVacations(@PathVariable Long userId) {
    return vacationService.findAllByUserId(userId);
}
@RestController
@RequestMapping(value=“/api/user/{userId}/vacation”,products=“application/json”)
@交叉原点(原点=”http://localhost:8080")
@AllArgsConstructor
@诺尔格构装师
公共类假期控制员{
@自动连线
私人度假服务度假服务;
@GetMapping
公共列表getVacations(@PathVariable Long userId){
return vacationService.findAllByUserId;
}
我的假期服务,带有在controller中使用的注释和方法:

@Transactional
@Service
@AllArgsConstructor
@NoArgsConstructor
public class VacationService {

@Autowired
private VacationRepository vacationRepository;

@Autowired
private UserRepository userRepository;

@Autowired
private UserService userService;

public List<Vacation> findAllByUserId(Long userId) {
    return vacationRepository.findByUserId(userId);
}
@Transactional
@服务
@AllArgsConstructor
@诺尔格构装师
公务舱假期服务{
@自动连线
私人假期储存库假期储存库;
@自动连线
私有用户存储库用户存储库;
@自动连线
私人用户服务;
公共列表findAllByUserId(长用户ID){
return vacationRepository.findByUserId(userId);
}

您遇到了hibernate错误。添加更多代码您所做的我认为已经足够了?您的控制器上有假期列表吗?请尝试调试。我相信错误在您的服务上。是的,当我在本地主机上时:8080/api/user->我有假期。