Can't get GPIO working rpi2

So I think I’ve done everything correctly, but I’m at a loss.
When openhab starts up and loads my items file it says:

2016-03-04 04:47:40.905 [INFO ] [runtime.busevents ] - Motion1 state updated to OPEN
Exception in thread “openHAB GPIO event listener (pin 7)” java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native

I copied the addons:

i added this to

I have this in openhab.cfg:

I have this in my item configuration:
Contact Motion1 “LR Motion” (Internal){ gpio=“pin:7 activelow:yes” }

in the instructions on the wiki it says to install native jna 3.2.7, but there doesn’t seem to be any instruction for this, does anyone know what I’m missing here?

I looked at the logs a bit more and noticed this:
2016-03-04 05:24:36.053 [ERROR] [.o.b.gpio.internal.GPIOBinding] - Error occured while creating backend object for item Motion1, exception: Device or resource busy

Put this somewhere near the top of your script ::

echo 7 > /sys/class/gpio/unexport

Not 100% sure, but i think this will fix your issue.


Thanks, but This didn’t work for me, any other ideas?

Check user permissions, either run openhab as root or add openhab to the gpio group. If using Jessie you should probably also checkout this thread:

thanks it worked for me

you can even add force:yes in the item defination