Friday, June 5, 2009

Axis2 AxisFault Connection Refused in an Applet

Problem:
When running an applet from Eclipse to call an Axis2 web service, I got the following error:


org.apache.axis2.AxisFault: Connection refused: connect
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

Solution:
In the applet, add the following code in the init() method where 8080 is my Tomcat port number:

public void init(){
System.setProperty("http.proxyPort", "8080");
}

When running an Applet, the port number is set to default 80.
According to the documentation from apache.org, when getting a Connection refused error, it is because "The host exists, nothing is listening for connections on that port. Alternatively, a firewall is blocking that port. Site Finder: the URL is using a port other than 80, and the .com or .net address is invalid"

Reference to http://ws.apache.org/axis/java/client-side-axis.html

Monday, June 1, 2009

Axis2 Service Archiver java.lang.NoClassDefFoundError

Problem:
When running the Axis2 Service Archiver, I got the following error: java.lang.NoClassDefFoundError



Solution:
1. Close Eclipse.
2. Open an explore window and navigate to your workspace. Under your workspace folder, open .metadata folder and then open .plugins folder, and then open the Axis2_Service_Archiver folder. Now you should see a file called "dialog_settings.xml", delete that file.
3. Restart Eclipse.

Looks like Eclipse cashed plugin related information in that xml file. If something is wrong in that xml file, you'll get this error.