Recreate JAR Created By wsimport -clientjar

For some reason, JARS created by wsimport -clientjar can’t be read properly. We have trouble finding our classes when using these JARs.

wsimport -clientjar output.jar input.wsdl 

Our workaround is to use a Windows batch file with the following contents to recreate the JAR file, using the jar.exe utility.

@echo off
mkdir ~jar
cd ~jar
jar -xf ..\%1
jar -cf ..\%1 *
cd ..
rmdir /S /Q ~jar 

We named our batch file recrate-jar.bat can call it like this.

 recreate-jar.bat output.jar 

Release of Log4j 2.0

Apache has announced the release of its newest logging library for Java – Log4j 2.0. An adapter has been released for those with Log4j 1.x. Since the API for Log4j 2.0 uses Java 6 or higher versions of Java, it is not compatible with Log4j’s previous releases. With this adapter, the use of Log4j 1.x API will be allowed on applications. Adapters for Apache Commons Logging and SLF4J are also being offered.

Apache posted on their website new features that have been made for Log4j 2.0:

  • API Separation ensures forward compatibility as well as makes it clear for application developers to identify which classes and methods to use.
  • Performance is improved compared to Log4j 1.x. In multi-threaded scenarios, Log4j 2.0’s Asynchronous Loggers have ten times higher throughput and orders of magnitude lower latency than Log4j 1.x and Logback. In most instances, Log4j 2.0, like Logback, performs faster in critical areas than Log4j 1.x.
  • Offers support for various APIs such as SLF4J and Common Logging APIs.
  • Configurations will automatically reload and log events will not lose while reconfiguration is ongoing.
  • With its advanced filtering, Log4j 2.0 supports filtering based on context data, markers, regular expressions, and other components in the Log event. Before filtering pass to Loggers or while passing through Appenders, it can now be specified to apply to all events. Filters can be associated with Loggers and also common Filter class can be used in any of these conditions.
  • There is no need to write code as plugin pattern is used to configure components. Plugins are automatically recognized and used when configuration references them.
  • By adding Lookup Plugin, users can customize property providers. With Log4j’s new feature, properties are now supported. Properties from values defined in the configuration file, system properties, environmental variables, the ThreadContext Map and date present in the event, can be referenced in a configuration, Log4j will replace them directly or pass them to underlying component that will resolve them.

Log4j 2.0 is now available for download and testing. You can download it here.


Run Static Files Locally Using Node.js

1. Install Node.js if you don’t have it already.

2. Install node-static.

> npm install -g node-static

3. Create a sample index.html you would like to serve.

4. Run static on the index.html directory.

> static
serving "." at http://127.0.0.1:8080

5. Open http://127.0.0.1:8080 in your favorite browser.