Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

balloon message wont display after i send XMLRPC request

Posted on 2007-11-14
14
Medium Priority
?
229 Views
Last Modified: 2012-08-14
When I run my application in Eclipse it works fine.  When I run it in Netbeans and it works fine.  However if i try running the executable JAR the system tray balloon messages in thie checkNow function wont work.  from trying to debug the problem ive noticed that if i place a test balloon message before my XMLRCP Request it displays and if after the request it doesnt...  i have also looked at my XMLRPCRequest class and I cant see any issues either...

can you please take a look for me.

SystemTrayTools class
----------------------------------

public void checkNow() {
       
        trayIcon.displayMessage(balloonMessageTitle,"Hi Sean - Im a balloon message!",TrayIcon.MessageType.INFO);   // displays fine
       
        XMLRPCRequest xmlRpcRequest = new XMLRPCRequest();
        xmlRpcRequest.sendRequest();
        Object response = xmlRpcRequest.getResponse();
       
        trayIcon.displayMessage(balloonMessageTitle,"Problems...",TrayIcon.MessageType.INFO);   // doesnt display regardless of what happens
       
         if(response == null) {
            propertyNotifier.stopPropertyNotifier();
        } else if(response != null) {
            if(response.toString().length() > 0) {
                String newReferenceNumber = response.toString();
                String currentReferenceNumber = readLatest(new File("latest.txt"));
                if(!currentReferenceNumber.equalsIgnoreCase(newReferenceNumber)) {
                    writeLatest(new File("latest.txt"),newReferenceNumber);
                    trayIcon.displayMessage(balloonMessageTitle,newPropertiesAdded,TrayIcon.MessageType.INFO);
                } else {
                    trayIcon.displayMessage(balloonMessageTitle,noNewPropertiesAdded,TrayIcon.MessageType.INFO);
                }
            } else {
                trayIcon.displayMessage(balloonMessageTitle,noNewPropertiesAdded,TrayIcon.MessageType.INFO);
            }
        } else if(!(response instanceof Boolean)) {
            propertyNotifier.stopPropertyNotifier();
        }
}


XMLRCPrequest class
--------------------------------------

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Vector;
import javax.swing.JOptionPane;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;

public class XMLRPCRequest {
    XmlRpcClient xmlRpcClient;
    PropertyNotifier propertyNotifier;
    Vector requestParams;
    Object requestResult;
   
    public XMLRPCRequest() {
        try {
            xmlRpcClient = new XmlRpcClient("http://xmlrpc.private.com/");
            requestParams = new Vector();
        } catch (MalformedURLException e) {
            JOptionPane.showMessageDialog(null,"Malformed URL error");
        }
    }
   
    private void setResponse(Object requestResult) {
        this.requestResult = requestResult;
    }
   
    public void sendRequest() {
        try {
            requestParams.addElement("guest");
            requestResult = xmlRpcClient.execute("properties.getLatest",requestParams);
            this.setResponse(requestResult);
        } catch (XmlRpcException e) {
            JOptionPane.showMessageDialog(null,"XML-RPC Exception error");
        } catch(IOException ioe) {
            JOptionPane.showMessageDialog(null,"IO Exception error");
        }
    }
   
    public Object getResponse() {
        return this.requestResult;
    }
}
0
Comment
Question by:ellandrd
  • 7
  • 4
  • 3
14 Comments
 
LVL 92

Expert Comment

by:objects
ID: 20278707
have u checked that the call is actually being made
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278720
yes i added a new property to test aswell.

if i place

JOptionPane.showMessageDialog(null,requestResult);

after i execute the  request, i get back the properties reference number which is what i want to get back...

i dont get any other error messages or dialogs displaying...   likei said within the IDE it works fine, but as soon as i run the JAR file, it stops
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278736
xmlRpcClient = new XmlRpcClient("http://xmlrpc.antons-law.com/");
requestParams = new Vector();
requestParams.addElement("guest");
requestResult = xmlRpcClient.execute("properties.getLatest",requestParams);
           
JOptionPane.showMessageDialog(null,requestResult);    // display R01 for example

my joptionpane message box appears if i run the application within eclipse or netbeans, but not if i run from the JAR file...  both IDE's create the JAr when i build and compile...

you can test the XMLRPC request by viewing:

http://xmlrpc.antons-law.com/test.php - you should see a reference number.  this is what i get back...

properties.getLatest maps to a PHP function that returns the latest property reference number...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 20278749
How are you running the jar file? Please check your JRE version.  I some how feel its has some thing to do with run time settings.
0
 
LVL 92

Expert Comment

by:objects
ID: 20278750
> but not if i run from the JAR file...

that suggests the rpc call is either hung or thowing an exception (which is getting swallowed somewhere)
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278765
i using JRE 1.6.0_03
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278772
i have also set my console to show and no messages display in the console.

>>that suggests the rpc call is either hung or thowing an exception (

then shouldnt i get a JOptionPane message box ??  i dont.
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278855
ok i ran my JAR from the command line and i get this:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apach
e/xmlrpc/XmlRpcClient
        at XMLRPCRequest.<init>(XMLRPCRequest.java:19)
        at SystemTrayOptions.checkNow(SystemTrayOptions.java:84)
        at SystemTrayOptions$2.actionPerformed(SystemTrayOptions.java:50)
        at java.awt.MenuItem.processActionEvent(Unknown Source)
        at java.awt.MenuItem.processEvent(Unknown Source)
        at java.awt.MenuComponent.dispatchEventImpl(Unknown Source)
        at java.awt.MenuComponent.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)


do you think the issue with withmy XMLRPCClient JAR.  i downloaded it from  here:

http://ws.apache.org/xmlrpc/


heres the docs too: http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/client/XmlRpcClient.html#XmlRpcClient()

heres a simple example i found that i followed:  http://www.wordtracker.com/docs/api/ch03s02.html
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 1000 total points
ID: 20278866
Yes your apache XMLRPC client  jar is not there in the classpath Please add it to classpath and execute the jar.
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 20278882
infact you need all the dependency jars of xml rpc project to be in the class path for successful running of your application.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 20278894
you need to specify all dependant jars in your manisfest using the ClassPath: attribute
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278901
there was only one JAR that i downloaded so i will add this to my classpath...
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 20278912
sure do that it must work :)
0
 
LVL 16

Author Comment

by:ellandrd
ID: 20278954
ok my problem was the path to the XMLRCPClient jar.  when i first downloaded it i save it in folder on c:\java\

i played about with examples and when i created my application i moved the JAr into another folder and didnt correct the path in eclipse so since the path was wrong, the jar was added to classpath during build...

thanks for your time and help guys...another lesson learnt!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question