So I'm working on a java project for my raspberry pi and I want to create a bonjour service in java.
So when I'm coding on my mac I have the imports:
import com.apple.dnssd.DNSSD; import com.apple.dnssd.DNSSDException; import com.apple.dnssd.DNSSDRegistration; import com.apple.dnssd.DNSSDService; import com.apple.dnssd.RegisterListener;
However when I export my application and try to run on my raspberry pi I get the error:
Obviously when executing on my mac these files are on my classpath and are able to be used, but they are not on the raspberry pi. I've tried looking around for a jar with these files but nothing seems to work. I understand that there are some resources at: http://www.macosforge.org/, but I am unsure what I actually need!?
So I have progressed past the error above. I downloaded the Posix mDNSResponder from http://www.macosforge.org/. I then copied this to my raspberry pi. Then in the mDNSPosix folder I executed the makefile:
$ make os=linux
note: I had to install bison and flex for this to work:
$ sudo apt-get install bison $ sudo apt-get install flex
Once the makefile had finished, I then ran:
$ make os=linux install
$ make os=linux Java
This created a
dns_sd.jar which has all the
com.apple.dnssd.* classes in it.
So I added this to my project (On a windows machine this time, to ensure that the classes were being included from the jar), and ran on my pi.
The error I am getting now is:
java.lang.UnsatisfiedLinkError: no jdns_sd in java.library.path java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860) java.lang.Runtime.loadLibrary0(Runtime.java:845) java.lang.System.loadLibrary(System.java:1084) com.apple.dnssd.AppleDNSSD.<clinit>(DNSSD.java:544) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:186) com.apple.dnssd.DNSSD.<clinit>(DNSSD.java:477)
So I fixed this error by moving everything that had been created in the
mDNSPoisx/build/prod folder to
When I try to run my code now I get the following error:
com.apple.dnssd.AppleDNSSDException: DNS-SD Error -65563: SERVICENOTRUNNING at com.apple.dnssd.AppleService.ThrowOnErr(DNSSD.java:652) at com.apple.dnssd.AppleRegistration.<init>(DNSSD.java:772) at com.apple.dnssd.AppleDNSSD._register(DNSSD.java:571) at com.apple.dnssd.DNSSD.register(DNSSD.java:241)
I tried running the daemon as described in the readme.txt:
The "make install" concludes by executing the startup script (usually "/etc/init.d/mdns start") to start the daemon running. You shouldn't need to reboot unless you really want to.
But I still get the same error, any ideas?
I tried restarting the mDNS daemon, and tail the logs:
$ sudo sh /etc/init.d/mdns restart; tail -f /var/log/daemon.log
The following is output:
Feb 10 00:20:01 raspberrypi mDNSResponder: mDNSResponder (Engineering Build) (Feb 9 2013 17:52:27) starting Feb 10 00:20:01 raspberrypi mDNSResponder: mDNS_AddDNSServer: Lock not held! mDNS_busy (0) mDNS_reentrancy (0) Feb 10 00:20:01 raspberrypi mDNSResponder: mDNSResponder (Engineering Build) (Feb 9 2013 17:52:27) stopping
Any ideas on what '
Lock not held!' is about?