I'm trying to get this IoT simulator running: https://github.com/TrivadisPF/various-bigdata-prototypes/tree/master/streaming-sources/iot-truck-simulator/impl
Specifically I want to be able to edit to suit my needs, change route locations, add different iot devices etc..
I've downloaded the zip, setup my intelliJ environment and tried to build and run but I keep getting various errors the most predominant being:
Exception in thread "main" java.lang.RuntimeException: Error running truck stream generator at com.hortonworks.labutils.SensorEventsGenerator.generateTruckEventsStream(SensorEventsGenerator.java:43) at com.hortonworks.solution.Lab.main(Lab.java:277) Caused by: java.lang.NullPointerException at java.base/java.util.Arrays.sort(Arrays.java:1249) at com.hortonworks.simulator.impl.domain.transport.route.TruckRoutesParser.parseAllRoutes(TruckRoutesParser.java:77) at com.hortonworks.simulator.impl.domain.transport.TruckConfiguration.parseRoutes(TruckConfiguration.java:62) at com.hortonworks.simulator.impl.domain.transport.TruckConfiguration.initialize(TruckConfiguration.java:38) at com.hortonworks.labutils.SensorEventsGenerator.generateTruckEventsStream(SensorEventsGenerator.java:25) ... 1 more
This leads me to the "getResource" and "getPath" stuff in lab.java:
sensorEventsParam.setNumberOfEvents(1000);
sensorEventsParam.setDelayBetweenEvents(delayBetweenEventsMs);
System.out.println(Lab.class.getResource("/" "routes/neom").getPath());
sensorEventsParam.setRouteDirectory(Lab.class.getResource("/" "routes/neom").getPath());
sensorEventsParam.setTruckSymbolSize(10000);
SensorEventsGenerator sensorEventsGenerator = new SensorEventsGenerator();
sensorEventsGenerator.generateTruckEventsStream(sensorEventsParam);
I'm guessing it's how the path is handled because the error in sensorEventsGenerator.generateTruckEvenetsStream also points at the getRouteDirectory which again goes back to the setRouteDirectory in the sensorEventsParam...
Anyways any insight or help anyone can give me would be greatly appreciated.
POM:
<modelVersion>4.0.0</modelVersion>
<groupId>com.trivadis</groupId>
<version>1.0.0</version>
<artifactId>iot-truck-simulator</artifactId>
<properties>
<hadoop.miniclusters.version>0.0.15-SNAPSHOT</hadoop.miniclusters.version>
<scala.version>2.11</scala.version>
<kafka.version>2.2.0</kafka.version>
<activemq.version>5.7.0</activemq.version>
<rabbitmq.version>5.10.0</rabbitmq.version>
<avro.version>1.8.2</avro.version>
<akka.version>2.3.16</akka.version>
<jpmml.version>1.0.22</jpmml.version>
<commons.csv.version>1.2</commons.csv.version>
<commons.lang.version>3.7</commons.lang.version>
<slf4j.version>1.7.10</slf4j.version>
<storm.version>0.10.0.2.3.0.0-2557</storm.version>
<storm.hdfs.version>0.10.0.2.3.0.0-2557</storm.hdfs.version>
<javax.activation.version>1.2.0</javax.activation.version>
<jaxb.api.version>2.3.0</jaxb.api.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Kafka -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafka.version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.10.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure.sdk.iot</groupId>
<artifactId>iot-device-client</artifactId>
<version>1.29.0</version>
</dependency>
<!-- ActiveMQ -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${activemq.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.rabbitmq/amqp-client -->
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>${rabbitmq.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-remote_${scala.version}</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>org.jpmml</groupId>
<artifactId>pmml-evaluator</artifactId>
<version>${jpmml.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>${commons.csv.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.hortonworks.solution.Lab</mainClass>
<arguments>
<argument>mqtt</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.hortonworks.solution.Lab</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
<configuration>
<fieldVisibility>private</fieldVisibility>
<sourceDirectory>${project.basedir}/src/main/avro</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<from>
<image>openjdk:11.0-jre</image>
</from>
<to>
<image>registry.hub.docker.com/trivadis/iot-truck-simulator</image>
<auth>
<username>gschmutz</username>
</auth>
</to>
<container>
<mainClass>com.hortonworks.solution.Lab</mainClass>
<args>
<arg>-h</arg>
<arg>mosquitto-1</arg>
</args>
</container>
</configuration>
</plugin>
</plugins>
</build>
Cheers,
Chris
CodePudding user response:
Turns out it was an issue with java versioning. Found a wonderful page here.
That let me setup on the fly switching which lead to the commands in the git working absolutely fine.