First, I did researches about this problem but I didn't find anything that solved it, so here I go :
I'm trying to run an example provided with the latest version of Apache ActiveMQ Artemis (2.5.0) which is the protocols/mqtt/publish-subscribe one. As Apache says, I tried to run mvn verify
in the directory. The problem is, it doesn't work. I put the output here, I tried the -e and -X anyway so don't hesitate to ask me a post of this stacktrace.
(Because of course, /Library/[....]/lib/modules isn't a directory, but a file. I don't actually know what it does, but I tried to rename it and create a folder named 'modules', and it just created errors when I tried to run something else.)
[INFO] Scanning for projects...
[INFO]
[INFO] --------< org.apache.activemq.examples.mqtt:publish-subscribe >---------
[INFO] Building ActiveMQ Artemis MQTT Publish/Subscribe Example 2.5.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-maven) @ publish-subscribe ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-java) @ publish-subscribe ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ publish-subscribe ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ publish-subscribe ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/bouvet/ARTEMIS/apache-artemis-2.5.0/examples/protocols/mqtt/publish-subscribe/src/main/resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ publish-subscribe ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/bouvet/ARTEMIS/apache-artemis-2.5.0/examples/protocols/mqtt/publish-subscribe/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.024 s
[INFO] Finished at: 2018-04-23T16:17:15+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project publish-subscribe: Fatal error compiling: CompilerException: InvocationTargetException: java.nio.file.NotDirectoryException: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/modules -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
EDIT: I tried to include this to my pom.xml :
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Or this :
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
But it didn't change anything :(
EDIT II : As suggested by Justin Bertram and with some researches I decided to modify the default used JDK, at least for that project, by using
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_162`
That might not be the best method as I may have to change it again to work with Java 9 but at least it works for that. I have now dependancies issues but I think that's not the spot to talk about that, I'll consider this problem as solved.
It appears you're using Java 9 which isn't yet supported by Apache ActiveMQ Artemis. Try using Java 8 and I think you'll see the example run as expected. It works for me when using:
$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.