# Apache nifi on FreeBSD



## fett (Dec 15, 2019)

I’m attempting to run Apache NiFi on FreeBSD 12.0-RELEASE-p12. I’ve also tried it on 12.1-RELEASE-p1.  I have pkg openjdk8 installed but all attempts at running nifi are resulting in a start where the network socket is unresponsive and not listening on port 8080 as it should.  Or promptly dies with no listening socket.


```
[root@dow ~]# /opt/nifi-1.10.0/bin/nifi.sh run

Java home: /usr/local/openjdk8
NiFi home: /opt/nifi-1.10.0

Bootstrap Config File: /opt/nifi-1.10.0/conf/bootstrap.conf

2019-12-14 18:31:18,159 INFO [main] org.apache.nifi.bootstrap.Command Starting Apache NiFi...
2019-12-14 18:31:18,159 INFO [main] org.apache.nifi.bootstrap.Command Working Directory: /opt/nifi-1.10.0
2019-12-14 18:31:18,159 INFO [main] org.apache.nifi.bootstrap.Command Command: /usr/local/openjdk8/bin/java -classpath /opt/nifi-1.10.0/./conf:/opt/nifi-1.10.0/./lib/logback-classic-1.2.3.jar:/opt/
nifi-1.10.0/./lib/jetty-schemas-3.1.jar:/opt/nifi-1.10.0/./lib/jcl-over-slf4j-1.7.26.jar:/opt/nifi-1.10.0/./lib/jul-to-slf4j-1.7.26.jar:/opt/nifi-1.10.0/./lib/nifi-properties-1.10.0.jar:/opt/nifi-1
.10.0/./lib/nifi-framework-api-1.10.0.jar:/opt/nifi-1.10.0/./lib/nifi-runtime-1.10.0.jar:/opt/nifi-1.10.0/./lib/javax.servlet-api-3.1.0.jar:/opt/nifi-1.10.0/./lib/nifi-api-1.10.0.jar:/opt/nifi-1.10
.0/./lib/nifi-nar-utils-1.10.0.jar:/opt/nifi-1.10.0/./lib/slf4j-api-1.7.26.jar:/opt/nifi-1.10.0/./lib/log4j-over-slf4j-1.7.26.jar:/opt/nifi-1.10.0/./lib/logback-core-1.2.3.jar -Dorg.apache.jasper.c
ompiler.disablejsr199=true -Xmx512m -Xms512m -Djavax.security.auth.useSubjectCredsOnly=true -Djava.security.egd=file:/dev/urandom -Dsun.net.http.allowRestrictedHeaders=true -Djava.net.preferIPv4Sta
ck=true -Djava.awt.headless=true -Djava.protocol.handler.pkgs=sun.net.www.protocol -Dnifi.properties.file.path=/opt/nifi-1.10.0/./conf/nifi.properties -Dnifi.bootstrap.listen.port=32034 -Dapp=NiFi
-Dorg.apache.nifi.bootstrap.config.log.dir=/opt/nifi-1.10.0/logs org.apache.nifi.NiFi
2019-12-14 18:31:18,177 INFO [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi with Process ID 39895
```


```
[root@dow ~]# pkg info | grep openjdk
openjdk8-8.222.10.1_2          Java Development Kit 8
```

Attempting nifi.sh diagnostics results in the following:

```
[root@dow ~]# /opt/nifi-1.10.0/bin/nifi.sh diagnostics

Java home: /usr/local/openjdk8
NiFi home: /opt/nifi-1.10.0

Bootstrap Config File: /opt/nifi-1.10.0/conf/bootstrap.conf

2019-12-14 18:47:29,112 ERROR [main] org.apache.nifi.bootstrap.Command Seems tools.jar (Linux / Windows JDK) or classes.jar (Mac OS) is not available in classpath
```

NOTE: tools.tar exist in /usr/local/openjdk8/lib/tools.jar

Has anyone had experience, and better yet success, running Apache NiFi on FreeBSD?  If so, would you mind sharing how you were successful.  If you haven’t tried but have an idea as to where I should look next or what I could try next, I’d appreciate that as feedback as well.

Thank you,
Fett


----------



## 20-100-2fe (Dec 17, 2019)

You can try and edit nifi-env.sh and replace the following line:
#export JAVA_HOME=/usr/java/jdk1.8.0/

with:
export JAVA_HOME=/usr/local/openjdk8

If the problem persists after this modification, you could also add the following line after "export JAVA_HOME":
export TOOLS_JAR=${JAVA_HOME}/lib/tools.jar


----------



## fett (Dec 17, 2019)

20-100-2fe: Thank you for the response.
-----------------------------------------------------

After working through this the last few nights there appears to be an easy fix to getting NiFi running on FreeBSD. There is a required package snappyjava. If snappyjava is directly installed, then openjdk8 will be installed. Then with snappyjava installed, one can link the snappy-java.jar into the nifi*/lib directory. Then start NiFi, and all appears to run well. With the 127.0.0.1:8080/nifi being accessible.


```
pkg install snappyjava
cd /path/to/nifi<ver>/lib/
ln -s /usr/local/share/java/classes/snappy-java.jar .
cd ..
export JAVA_HOME=/usr/local/openjdk8
./bin/nifi.sh run
```

Hope this helps someone run Nifi on FreeBSD!!!


----------

