小编cgr*_*rim的帖子

Azure Docker compose 因环境部分而失败

我有一个在 Azure 中运行良好的docker-compose.yml脚本。但是当我添加带有两个变量的环境部分时,它会失败并出现以下错误:

2018-08-24 10:29:30.214 ERROR - Exception in multi-container config parsing: System.InvalidCastException: Specified cast is not valid.  
 at LWAS.Kube.ComposeFileParser.ParseContainer (System.Collections.Generic.KeyValuePair`2[TKey,TValue] service) [0x00152] in <029f376c1c6a4bb79892c2f60333c2d8>:0
 at LWAS.Kube.ComposeFileParser.ParseFile (System.String composeYaml) [0x000d2] in <029f376c1c6a4bb79892c2f60333c2d8>:0
 at LWAS.Kube.PodSpec.LoadSpecFromComposeYamlFile (System.String composeFile) [0x00000] in <029f376c1c6a4bb79892c2f60333c2d8>:0
 at LWAS.SiteStartInfoRepository.SetupPodSpecForMultiContainerApp (Microsoft.Web.Hosting.StartSiteContext ctx, LWAS.LinuxSiteStartInfo startInfo) [0x0000f] in <029f376c1c6a4bb79892c2f60333c2d8>:0
2018-08-24 10:29:30.215 ERROR - Start multi-container app failed
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml文件的简短内容为:

version: '3.3'

services:
  application:
    image: myregistry.azurecr.io/application:latest
    volumes:
      - application_data:/usr/local/application/data

  proxy:
    image: myregistry.azurecr.io/proxy:latest
    depends_on:
      - application
    environment:
      - NGINX_HOST=myapplication.azurewebsites.net
      - NGINX_PORT=80 …
Run Code Online (Sandbox Code Playgroud)

azure docker-compose azure-web-app-service azure-container-service

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

Micronaut 数据 DTO 投影与连接实体的属性

我将 Micronaut Data 与 JPA 一起使用,并且有两个实体。第一个是Recipe

@Entity
public class Recipe {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;

    @ManyToOne
    private Category category;

    @OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
    private Set<Step> steps;

// + other fields, getters and setters
}
Run Code Online (Sandbox Code Playgroud)

第二个是ParseErrorRecipe

@Entity
@Table(name = "parse_error")
public class ParseError implements Serializable {
    @Id
    @ManyToOne(fetch = FetchType.LAZY)
    private Recipe recipe;

    @Id
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "problem_area")
    private ProblemArea problemArea; …
Run Code Online (Sandbox Code Playgroud)

java jpa micronaut micronaut-data

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

什么时候在 Micronauts 中使用 @Singleton 和 @Prototype 合适?

我读到了很多关于单例模式的坏事(单例模式有什么不好?),但是,@Singleton在这个 Micronaut 文档中到处都使用它来说明控制反转https://docs.micronaut.io/1.3.0.M2/guide /index.html#ioc

什么时候使用合适@Singleton?例如,如果我有一个UserInfoService具有getUserInfo, createUserInfo,updateUserInfo方法,那么使用 是一个好主意吗@Singleton

另一个单独的问题是我何时使用@Prototype,因为如果我不对函数/类使用任何注释,那么默认情况下它不是原型(就像我在另一个类/函数中启动它的新实例一样)?

singleton design-patterns kotlin micronaut

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

如何在 micronaut GET 请求中将参数设置为不需要?

我需要在请求中将参数设置为“不需要”。

我试过:

 @Get(value = "/list/{username}")
 HttpResponse<?> list(String username, @QueryValue(value = "actionCode") String actionCode) {
     ...
 }
Run Code Online (Sandbox Code Playgroud)

当我发送请求http://localhost:8080/notification/list/00000000000时,会引发以下错误:

{
    "message": "Required Parameter [actionCode] not specified",
    "path": "/actionCode",
    "_links": {
        "self": {
            "href": "/notification/list/00000000000",
            "templated": false
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

micronaut micronaut-client micronaut-rest

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

Docker 无法运行 nodejs npm

当我在Dockerfile 中运行以下命令时:

FROM ruby:2.3

RUN apt-get update

RUN apt-get install nodejs npm -y

RUN apt-get install vim -y

RUN apt-get install memcached -y
Run Code Online (Sandbox Code Playgroud)

我得到以下错误:

将构建上下文发送到 Docker 守护进程 29.74MB

步骤 1/12:从 ruby​​:2.3

---> 09c6ceeef3bc

步骤 2/12:运行 apt-get 更新

---> 使用缓存

---> c41c3235c3ba

步骤 3/12:运行 apt-get install nodejs npm -y

---> 在 b0d407900cbd 中运行

正在阅读包裹清单...

构建依赖树...

读取状态信息...

**E: 无法定位包 npm

命令“/bin/sh -c apt-get install nodejs npm -y”返回非零代码:100**

请提出解决方案,在此先感谢您。

node.js npm docker

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

Spring 3 的基于 Java 的配置,替换 XML

我最近配置了基于 spring 的 maven 项目,我只想用 java 替换我所有的 XML(POM 除外)。我浏览了很多关于此的文章和文档,但是,我在这里的原因是,我有疑问,我认为这些疑问可以由你们解决。

众所周知,每个动态 Web 项目都有一个 XML,它web.xml在没有框架的情况下被调用。

现在如果我们集成了一些框架,比如Struts、Spring、ORM等。这些也需要配置,所以我们再写一个XML配置文件。

我配置了 spring 项目,所以我有一个部署描述符、应用程序上下文和调度程序 servlet。

WEB.XML

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/app-ctx.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
     <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)

app-ctx.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:flow="http://www.springframework.org/schema/webflow-config"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:jms="http://www.springframework.org/schema/jms"
       xmlns:lang="http://www.springframework.org/schema/lang"
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:tx="http://www.springframework.org/schema/tx"

       xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/aop 
                           http://www.springframework.org/schema/aop/spring-aop.xsd
                           http://www.springframework.org/schema/context  
                           http://www.springframework.org/schema/context/spring-context.xsd
                           http://www.springframework.org/schema/webflow-config 
                           http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
                           http://www.springframework.org/schema/jee 
                           http://www.springframework.org/schema/jee/spring-jee.xsd
                           http://www.springframework.org/schema/jms 
                           http://www.springframework.org/schema/jms/spring-jms.xsd …
Run Code Online (Sandbox Code Playgroud)

java xml spring spring-mvc

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

为什么 Jasper Reports 在服务器中显示空报告,但在 jasper studio 中正确生成

我正在使用 Jasper Studio 6.6.0 和 Jasper 服务器 7.1。

我使用来自指定 URL 的图像创建了一个简单的报告。

它在 Jasper Studio 中正确生成,但在服务器中显示为空。

请参考附图:

服务器截图 服务器截图 贾斯珀截图 贾斯珀软件截​​图

jasper-reports jasperserver jaspersoft-studio

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