Category Archives

Stuff to learn about Java

Formatting Numbers in Java

I found it a bit confusing figuring out how to format numbers and currency etc in Java, so I thought I would write a quick blog about it.  Lets consider a big number such as: 123,123,123,123.99 There are a number of things we…

Initializing a Web Service in Java

Hopefully you’ve been able to read some articles on my blog related to using Web Services in Java/Websphere and they’ve provided you some assistance.  In relation to that topic, this article simple illustrates how you you can invoke a web service using both…

Converting Java ArrayLists

If you are still using JDK 1.4, I’ve had so many times where I forget the syntax when trying to convert an ArrayList of objects to the native types.  So here’s how you do it successfully in one line of code: MyClass[] realObjs…

WSWS3740E: Error: No SSL configuration is available for endpoint

You may get this error when you try and run a Java client to a SSL based web service. If you do experience this problem, you need to point to the WAS ssl.client.props file and add the cert to the chain.  You will…

WSWS3227E – java.lang.IllegalArgumentException

So you get your web service client working nicely and deploy your code to Websphere only to find this ugly Websphere Exception: [6/3/10 21:28:28:081 EDT] 00000035 Connection    E com.ibm.ws.webservices.engine.client.Connection invoke WSWS3227E:  Error: Exception: java.lang.IllegalArgumentException: argument type mismatch From what I have read online,…

Java Calendar – Calculate Number of Days between two dates

Calendar date1 = Calendar.getInstance(); // You can set date1 to any date date1.set(Calendar.MONTH,1); date1.set(Calendar.YEAR,1980); Calendar now = Calendar.getInstance(); long numberOfDays = (date1.getTime().getTime() – now.getTime().getTime()) / (1000 * 60 * 60 * 24);

Java Core Dumps

Here’s a good article if you wanted to take a stab at understanding Java Core dumps.  Pretty geeky stuff man but certainly useful when you are working with enterprise applications. http://java.sys-con.com/node/921279?page=0,0 Don’t forget you will need to get the Java Core Analyzer from…

Round to the Nearest Dollar in Java

This method will simply round a number to the nearest whole number.  Can it get any simpler? public static int round(double value) { return (int)(value+.5); }

Logging in Java

If you ever need to track down very detailed errors from within vendor code, or web services (ie SOAP messages), you will probably want to use the JDK logging.  I found using a properties file to control how things are displayed.  There is…

Webservices for Websphere using Eclipse

When I started using Websphere’s WSDL2Java, I was working with WAS 6.x.  As I am an avid Eclipse user, I wanted to make use of Eclipse for building my test WAR.  I didn’t have the money to fork out for buying a copy…

Categories