Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

java - Package 'javax.jms' is declared in module with an invalid name ('geronimo.jms.2.0.spec')

At this moment I'm refactoring an app to use java's modular system and I'm stuck with an awkward situation while using org.apache.activemq:artemis-jms-client:jar:2.16.0:compile. I'm getting an error

Package 'javax.jms' is declared in module with an invalid name ('geronimo.jms.2.0.spec') 

Is there any way to bypass this error while using modules?

NOTE: I'm using JAVA 11; Maven; IntelliJ IDEA 2020.3.1 (Community Edition)

mvn dependency:tree

[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.4.0:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.4.0:compile
[INFO] |  |  - org.springframework:spring-context:jar:5.3.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.0:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.1:compile
[INFO] |  |  - org.springframework:spring-jcl:jar:5.3.1:compile
[INFO] |  - org.yaml:snakeyaml:jar:1.27:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.4.0:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.3:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] |  |  |  - com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.3:compile
[INFO] |  |  - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.0:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.39:compile
[INFO] |  |  +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] |  |  - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.39:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.1:compile
[INFO] |  - org.springframework:spring-webmvc:jar:5.3.1:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.1:compile
[INFO] |     - org.springframework:spring-expression:jar:5.3.1:compile
[INFO] +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  - jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.3.3:runtime
[INFO] |  - com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- jakarta.xml.ws:jakarta.xml.ws-api:jar:2.3.3:compile
[INFO] |  +- jakarta.xml.soap:jakarta.xml.soap-api:jar:1.4.2:compile
[INFO] |  - jakarta.jws:jakarta.jws-api:jar:2.1.0:compile
[INFO] +- com.sun.xml.ws:jaxws-rt:jar:2.3.3:compile
[INFO] |  +- com.sun.xml.ws:policy:jar:2.7.10:compile
[INFO] |  +- org.glassfish.ha:ha-api:jar:3.1.12:compile
[INFO] |  +- org.glassfish.external:management-api:jar:3.2.2:compile
[INFO] |  +- org.glassfish.gmbal:gmbal:jar:4.0.1:compile
[INFO] |  +- org.glassfish.pfl:pfl-tf:jar:4.1.0:compile
[INFO] |  +- org.glassfish.pfl:pfl-basic:jar:4.1.0:compile
[INFO] |  +- org.jvnet.staxex:stax-ex:jar:1.8.3:compile
[INFO] |  +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.9:compile
[INFO] |  +- org.jvnet.mimepull:mimepull:jar:1.9.13:compile
[INFO] |  +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.18:compile
[INFO] |  +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.2:compile
[INFO] |  +- com.fasterxml.woodstox:woodstox-core:jar:5.1.0:compile
[INFO] |  - org.codehaus.woodstox:stax2-api:jar:4.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-artemis:jar:2.4.0:compile
[INFO] |  +- jakarta.jms:jakarta.jms-api:jar:2.0.3:compile
[INFO] |  +- jakarta.json:jakarta.json-api:jar:1.1.6:compile
[INFO] |  - org.springframework:spring-jms:jar:5.3.1:compile
[INFO] |     +- org.springframework:spring-messaging:jar:5.3.1:compile
[INFO] |     - org.springframework:spring-tx:jar:5.3.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.4.0:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.4.0:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.0:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  - net.minidev:json-smart:jar:2.3:test
[INFO] |  |     - net.minidev:accessors-smart:jar:1.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.18.1:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.7.0:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.0:test
[INFO] |  |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  - org.junit.platform:junit-platform-commons:jar:1.7.0:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.7.0:test
[INFO] |  |  - org.junit.jupiter:junit-jupiter-engine:jar:5.7.0:test
[INFO] |  |     - org.junit.platform:junit-platform-engine:jar:1.7.0:test
[INFO] |  +- org.mockito:mockito-core:jar:3.6.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.10.18:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.18:test
[INFO] |  |  - org.objenesis:objenesis:jar:3.1:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:3.6.0:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:5.3.1:test
[INFO] |  - org.xmlunit:xmlunit-core:jar:2.7.0:test
[INFO] +- org.apache.cxf:cxf-rt-features-logging:jar:3.3.1:compile
[INFO] |  +- org.apache.cxf:cxf-core:jar:3.3.1:compile
[INFO] |  |  +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3:compile
[INFO] |  |  |  +- org.glassfish.jaxb:txw2:jar:2.3.3:compile
[INFO] |  |  |  - com.sun.istack:istack-commons-runtime:jar:3.0.11:compile
[INFO] |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.4:compile
[INFO] |  |  - org.glassfish.jaxb:jaxb-xjc:jar:2.3.3:compile
[INFO] |  |     +- org.glassfish.jaxb:xsom:jar:2.3.3:compile
[INFO] |  |     |  - com.sun.xml.bind.external:relaxng-datatype:jar:2.3.3-b02:compile
[INFO] |  |     +- org.glassfish.jaxb:codemodel:jar:2.3.3:compile
[INFO] |  |     +- com.sun.xml.bind.external:rngom:jar:2.3.3:compile
[INFO] |  |     +- com.sun.xml.dtd-parser:dtd-parser:jar:1.4.3:compile
[INFO] |  |     - com.sun.istack:istack-commons-tools:jar:3.0.11:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
[INFO] |  |  - javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
[INFO] |  +- com.sun.activation:javax.activation:jar:1.2.0:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:jar:1.1.3:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  - org.jboss.spec.javax.rmi:jboss-rmi-api_1.0_spec:jar:1.0.6.Final:compile
[INFO] +- com.mytest:tu:jar:0.0.1-SNAPSHOT:compile
[INFO] |  - org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:2.0.0.CR1:compile
[INFO] +- org.apache.cxf:cxf-spring-boot-starter-jaxws:jar:3.4.2:compile
[INFO] |  +- org.apache.cxf:cxf-spring-boot-autoconfigure:jar:3.4.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-transports-http:jar:3.4.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.4.2:compile
[INFO] |  |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  |  +- org.ow2.asm:asm:jar:9.0:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.4.2:compile
[INFO] |  |  |  +- org.apache.cxf:cxf-rt-wsdl:jar:3.4.2:compile
[INFO] |  |  |  |  - wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] |  |  |  - org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.4.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.4.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.4.2:compile
[INFO] |  |  - org.apache.cxf:cxf-rt-ws-addr:jar:3.4.2:compile
[INFO] |  |     - org.apache.cxf:cxf-rt-ws-policy:jar:3.4.2:compile
[INFO] |  |        - org.apache.neethi:neethi:jar:3.1.1:compile
[INFO] |  +- org.apache.cxf:cxf-rt-features-metrics:jar:3.4.2:compile
[INFO] |  +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  - org.springframework.boot:spring-boot-starter-validation:jar:2.4.0:compile
[INFO] |     - org.hibernate.validator:hibernate-validator:jar:6.1.6.Final:compile
[INFO] |        - com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.apache.activemq:artemis-spring-integration:jar:2.16.0:compile
[INFO] |  +- org.apache.activemq:artemis-server:jar:2.15.0:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  |  +- org.jboss.logmanager:jboss-logmanager:jar:2.1.10.Final:compile
[INFO] |  |  |  - org.wildfly.common:wildfly-common:jar:1.5.1.Final:compile
[INFO] |  |  +- org.apache.activemq:artemis-journal:jar:2.15.0:compile
[INFO] |  |  +- org.apache.activemq:artemis-jdbc-store:jar:2.15.0:compile
[INFO] |  |  +- org.apache.activemq:activemq-artemis-native:jar:1.0.2:compile
[INFO] |  |  +- org.jctools:jctools-core:jar:2.1.2:compile
[INFO] |  |  +- io.netty:netty-buffer:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-transport:jar:4.1.54.Final:compile
[INFO] |  |  |  - io.netty:netty-resolver:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-common:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-handler:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.54.Final:compile
[INFO] |  |  |  - io.netty:netty-transport-native-unix-common:jar:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.54.Final:compile
[INFO] |  |  +- io.netty:netty-codec:jar:4.1.54.Final:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  |  |  - commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  |  +- org.apache.commons:commons-configuration2:jar:2.7:compile
[INFO] |  |  |  +- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] |  |  |  - org.apache.commons:commons-text:jar:1.8:compile
[INFO] |  |  +- io.micrometer:micrometer-core:jar:1.6.1:compile
[INFO] |  |  |  +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |  |  |  - org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] |  |  - commons-io:commons-io:jar:2.6:compile
[INFO] |  +- org.apache.activemq:artemis-jms-server:jar:2.15.0:compile
[INFO] |  |  - org.apache.activemq:artemis-service-extensions:jar:2.15.0:compile
[INFO] |  - org.springframework:spring-beans:jar:5.3.1:compile
[INFO] +- org.apache.activemq:artemis-jms-client:jar:2.16.0:compile
[INFO] |  +- org.apache.activemq:artemis-core-client:jar:2.15.0:compile
[INFO] |  |  +- org.jgroups:jgroups:jar:3.6.13.Final:compile
[INFO] |  |  +- org.apache.johnzon:johnzon-core:jar:1.2.8:compile
[INFO] |  |  +- io.netty:netty-handler-proxy:jar:4.1.54.Final:compile
[INFO] |  |  - io.netty:netty-codec-socks:jar:4.1.54.Final:compile
[INFO] |  +- org.apache.activemq:artemis-commons:jar:2.15.0:compile
[INFO] |  +- org.apache.activemq:artemis-selector:jar:2.15.0:compile
[INFO] |  - org.apache.geronimo.specs:geronimo-jms_2.0_spec:jar:1.0-alpha-2:compile
[INFO] +- org.apache.cxf.xjc-utils:cxf-xjc-runtime:jar:3.3.1:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
[INFO] - org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:provided

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In your dependency declaration for org.apache.activemq:artemis-jms-client you can exclude org.apache.geronimo.specs:geronimo-jms_2.0_spec, e.g.:

<dependency>
   <groupId>org.apache.activemq</groupId>
   <artifactId>artemis-jms-client</artifactId>
   <version>2.16.0</version>
   <exclusions>
      <exclusion>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-jms_2.0_spec</artifactId>
      </exclusion>
   </exclusions>
</dependency>

Then explicitly include another JMS API, e.g.:

<dependency>
   <groupId>jakarta.jms</groupId>
   <artifactId>jakarta.jms-api</artifactId>
   <version>2.0.3</version>
</dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...