synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kimhorn <>
Subject Class Mediator Exception after task schedule
Date Thu, 26 Mar 2009 07:42:16 GMT

Why is this happening; Tasks are so weird. log.txt 

org.apache.synapse.SynapseException: Error occured in the mediation of the
class mediator.

Log is attached. The class works perfectly when called in other scripts.

Script is:
<definitions xmlns="">
  <task class="org.apache.synapse.startup.tasks.MessageInjector"
    <property name="to" value="urn:doQuery"/>
    <property name="message">
    <trigger interval="30"/>
    <log level="full"/>
    <filter source="get-property('To')" regex="urn:doQuery">
      <then sequence="processStuff"/>
  <sequence name="processStuff">
    <log level="custom">
      <property name="MSG" value="&gt;&gt;&gt;&gt;&gt;&gt;&gt;
    <property name="Username" value="username"/>
    <property name="Password" value="password"/>
    <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator"/>

public class CreateBasicAuthMediator implements Mediator {
	private static final Log log =
	private String reqUsername = null;
	private String reqPassword = null;

	public int getTraceState() {
		return 0;

	public void setTraceState(int traceState) {
		traceState = 0;

	public String getType() {
		return this.getClass().getName();

	public boolean mediate(MessageContext synCtx) {
		log.debug("CreateBasicAuthMediator: Create Auth Header Started...");
		reqUsername = (String) synCtx.getProperty("Username");
		reqPassword = (String) synCtx.getProperty("Password");

		if (reqUsername == null) {
			log.debug("CreateBasicAuthMediator: ERROR: No UserName...");
			throw new SynapseException("Username property MUST be provided!");
		if (reqPassword == null) {
			log.debug("CreateBasicAuthMediator: ERROR: No Password...");
			throw new SynapseException("Password property MUST be provided!");
		log.debug("CreateBasicAuthMediator: Creating Auth String...");
		String sAuth = reqUsername + ":" + reqPassword;
		log.debug("CreateBasicAuthMediator: Done String...");

		//	Extract authentication headers
		org.apache.axis2.context.MessageContext mc = ((Axis2MessageContext)
		Map map = (Map)
		log.debug("CreateBasicAuthMediator: Got Map...");
		// Set the authentication headers
		map.put("Authorization", "Basic " + (String)

		log.debug("CreateBasicAuthMediator: Auth Created succeeded!");

		return true;


View this message in context:
Sent from the Synapse - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message