小编Mik*_*ike的帖子

ERRO [0044]无法拨打gRPC:无法连接到Docker守护程序

我正在使用Windows 10 Home,连接到docker时出现此错误:

ERRO[0044] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial tcp 192.168.99.101:2376: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
context canceled
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?我见过适用于Linux和OS的解决方案,但不适用于Windows

docker docker-machine

6
推荐指数
1
解决办法
1278
查看次数

如何在 spring 中过滤 PageRequest

当我对数据库中的所有新闻发出请求时,我使用这样的 PageRequest:

public Page<StatusUpdate> getPageSiteUser(int pageNumber) {

    PageRequest request = new PageRequest(pageNumber-1, pageSize, Sort.Direction.DESC, "added");

    return statusUpdateDao.findAll(request);
}
Run Code Online (Sandbox Code Playgroud)

它以完美的顺序显示每个页面中的所有新闻。

但是现在,我想选择一个用户创建的新闻,采用相同的 Pageable 格式(不是所有新闻),但我不知道该怎么做,所以我一定是在某处犯了一个愚蠢的错误......应该是就像是...

 public Page<StatusUpdate> findMyStatusUpdates(Long user_id, int pageNumber) {

    PageRequest request = new PageRequest(pageNumber-1, pageSize, Sort.Direction.DESC, "added"); 
    return statusUpdateDao.findAll(request);
}
Run Code Online (Sandbox Code Playgroud)

如果可以,请回答该理论的链接。文档讨论排序,而不是进行实际选择(在此处输入链接描述

spring spring-data-jpa

5
推荐指数
1
解决办法
2万
查看次数

Jhipster jdl生成后如何将H2数据库重置为原始状态?

我有一个使用生成器yo jhipster:import-jdl在Jhipster中运行的项目。结束时,一切都准备就绪,可以开始使用了。这是我想在H2永久磁盘副本中轻松进行测试,更改等操作以重新开始时要返回的状态。

我猜想每次启动项目时使用H2非永久性内存都会创建所有内容,但是有没有简单的方法可以将结果作为磁盘永久性类型呢?(请确认)

或者,更好的方法是,在启动项目之前,有没有办法让Jhipter随意地从内存更改为持久性数据库,再更改为内存持久性?

如果没有办法随意更改,我用谷歌搜索了一个解决方案,看来我应该定期删除所有对象重置嵌入式H2数据库 ,然后我不知道该怎么做才能获得一个干净的数据库。

java h2 jhipster jdl

4
推荐指数
1
解决办法
1915
查看次数

类型“string”不可分配给类型“Moment”错误

我有一个这样的对象:

import { Moment } from 'moment';

export interface INewsletter {
    id?: number;
    creationDate?: Moment;
    email?: string;
}

export class Newsletter implements INewsletter {
    constructor(public id?: number, public creationDate?: Moment, public email?: string) {}
}
Run Code Online (Sandbox Code Playgroud)

在一个地方,我需要从我正在使用的表单中获取日期,但在第二种情况下,这给我带来了问题,我只需要从系统获取日期并在新创建的对象中使用它(没有错误,我不明白,因为日期也是一个时刻)。

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as moment from 'moment';
import { DATE_TIME_FORMAT } from 'app/shared/constants/input.constants';

import { INewsletter } from 'app/shared/model/newsletter.model'; …
Run Code Online (Sandbox Code Playgroud)

momentjs typescript angular

4
推荐指数
1
解决办法
1万
查看次数

Spring 异常:MethodArgumentTypeMismatchException

我遇到了我不明白的异常。我有一个控制器,它给我一个新闻对象,它出现在控制台中,所以获取实际的新闻对象不是问题,

@RequestMapping(value ="/viewonestatus/{id}")
public ModelAndView viewOneStatus(@PathVariable("id") Long id) {

    System.out.println("!!!!!! STATUSUPDATECONTROLLER: viewOneStatus : Empezamos con el ID del Anuncio: " + id);

    StatusUpdate status = statusUpdateService.get(id);

    ModelAndView modelAndView = new ModelAndView();
    System.out.println("!!!!!! STATUSUPDATECONTROLLER: viewOneStatus : Empezamos con el ID del Anuncio: " + status);

    modelAndView.getModel().put("status", status);

    modelAndView.setViewName("viewonestatus");

    return modelAndView;
}
Run Code Online (Sandbox Code Playgroud)

.... 但是当尝试执行 JSP 时,它给了我以下错误,即使 JSP 几乎是空的,例如....

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

hello world

Exception: Exception: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed …
Run Code Online (Sandbox Code Playgroud)

spring exception

3
推荐指数
1
解决办法
2万
查看次数

长参数不存在错误

我收到一个奇怪的错误,我不明白为什么...因为它说找不到的 id 在 URL 中:http://192.168.160.128:8080/deleteproposal /4 并且我有类似的 requestMethod,工作正常。 ..

异常:org.springframework.web.bind.MissingServletRequestParameterException:必需的长参数“id”不存在失败的URL: http: //192.168.160.128 :8080/deleteproposal/4异常消息:必需的长参数“id”不存在

        org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:251)

        org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:96)

        org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:99)

        org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)

        org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)

        org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

        org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)

        org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)

        org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)

        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)

        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

        org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)

        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)

        org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)

        org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

        org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)

        org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)

        org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

        org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)

        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

        org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

        org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

        org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)

        org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) …
