Java WS webservices, IBM Websphere and Eclipse

IBM Websphere, unlike some other Application servers, needs some more configuration files in order to be able to deploy an Java WS annotation based Webservice web (.war) application:

  • ibm-web-bnd.xml
  • ibm-web-ext.xml
  • web_merged.xml

Their content for a basic application deployment (i.e. deploying on the default virtual host and with no security configuration) is quite basic:

web_merged.xml
web_merged.xml
ibm-web-ext.xml
ibm-web-ext.xml
ibm-web-bnd.xml
ibm-web-bnd.xml
  • These files are automatically created for you if you use MyEclipse to develop your webservices web application.
  • I’ve never tried it, but I was told that IBM RAD also creates these files for you.

However, if you use Eclipse, you get in troubles ! You developed your webservices web application using @Webservice, @SOAPBinding, … Java WS annotations; you deployed you application on Glassfish for example, everything goes right. However once you deploy on IBM Websphere Application server (WAS) … BIG FAIL! you do not see your webservices published (no WSDL generated nor published)!

Don’t panic, the solution exists and is straight forward! Just copy these files at the root of you WEB-INF folder, along with your web.xml Web application file and your are done ! redeploy your application and you should see now your WSDL generated and published.

Notes

Please refer to IBM website for more documentation on these files and for more advanced configuration features.

I do not provide the sources of the XML files listed above for evident copyright reasons.

This post has been tested using IBM Websphere 7.x and Java WS 2.x

References

Put log4j within slf4j in your Eclipse RCP application

If you want to add log4j feature to your eclipse RCP application, the way you used to in your Java programs, it is quite easy !

  • take the ready to use plugin and import it onto your workspace

or

  • follow the steps below to create a new one from scratch

Note that in this post, we use slf4j API for log4j binding.

From scratch

1. Create a bundle for log4j logging functionality, say “com.ichir.eclipse.logger”

If you use the eclipse RCP “New plugin project” wizard, answer “No” to “Would you like to create a rich client application?” and do not check “this plugin will make contributions to the UI” !

2. Create a “lib” folder in your plugin, download (download adequate versions) and copy the “slf4j-api”, “slf4j-log4j” and “log4j” libraries in it. Add these libraries to your build path.

3. Create a “LoggerFactory” class, that instantiates “ILogger” instances on demand and an “Slf4jLogger” delegate class.

Only the “LoggerFactory” class and the “ILogger” interface are to be exported in the plugin. Let “Slf4Logger” should remain hidden to other plugins, as it is just an “ILogger” implementation.

See the downloads section below for sample downloads of these classes sources.

4. Configuration

Log4j logging configuration is generally made through the log4j.properties file. Create such a file (or copy the one provided here) to your

  • “[ECLIPSE_INSALLATION]/configuration/” folder for use within eclipse
  • “[ECLIPSE_RCP_APPLICATION_BUILD]/configuration/” folder for use within your application build

Note that in the LoggerFactory class, this file is configured and loaded from that “configuration” folder of the application runtime instance. (see the LoggerFactory#configure() method). You can of course change this configuration to fit your needs.

5. That’s it! you are done with it!

In order to use this new plugin and begin “log4j” logging, just add the “logger” plugin created earlier to your plugin dependencies and insert this into your Eclipse RCP code

   private static final ILogger LOGGER = LoggerFactory.getLogger(MyClass.class);
   // my code here ...
   LOGGER.debug(">> my debug message");
   // my code here ...
   try {
      // some code
   } catch (Exception e) {
      LOGGER.error("my error message", e);
   }

You’ll find your logs and log file in the “logs” subfolder of your application (or in your eclipse installation folder), as configured in the “log4j.properties” file.

Downloads

R

eferences