小编Mar*_*ede的帖子

我想在几个JEE6 WEB项目上共享一个JPA带注释的实体模型

我想通过几个JEE6 WEB项目共享一个用JPA注释的实体模型.实体注释如下:

@Entity
public class Contract implements Serializable {
Run Code Online (Sandbox Code Playgroud)

我创建了一个maven项目,只有带注释的实体类,即实体项目.

在客户端JEE6 WEB项目中,我创建了对该实体项目的依赖.JEE6项目能够编译,但在Glassfish应用程序服务器上执行时会出现运行时错误.该类未被识别为Entity类.

Caused by: java.lang.IllegalArgumentException: Object: nl.marcenschede.modules.Contract[ id=null ] is not a known entity type.
Run Code Online (Sandbox Code Playgroud)

如何将导入的类识别为实体项目?

java jpa maven

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

使用名为self的元素解码JSON

在Swift 5.1中,我想解码一个包含名为self的元素的JSON文档。这是一个HAL文档,因此我无法更改元素名称。

JSON就是这样;

{
  "_embedded": {
    "eventList": [
      {
        "id": 1,
        "datetime": "2020-04-20T20:00:00",
        "description": "...",
        "_links": {
          "self": {
            "href": "http://.../events/1"
          }
        }
      },
      {
        "id": 2,
        "datetime": "2020-04-19T08:30:00",
        "description": "...",
        "_links": {
          "self": {
            "href": "http://.../events/2"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://.../events"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我的域模型如下所示

struct JSonRootElement: Codable {
    var _embedded: JsonEmbedded
}

struct JsonEmbedded: Codable {
    var eventList: [JsonEvent]
}

struct JsonEvent: Codable {
    var id: Int
    var datetime: String
    var description: …
Run Code Online (Sandbox Code Playgroud)

json swift codable

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

使用 eksctl 设置时无法使用 ssh 访问 EKS 工作节点

使用 eksctl 工具在 AWS 上创建 EKS 集群后,无法使用 ssh 访问工作机​​器。出了什么问题?

Marcs-MBP:kubernetes tests marc$ eksctl create cluster --name=mycluster --ssh-public-key=~/.ssh/id_rsa.pub 
2018-10-08T08:09:17+02:00 [?]  setting availability zones to [us-west-2c us-west-2b us-west-2a]
2018-10-08T08:09:17+02:00 [?]  using "ami-08cab282f9979fc7a" for nodes
2018-10-08T08:09:17+02:00 [?]  creating EKS cluster "mycluster" in "us-west-2" region
2018-10-08T08:09:17+02:00 [?]  will create 2 separate CloudFormation stacks for cluster itself and the initial nodegroup
2018-10-08T08:09:17+02:00 [?]  if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-west-2 --name=mycluster'
2018-10-08T08:09:17+02:00 [?]  creating cluster stack "eksctl-mycluster-cluster"
2018-10-08T08:21:12+02:00 …
Run Code Online (Sandbox Code Playgroud)

amazon-eks

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

如何在Spring的application.properties文件中定义c3p0属性

我想在 application.properties 文件中定义 c3p0 属性。但是 c3p0 属性似乎无法识别。出了什么问题?是否有具有 c3p0 设置的 application.properties 文件的示例?

spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:jtds:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}?autoReconnect=true
spring.datasource.username=${OPENSHIFT_MYSQL_DB_USERNAME}
spring.datasource.password=${OPENSHIFT_MYSQL_DB_PASSWORD}
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
c3p0.properties.driverClassName=com.mysql.jdbc.Driver
c3p0.properties.url=jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}?autoReconnect=true
c3p0.properties.username=${OPENSHIFT_MYSQL_DB_USERNAME}
c3p0.properties.password=${OPENSHIFT_MYSQL_DB_PASSWORD}
c3p0.properties.acquire_increment=1
c3p0.properties.idle_test_period
c3p0.properties.timeout=14400
c3p0.properties.max_size=20
c3p0.properties.max_statements=50
c3p0.properties.min_size=3
Run Code Online (Sandbox Code Playgroud)

java c3p0 spring-data

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

扫描 Spring Boot .jar 文件时在 Java 11 jdeps 工具上获取 NPE

当我试图在我的自定义 JRE 中找到需要链接的 Java 模块时,我确实从jdeps工具中获得了一个 NPE :

marc$ jdeps --module-path $JAVA_HOME/jmods --print-module-deps --multi-release 11 target/blha/jx1-0.0.1-SNAPSHOT/BOOT-INF/lib/*.jar
Exception in thread "main" java.lang.NullPointerException
    at jdk.jdeps/com.sun.tools.jdeps.ModuleGraphBuilder.requiresTransitive(ModuleGraphBuilder.java:124)
    at jdk.jdeps/com.sun.tools.jdeps.ModuleGraphBuilder.buildGraph(ModuleGraphBuilder.java:110)
    at jdk.jdeps/com.sun.tools.jdeps.ModuleGraphBuilder.reduced(ModuleGraphBuilder.java:65)
    at jdk.jdeps/com.sun.tools.jdeps.ModuleExportsAnalyzer.modules(ModuleExportsAnalyzer.java:124)
    at jdk.jdeps/com.sun.tools.jdeps.ModuleExportsAnalyzer.run(ModuleExportsAnalyzer.java:97)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask$ListModuleDeps.run(JdepsTask.java:1023)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:560)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:519)
    at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)
Run Code Online (Sandbox Code Playgroud)

知道如何找到我需要链接到此 Spring Boot 项目的自定义 JRE 的所有模块吗?

java java-module java-11

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

标签 统计

java ×3

amazon-eks ×1

c3p0 ×1

codable ×1

java-11 ×1

java-module ×1

jpa ×1

json ×1

maven ×1

spring-data ×1

swift ×1