Run Code Online (Sandbox Code Playgroud)

jsp spring-boot

3
推荐指数
1
解决办法
2万
查看次数

在spring jpa中处理数据库中的空值

这很好用:

@Repository
public interface VoteDao extends CrudRepository <Vote, Long> {

@Query(value = "select sum(points) from votes where siteuserid= ?1", nativeQuery = true)
int countBySiteUser(@Param("user") SiteUser user);
}
Run Code Online (Sandbox Code Playgroud)

除非在没有投票的情况下结果为NULL并且问题是我不知道如何处理检查何时为Null,因为当我问...时查询没有返回任何内容...

    System.out.println("!!!!: PROPOSAL VoteService: " + voteDao.countBySiteUser(user));
Run Code Online (Sandbox Code Playgroud)

它应该为该sysout打印Null值吗?DAO应该以NULL值回答,但事实并非如此.如果提供,我将能够处理该NULL,但它没有.

在此先感谢您的帮助!

java spring hibernate jpa

3
推荐指数
1
解决办法
2378
查看次数

如何将 Long 值转换为 LongFilter?

我试图将 Long 值(id)转换为使用 private LongFilter postId 的类 TagCriteria 的 LongFilter;创建一个可以用来查询的对象

public ResponseEntity<List<TagDTO>> getAllTags(TagCriteria criteria, Pageable pageable)
Run Code Online (Sandbox Code Playgroud)

但我不知道如何做到这一点,因为 Java 文档对我来说并不是很清楚。

public class TagCriteria implements Serializable {
    private static final long serialVersionUID = 1L;
    private LongFilter id;
    private StringFilter tagName;
    private LongFilter postId;

    public TagCriteria() {
    }
}
Run Code Online (Sandbox Code Playgroud)

可比较类型的过滤器类,可以解释小于/大于/等关系。它可以作为成员添加到条件类中,以支持以下查询参数:

  fieldName.equals = 42
  fieldName.specified = true
  fieldName.specified = false
  fieldName.in = 43,42
  fieldName.greaterThan = 41
  fieldName.lessThan = 44
  fieldName.greaterOrEqualThan = 42
  fieldName.lessOrEqualThan = 44
Run Code Online (Sandbox Code Playgroud)

由于类型转换的问题,应该使用后代类,其中泛型类型参数被具体化。

类型参数:

<FIELD_TYPE> the type of filter.

See also: …
Run Code Online (Sandbox Code Playgroud)

spring-boot jhipster

3
推荐指数
1
解决办法
2731
查看次数

JHipster JDL 中的 Instant 是什么?

在哪里可以找到有关 JDL 中的瞬间的信息?它与日期格式有何关系......?

除此之外: https: //www.jhipster.tech/jdl/

可用的字段类型和约束 以下是 JDL 支持的类型:

SQL          MongoDB    Cassandra   Validations
Instant      Instant    Instant     required

LocalDate   LocalDate   required    required
ZonedDateTime   ZonedDateTime       required
Run Code Online (Sandbox Code Playgroud)

谢谢

date jhipster localdate jdl

2
推荐指数
1
解决办法
4079
查看次数

错误:在使用 Jhipster 的 Postgres 中,“image”列的类型为 bytea,但表达式的类型为 oid

我在 GAE (Postgres 9.6) 上部署的 Jhipster 应用程序遇到此错误,但我没有在本地 DB H2 中遇到此错误:

common frames omitted Caused by: org.postgresql.util.PSQLException: ERROR: column "image" is of type bytea but expression is of type oid
Run Code Online (Sandbox Code Playgroud)

来自实体照片:

package es.mibar.web.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.time.Instant;

/**
 * A Photo.
 */
@Entity
@Table(name = "photo")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Photo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    @SequenceGenerator(name = …
Run Code Online (Sandbox Code Playgroud)

postgresql jhipster

2
推荐指数
1
解决办法
1万
查看次数