Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

balloon message wont display after i send XMLRPC request

Posted on 2007-11-14
14
222 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 250 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 250 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Spring Framework HTTPSession management 1 45
xampp tool 12 56
Convert from a json string array to a Java object 3 52
ejb message driven bean mdb creation steps 2 20
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

856 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