Bluecove - com.intel.bluetooth.BluetoothStackBlueZ not available

1,484 views
Skip to first unread message

Alma Secerbegovic

unread,
Sep 20, 2010, 7:08:52 AM9/20/10
to bluecove-users
Hello,

I'm working on Netbeans 6.9.1 and trying to run a simple Bluetooth
application that lists all nearby Bluetooth devices using
Microemulator.

I'm running on Arch Linux 2.6.35 and have Bluez 4.70.1 installed.

I have compiled bluecove-2.1.0 and bluecove-gpl-2.1.0 using maven and
placed jar files in Netbeans project classpath.

But still I get this error.

javax.bluetooth.BluetoothStateException: BlueCove
com.intel.bluetooth.BluetoothStackBlueZ not available
at
com.intel.bluetooth.BlueCoveImpl.loadStackClass(BlueCoveImpl.java:342)
at
com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:427)
at com.intel.bluetooth.BlueCoveImpl.access
$500(BlueCoveImpl.java:65)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:
1020)
at java.security.AccessController.doPrivileged(Native Method)
at
com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:
1018)
at
com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:
1011)
at
javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:
75)
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:
95)
at BlueChat.doDeviceSearch(BlueChat.java:151)
at BlueChat.commandAction(BlueChat.java:73)
at javax.microedition.lcdui.Display
$DisplayAccessor.commandAction(Display.java:189)
at org.microemu.app.ui.swing.SwingDeviceComponent
$1.mousePressed(SwingDeviceComponent.java:186)
at java.awt.Component.processMouseEvent(Component.java:6105)
at javax.swing.JComponent.processMouseEvent(JComponent.java:
3267)
at java.awt.Component.processEvent(Component.java:5873)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4469)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4295)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4122)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4295)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:
138)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at BlueChat.doDeviceSearch(BlueChat.java:157)
at BlueChat.commandAction(BlueChat.java:73)
at javax.microedition.lcdui.Display
$DisplayAccessor.commandAction(Display.java:189)
at org.microemu.app.ui.swing.SwingDeviceComponent
$1.mousePressed(SwingDeviceComponent.java:186)
at java.awt.Component.processMouseEvent(Component.java:6105)
at javax.swing.JComponent.processMouseEvent(JComponent.java:
3267)
at java.awt.Component.processEvent(Component.java:5873)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4469)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4295)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4122)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4295)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
BlueChat.commandAction(BlueChat.java:71)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:
138)


Please help.
Thanks in advance

Mina Shokry

unread,
Sep 20, 2010, 7:14:38 AM9/20/10
to bluecov...@googlegroups.com
make sure that bluecove-gpl.jar is in your classpath.


--
You received this message because you are subscribed to the Google Groups "bluecove-users" group.
To post to this group, send email to bluecov...@googlegroups.com.
To unsubscribe from this group, send email to bluecove-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bluecove-users?hl=en.


Alma Secerbegovic

unread,
Sep 20, 2010, 7:57:36 AM9/20/10
to bluecove-users

my execution command in netbeans

java -jar {platformhome}/microemulator.jar java -cp {platformhome}/
bluecove-2.1.0.jar {platformhome}/bluecove-gpl-2.1.0.jar

bluecove-gpl-2.1.0 is included :)

Mina Shokry

unread,
Sep 20, 2010, 8:01:57 AM9/20/10
to bluecov...@googlegroups.com
if this is exactly your command line, it is probably not correct! you should have ':' between the 2 jars in the classpath.

Anyway, your problem has only this meaning. bluecove-gpl isn't in classpath.


--

Alma Secerbegovic

unread,
Sep 20, 2010, 8:16:26 AM9/20/10
to bluecove-users
ok.. thanks
but i have a new error..
this is from netbeans log

Starting emulator in execution mode
arguments [[java], [-cp], [/home/alma/microemulator-21/
microemulator-2.0.4/bluecove-2.1.0.jar:/home/alma/microemulator-21/
microemulator-2.0.4/bluecove-gpl-2.1.0.jar]]
error Message: Error: Unable to find MIDlet class,
java.net.MalformedURLException: Unable to find class java URL
java.net.MalformedURLException: Unable to find class java URL
org.microemu.app.Common.initMIDlet(Common.java:1001)
java.net.MalformedURLException: Unable to find class java URL
at
org.microemu.app.classloader.MIDletClassLoader.addClassURL(MIDletClassLoader.java:
133)
at org.microemu.app.Common.initMIDlet(Common.java:998)
org.microemu.app.Main.main(Main.java:1031)
at org.microemu.app.Main.main(Main.java:1064)
openJar [file:///home/alma/NetBeansProjects/BTExample/dist/
BTExample.jar]
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
javax/bluetooth/DiscoveryListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.lang.ClassLoader.defineClass(ClassLoader.java:480)
at
org.microemu.app.classloader.MIDletClassLoader.findClass(MIDletClassLoader.java:
427)
at
org.microemu.app.classloader.MIDletClassLoader.loadClass(MIDletClassLoader.java:
201)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.microemu.app.Common.loadJar(Common.java:628)
at org.microemu.app.Common.openMIDletUrl(Common.java:376)
at org.microemu.app.Common.openMIDletUrl(Common.java:248)
at org.microemu.app.Common.openMIDletUrlSafe(Common.java:239)
at org.microemu.app.Main$2.actionPerformed(Main.java:232)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:
2012)
at javax.swing.AbstractButton
$Handler.actionPerformed(AbstractButton.java:2335)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
404)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:374)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:
829)
at javax.swing.plaf.basic.BasicMenuItemUI
$Handler.mouseReleased(BasicMenuItemUI.java:873)
at java.awt.Component.processMouseEvent(Component.java:6108)
at javax.swing.JComponent.processMouseEvent(JComponent.java:
3267)
at java.awt.Component.processEvent(Component.java:5873)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4469)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4295)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4295)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:
138)
Caused by: org.microemu.app.classloader.MIDletClassLoader
$LoadClassByParentException: javax.bluetooth.DiscoveryListener
at
org.microemu.app.classloader.MIDletClassLoader.findClass(MIDletClassLoader.java:
339)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at
org.microemu.app.classloader.MIDletClassLoader.loadClass(MIDletClassLoader.java:
213)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
334)
... 38 more


This is the code i'm testing..


import java.util.Vector;

import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.ServiceRecord;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class BlueChat extends MIDlet implements CommandListener,
DiscoveryListener {

private Display disp;
private Form form;
private StringItem stringItem;
private Command search;
private Command exit;
private Vector vcDevices = null;
private LocalDevice local = null;
private DiscoveryAgent agent = null;
List devices = null;

public BlueChat() {
form = new Form("search");
stringItem = new StringItem("", "Allow Search");
search = new Command("Search", Command.OK, 1);
exit = new Command("Exit", Command.EXIT, 2);

vcDevices = new Vector();
vcDevices.addElement("Test");
vcDevices.addElement("Test1");
vcDevices.addElement("Test2");
vcDevices.addElement("Test3");
vcDevices.addElement("Test4");
vcDevices.addElement("Test5");
vcDevices.addElement("Test6");

// TODO Auto-generated constructor stub
}

protected void destroyApp(boolean unconditional) {
notifyDestroyed();
}

protected void pauseApp() {
// TODO Auto-generated method stub
}

protected void startApp() throws MIDletStateChangeException {
disp = Display.getDisplay(this);
form.append(stringItem);
form.addCommand(search);
form.addCommand(exit);
form.setCommandListener(this);
disp.setCurrent(form);

}

public void commandAction(Command cmd, Displayable display) {
String label = cmd.getLabel();
System.out.println("The lable is " + cmd.getLabel());
if (label.equals("Search")) {
doDeviceSearch();
} else if (cmd == List.SELECT_COMMAND) {
//devices.getSelectedIndex();
disp = Display.getDisplay(this);
stringItem = new StringItem("", "You have selected the
device " + devices.getSelectedIndex());
form = new Form("Test");
form.append(stringItem);
disp.setCurrent(form);
} else {
destroyApp(true);
}

}

public void displayDevices() throws Exception {
disp = Display.getDisplay(this);
devices = new List("Choose one", Choice.EXCLUSIVE);
exit = new Command("Exit", Command.EXIT, 1);
devices.addCommand(exit);
for (int i = 0; i < vcDevices.size(); i++) {
devices.append(vcDevices.elementAt(i).toString(), null);
}
devices.setCommandListener(this);
disp.setCurrent(devices);
}

public void displayError(String errorMessage) {
disp = Display.getDisplay(this);
form = new Form("Error");
exit = new Command("Exit", Command.EXIT, 1);
form.append(errorMessage);
form.setCommandListener(this);
form.addCommand(exit);
disp.setCurrent(form);
}

public void deviceDiscovered(RemoteDevice remoteDevice,
DeviceClass device) {
try {
vcDevices.addElement(remoteDevice.getFriendlyName(true));
} catch (Exception cause) {
cause.printStackTrace();
displayError(cause.getMessage());
}

}

public void inquiryCompleted(int param) {
switch (param) {
case DiscoveryListener.INQUIRY_COMPLETED:

try {
displayDevices();
} catch (Exception cause) {
cause.printStackTrace();
}

break;
case DiscoveryListener.INQUIRY_ERROR:
displayError("Error in searching ...............");
break;
case DiscoveryListener.INQUIRY_TERMINATED:
displayError("Search Terminated..............");

default:
break;
}
}

public void serviceSearchCompleted(int arg0, int arg1) {
// TODO Auto-generated method stub
}

public void servicesDiscovered(int arg0, ServiceRecord[] arg1) {
// TODO Auto-generated method stub
}

public void doDeviceSearch() {
try {
local = LocalDevice.getLocalDevice();
} catch (Exception cause) {
cause.printStackTrace();
displayError(cause.getMessage());
}

agent = local.getDiscoveryAgent();
vcDevices = new Vector();

try {
if (!agent.startInquiry(DiscoveryAgent.GIAC, this)) {
displayError("Device Enquiry Could Not Be Started");
;
}
} catch (Exception cause) {
cause.printStackTrace();
displayError(cause.getMessage());
}
}
}



Alma Secerbegovic

unread,
Sep 20, 2010, 9:25:02 AM9/20/10
to bluecove-users
now i'm having problem with microemulator or something..
anyway bluecove is working.
thanks :))
Reply all
Reply to author
Forward
0 new messages