synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: Class Mediator Exception after task schedule
Date Thu, 26 Mar 2009 08:58:21 GMT
Kim,

The logs show a NullPointerException at line 66 in
CreateBasicAuthMediator. Can you please identify the instruction on
that line?

Andreas

On Thu, Mar 26, 2009 at 08:42, kimhorn <kim.horn@icsglobal.net> wrote:
>
> Why is this happening; Tasks are so weird.
>
> http://www.nabble.com/file/p22717175/log.txt 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="http://ws.apache.org/ns/synapse">
>  <task class="org.apache.synapse.startup.tasks.MessageInjector"
> name="GetGuid">
>    <property name="to" value="urn:doQuery"/>
>    <property name="message">
>      <doNothing/>
>    </property>
>    <trigger interval="30"/>
>  </task>
>  <in>
>    <log level="full"/>
>    <filter source="get-property('To')" regex="urn:doQuery">
>      <then sequence="processStuff"/>
>    </filter>
>  </in>
>  <out>
>    <send/>
>  </out>
>  <sequence name="processStuff">
>    <log level="custom">
>      <property name="MSG" value="&gt;&gt;&gt;&gt;&gt;&gt;&gt;
Submit
> STUFF"/>
>    </log>
>    <property name="Username" value="username"/>
>    <property name="Password" value="password"/>
>    <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator"/>
>  </sequence>
> </definitions>
>
> CLASS is
> ---------
> public class CreateBasicAuthMediator implements Mediator {
>        private static final Log log =
> LogFactory.getLog(CreateBasicAuthMediator.class);
>        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)
> synCtx).getAxis2MessageContext();
>                Map map = (Map)
> mc.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
>                log.debug("CreateBasicAuthMediator: Got Map...");
>
>                // Set the authentication headers
>                map.put("Authorization", "Basic " + (String)
> Base64.encode(sAuth.getBytes()));
>
>                log.debug("CreateBasicAuthMediator: Auth Created succeeded!");
>
>                return true;
>        }
>
> }
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Class-Mediator-Exception-after-task-schedule-tp22717175p22717175.html
> Sent from the Synapse - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message