Java 9:jigsaw和hibernate 5.2.12不起作用

时间:2017-12-14 20:44:22

标签: java hibernate jta java-9 jigsaw

在我的 pom.xml 文件中,我只有一个依赖项:

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.2.12.Final</version>
    </dependency>
</dependencies>

还有 module-info.java

module testmodule {
    requires hibernate.jpa;
    requires hibernate.core;
}

但是当我试图运行我的应用程序时,我收到错误:引起:java.lang.IllegalArgumentException:jboss.transaction.api.1.2.spec:模块名称无效:&#39; 1&#39;不是Java标识符。有什么想法如何处理它?<​​/ p>

2 个答案:

答案 0 :(得分:2)

从堆栈跟踪中,异常不适用于hibernate-core模块,而是适用于 项目中包含jboss-transaction-api_1.2_spec依赖项。

在依赖项的版本1.0.1.Final之前,无法从jar文件名派生自动模块名称。

enter image description here

这已经在2017年10月发布的2.0.0.Alpha1版本中进行了更新,现在已经在jar中打包module-info.class以获取模块名称。

因此,您最好使用模块名称为2.0.0.Alpha1的{​​{1}}版本:

java.transaction

enter image description here

答案 1 :(得分:0)

在以下环境中,这种方式起作用:

library(dplyr)
df1 %>% 
  group_by(Hosp_Id) %>% 
  summarise_all(.funs = function(x) paste(unique(c(dplyr::lag(x, default = NULL), x)), collapse = ":"))
# A tibble: 4 x 7
#  Hosp_Id DistalLESfromnarescm LESmidpointfromnarescm ProximalLESfromnarescm LESlengthcm EsophageallengthLESUEScenterscm PIPfromnarescm
#  <chr>   <chr>                <chr>                  <chr>                  <chr>       <chr>                           <chr>         
#1 A       31.9                 31.2                   30.1                   1.8         12.1                            37.8          
#2 B       33.1:33.3            32.0                   30.9                   2.2:2.5     14.0:15.0                       No            
#3 C       33.8                 33.1                   31.8                   2.0         15.1                            34.3          
#4 D       34.0                 33.2                   31.9                   2.1         NA                              35.8          

环境:

df1 <- structure(list(DistalLESfromnarescm = c("31.9", "31.9", "33.1", 
"33.3", "33.8", "34.0"), LESmidpointfromnarescm = c("31.2", "31.2", 
"32.0", "32.0", "33.1", "33.2"), ProximalLESfromnarescm = c("30.1", 
"30.1", "30.9", "30.9", "31.8", "31.9"), LESlengthcm = c("1.8", 
"1.8", "2.2", "2.5", "2.0", "2.1"), EsophageallengthLESUEScenterscm = c("12.1", 
"12.1", "14.0", "15.0", "15.1", NA), PIPfromnarescm = c("37.8", 
"37.8", "No", "No", "34.3", "35.8"), Hosp_Id = c("A", "A", "B", 
"B", "C", "D")), .Names = c("DistalLESfromnarescm", "LESmidpointfromnarescm", 
"ProximalLESfromnarescm", "LESlengthcm", "EsophageallengthLESUEScenterscm", 
"PIPfromnarescm", "Hosp_Id"), row.names = c(NA, -6L), class = "data.frame")

休眠版本:module testmodule { requires java.persistence; requires org.hibernate.orm.core; } ->取决于javax.persistence-api-java -version openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment 18.9 (build 11.0.1+13) OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
com.fasterxml.jackson.core人工制品版本:5.3.7.Final
jackson-datatype-hibernate5版本:2.2 springframework版本:2.9.7