rfcomm not working with tomcat7 on raspberry pi 3
<p>I am trying to deploy a webservice on raspberry pi 3 using tomcat7 .. the webservice is invoked fine and worked probably and even tomcat7 can excute sudo commands. This code was to get a value from bluetooth and it works fine with Java but with tomcat7 it gives and exception NoSuchPortException in the line of CommPortIdentifier.getPortIdentifier("/dev/rfcomm0")</p>

<pre><code>import java.io.*;
import gnu.io.*;

//Connect the Raspberry with serial port
public class AGetBlueIn {
    private static InputStream inStream;
    public String getRate(){
        String reading=""; 
        //Connecting to BluetoothDevice
        try {
            Runtime.getRuntime().exec("sudo rfcomm listen rfcomm0 1");
            System.out.println("waiting for connection");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } catch (IOException e) {
            e.printStackTrace();
            return "Error in Starting the Connection Command";

        }
        try {
            CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("/dev/rfcomm0");
            SerialPort serialPort = (SerialPort) portId.open("BlueHeart", 5000);
            // Change baud rate if not 115200
            /*serialPort.setSerialPortParams(115200, SerialPort.DATABITS_8, 
                 SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
            serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);*/
            inStream = serialPort.getInputStream();
            System.out.println("Enter a value");

            for(int i=0;i&lt;10;i++) {
                Thread.sleep(1000);
                if(inStream.available() &gt; 0) {
                    int b = inStream.read();
                    System.out.print((char)b);
                    reading=reading+(char)b;

                }
            }

        } catch (Exception ex) {
        StringWriter errors=new StringWriter();
                ex.printStackTrace(new PrintWriter(errors));
                return errors.toString();
        }

        return reading;
        //serialPort.close();
    }

}
</code></pre>