Thursday, December 04, 2008

Java : Axis2 client and Log4J

I was busy testing a client developed using the Eclipse plug-ins in the previous post.

This came up with the following error message.

log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.

To set this up inside an Eclipse project:

* Create a new folder in the project called e.g. "log4j".
* Add a file to that folder called log4j.properties which contains something like:


# Set root category priority to INFO and set its only appender to A1
log4j.rootCategory=INFO, A1

# A1 is set to be a ConsoleAppender (writes to system console).
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n


* In the project's "Run Dialog", click on the "Classpath" tab / "Advanced" / "Add folder" and then browse to the "log4j" folder previously created.
* That's it

Enjoy!

Java : Tomcat / Eclipse and Axis2

I needed to develop a Java web service that ran inside Tomcat and used Axis2 as the web server component.

I use Eclipse as my Java IDE and was looking around for plug-ins that would automate and simplify the whole process.

Came across this excellent tutorial - Developing Web Services Using Apache Axis2 Eclipse Plugins - Part 1

This uses two Eclipse plug-ins:

Apache Axis2 Service Archive Generator Wizard and
Apache Axis2 Code Generator Wizard

which generate the proxies and then wrap everything up for deployment to Tomcat.

I highly recommend working through the tutorial and then using that knowledge to develop and deploy your own.

Enjoy!

Java : Finding jars and classes

I seem to spend half my life looking for jars and classes to solve the ubiquitous "Class not defined" problem.

Found this very useful resource which allows you to find which jar files contain the required class and then download them if needed.

Enjoy!