[sip-comm-dev] How to send a SIP Messages ?


#1

Hello everyone ,

I'm playing with the example-plugin of SC. I'm trying to send a SIP Messages to anyone of my SIP contacts, but I still get errors.
For example , I select with the right mouse button the contact and click of example plugin. And now I want to send the message "hello world" to the contact.

In the construct of the PluginDialog class I'm trying with this code
   
public PluginDialog(MetaContact metaContact) {

    OperationSetBasicInstantMessaging im =
       (OperationSetBasicInstantMessaging)
       metaContact.getDefaultContact(OperationSetBasicInstantMessaging.class);

       Message msg = im.createMessage("Hello World");

      Contact contact = metaContact.getDefaultContact();

       im.sendInstantMessage(contact, msg);

........
}

I get the error :

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError
        at net.java.sip.communicator.plugin.exampleplugin.PluginDialog.class$(PluginDialog.java:64)
        at net.java.sip.communicator.plugin.exampleplugin.PluginDialog.<init>(PluginDialog.java:63)
        at net.java.sip.communicator.plugin.exampleplugin.ExamplePluginMenuItem.actionPerformed(ExamplePluginMenuItem.java:59)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
        
What do I do wrong ? Any ideas ?

Best Regards

Lubo

···

---------------------------------
Jetzt Mails schnell in einem Vorschaufenster �berfliegen. Dies und viel mehr bietet das neue Yahoo! Mail.


#2

Hi Lubo,

I think that the error comes from the fact that you haven't imported the net.java.sip.communicator.service.protocol package in the exampleplugin.manifest.mf file. In fact all packages that you use in your bundle should be always stated in the Import-Package section of the manifest.mf file.

If you would like to read more about this you could have a look here: http://oscar-osgi.sourceforge.net/tutorial/index.html. There are some examples explaining how the OSGI work.

Hope this helps!

Yana

Lyubomir Lyubenov wrote:

···

Hello everyone ,

I'm playing with the example-plugin of SC. I'm trying to send a SIP Messages to anyone of my SIP contacts, but I still get errors.
For example , I select with the right mouse button the contact and click of example plugin. And now I want to send the message "hello world" to the contact.

In the construct of the PluginDialog class I'm trying with this code
    public PluginDialog(MetaContact metaContact) {

    OperationSetBasicInstantMessaging im = (OperationSetBasicInstantMessaging) metaContact.getDefaultContact(OperationSetBasicInstantMessaging.class);

       Message msg = im.createMessage("Hello World");

      Contact contact = metaContact.getDefaultContact();

       im.sendInstantMessage(contact, msg);

........
}

I get the error :
  Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError
        at net.java.sip.communicator.plugin.exampleplugin.PluginDialog.class$(PluginDialog.java:64)
        at net.java.sip.communicator.plugin.exampleplugin.PluginDialog.<init>(PluginDialog.java:63)
        at net.java.sip.communicator.plugin.exampleplugin.ExamplePluginMenuItem.actionPerformed(ExamplePluginMenuItem.java:59)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
        
What do I do wrong ? Any ideas ?

Best Regards

Lubo

       ---------------------------------
Jetzt Mails schnell in einem Vorschaufenster �berfliegen. Dies und viel mehr bietet das neue Yahoo! Mail.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net