Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor manojkumar.m's Avatar
    Join Date
    Jan 2008
    Posts
    272
    Hello every body,

    I am developing an application using jsr82. When I call a function to search for services (DiscoveryAgent.searchServices()), I am getting an error like this:

    java.lang.NullPointerException
    at com.sun.kvem.jsr082.bluetooth.DataL2CAPReaderWriter.<init>(+41).

    can any one help me why I am getting this exception.
    Last edited by manojkumar.m; 2008-04-15 at 13:35.

  2. #2
    Nokia Developer Champion Tiger79's Avatar
    Join Date
    Apr 2007
    Posts
    2,697
    i am having a similar problem, so I awas wondering how did u catch the exception ?

  3. #3
    Regular Contributor manojkumar.m's Avatar
    Join Date
    Jan 2008
    Posts
    272
    still the problem remains same. can any one help me please.

  4. #4
    Registered User ttsorr's Avatar
    Join Date
    Dec 2007
    Posts
    3
    I would guess that the reason you are not getting any help is that you are not very specific in your question.

    Please post the code that throws the exception, including how you acquire the remote device...

    best,
    mattias

  5. #5
    Nokia Developer Champion hartti's Avatar
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192
    Also tell what device you are seeing this problem on.

    Hartti

  6. #6
    Regular Contributor manojkumar.m's Avatar
    Join Date
    Jan 2008
    Posts
    272
    Hi Harti,

    Thanks for responding. I am getting this error on using WTK25.

  7. #7
    Regular Contributor manojkumar.m's Avatar
    Join Date
    Jan 2008
    Posts
    272
    Hello ttsorr,

    Here I am giving the code....please check once.

    private boolean searchServices() {

    state = SERVICE_SEARCH;
    records.removeAllElements();
    searchIDs = new int[devices.size()];
    System.out.println("devices size : " + devices.size());
    boolean isSearchStarted = false;

    for (int i = 0; i < devices.size(); i++) {
    RemoteDevice rd = (RemoteDevice)devices.elementAt(i);
    try {
    if (attrSet == null)
    {
    System.out.println("attrSet is null");
    }
    else
    {
    System.out.println("attrSet is not null");
    }
    if (uuidSet == null)
    {
    System.out.println("uuidSet is null");
    }
    else
    {
    System.out.println("uuidSet is not null);
    }
    if (rd == null)
    {
    System.out.println("rd is null");
    }
    else
    {
    System.out.println("rd is not null"); }
    searchIDs[i] = discoveryAgent.searchServices(attrSet, uuidSet, rd, this);
    //attrSet = 0x4321;
    //uuidSet = 0x1101,F0E0D0C0B0A000908070605040302010
    }
    catch (Exception e)
    {//BluetoothState
    System.err.println("Can't search services for: " + rd.getBluetoothAddress() +
    " due to " + e);
    searchIDs[i] = -1;
    e.printStackTrace();
    continue;
    }


    }

    // at least one of the services search should be found


    return true;
    }

    try {
    wait(); // until services are found
    } catch (InterruptedException e) {
    System.err.println("Unexpected interruption: " + e);

    return false;
    }


    // actually, no services were found
    if (records.size() == 0) { // here records is a vector
    System.out.println("No proper services were found");
    }

    return true;
    }

  8. #8
    Registered User ttsorr's Avatar
    Join Date
    Dec 2007
    Posts
    3
    What's your attrSet and uuidSet?
    Also, some devices dont seem to mind, but many devices complain when you scan multiple devices simultaneusly.

    Another way to implement that would be to either implement wait/notify, for each service search, or to start a new service search in serviceSearchCompleted if there are more devices to scan.
    I don't know if this is what causes your problems, but it is worth considerations.

    rrostt

  9. #9
    Regular Contributor rrafols's Avatar
    Join Date
    Mar 2003
    Location
    Barcelona, Spain
    Posts
    55
    That exception in the emulator is strange, but when launching service discover you should not launch more than the number indicated in the 'bluetooth.sd.trans.max' property.

    You could get this value using LocalDevice.getLocalDevice().getProperty('bluetooth.sd.trans.max');

    Also, you may try with attrSet set to null, so the default attr will be get as stated in the jsr 82 documentation:

    The default attributes are ServiceRecordHandle (0x0000), ServiceClassIDList (0x0001), ServiceRecordState (0x0002), ServiceID (0x0003), and ProtocolDescriptorList (0x0004).If attrSet is null then only the default attributes will be retrieved.

  10. #10
    Regular Contributor manojkumar.m's Avatar
    Join Date
    Jan 2008
    Posts
    272
    thankyou very much for your reply.
    It helped me a lot.

  11. #11
    Registered User kamanashisroy's Avatar
    Join Date
    Oct 2006
    Posts
    11
    Hi,

    I have the same problem .. I am using WTK 2.5.2 and it is the same NullPointerException at com.sun.kvem.jsr082.bluetooth.DataL2CAPReaderWriter.<init>(+41).

    Unfortunately this exception is not catchable(strange !) ..

    I did not simultaneously searched services in different devices.

    The error does not happen all the time. If I restart every simulation and there bluetooth server available then it works fine.


    Finally it is not chatchable ! strange !

  12. #12
    Registered User kuras234's Avatar
    Join Date
    Jul 2009
    Posts
    2
    hi,

    I have similar problem, when i run 2 (or more) emulators, search device, kill emulator and search. Are you have a idea??
    I'm use WTK 2.5.2



    java.lang.NullPointerException
    at com.sun.kvem.jsr082.bluetooth.DataL2CAPReaderWriter.<init>(DataL2CAPReaderWriter.java:51)
    at com.sun.kvem.jsr082.bluetooth.SDPClient$SDPTransport.start(+100)
    at com.sun.kvem.jsr082.bluetooth.SDPClient.openTransport(SDPClient.java:103)
    at com.sun.kvem.jsr082.bluetooth.SDPClient.open(SDPClient.java:184)
    at com.sun.kvem.jsr082.bluetooth.SDPClient.<init>(SDPClient.java:69)
    at com.sun.kvem.jsr082.bluetooth.ServiceSearcher.start(ServiceSearcher.java:77)
    at com.sun.kvem.jsr082.bluetooth.DiscoveryAgentImpl.searchServices(DiscoveryAgentImpl.java:226)
    at javax.bluetooth.DiscoveryAgent.searchServices(DiscoveryAgent.java:259)
    at main.BTClient.searchServices(BTClient.java:313)
    at main.BTClient.findService(BTClient.java:393)
    at main.BTClient.run(BTClient.java:103)
    at main.BTTaskManager.doTask(BTTaskManager.java:101)
    at main.BTTaskManager.run(BTTaskManager.java:61)

  13. #13
    Regular Contributor manjul_saini's Avatar
    Join Date
    Jan 2008
    Posts
    387
    Quote Originally Posted by manojkumar.m View Post
    Hello every body,

    I am developing an application using jsr82. When I call a function to search for services (DiscoveryAgent.searchServices()), I am getting an error like this:

    java.lang.NullPointerException
    at com.sun.kvem.jsr082.bluetooth.DataL2CAPReaderWriter.<init>(+41).

    can any one help me why I am getting this exception.
    Hi, if i am not wrong you are getting error on emulator right? and yeah you will get it, first of all you must be clear that you are searching a service on emulator, so that emulator must provide a service right? other wise it will give a nullptrexe.
    So start a server as soon as your application starts, means it should be ready to recieve any message as soon as your app starts.
    Thanks and Regards,
    Manjul.

Similar Threads

  1. BT connection BUG - jsr82?
    By matrix241 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2008-03-08, 16:20
  2. pairing devices in jsr82
    By tfm in forum Bluetooth Technology
    Replies: 2
    Last Post: 2006-09-08, 10:27
  3. JSR82 missing for S40 SDK?
    By moamoa in forum Mobile Java General
    Replies: 1
    Last Post: 2006-06-28, 17:22
  4. bluetooth communication without jsr82 api
    By trakadasp in forum Symbian C++
    Replies: 0
    Last Post: 2006-01-30, 08:21
  5. CopyScreenToBitmap is giving exeption
    By seshukc in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-03-30, 04:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved