Return-Path: Delivered-To: apmail-synapse-dev-archive@www.apache.org Received: (qmail 86466 invoked from network); 26 Mar 2009 23:02:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Mar 2009 23:02:36 -0000 Received: (qmail 19275 invoked by uid 500); 26 Mar 2009 23:02:36 -0000 Delivered-To: apmail-synapse-dev-archive@synapse.apache.org Received: (qmail 19201 invoked by uid 500); 26 Mar 2009 23:02:36 -0000 Mailing-List: contact dev-help@synapse.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@synapse.apache.org Delivered-To: mailing list dev@synapse.apache.org Received: (qmail 19193 invoked by uid 99); 26 Mar 2009 23:02:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2009 23:02:35 +0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [210.193.135.161] (HELO nsw.icsglobal.net) (210.193.135.161) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2009 23:02:28 +0000 Received: from localhost (localhost [127.0.0.1]) by nsw.icsglobal.net (Postfix) with ESMTP id 60B2047FC7 for ; Fri, 27 Mar 2009 10:02:06 +1100 (EST) X-Virus-Scanned: Debian amavisd-new at icsglobal.net Received: from nsw.icsglobal.net ([127.0.0.1]) by localhost (nswmail.icsglobal.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Mc+s1N2watA for ; Fri, 27 Mar 2009 10:02:02 +1100 (EST) Received: from somme.icsglobal (extranet.icsglobal.net [192.168.0.14]) by nsw.icsglobal.net (Postfix) with ESMTP id C797B4089 for ; Fri, 27 Mar 2009 10:02:02 +1100 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Class Mediator Exception after task schedule Date: Fri, 27 Mar 2009 10:01:33 +1100 Message-ID: <2FB40470EBF3B949A838D34E06F12F3D010411C2@somme.ICSGLOBAL.local> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Class Mediator Exception after task schedule Thread-Index: AcmuZU8dWXrbmMQzS6WPz7W3XojjMgAAB3GQ References: <22717175.post@talk.nabble.com> <2FB40470EBF3B949A838D34E06F12F3D010411BD@somme.ICSGLOBAL.local> From: "Kim Horn" To: X-Virus-Checked: Checked by ClamAV on apache.org Thanks, for that, thought may be the case. Are there any examples of = code where I could do the send of the message in the Java task code; create a new messageInjectorSenderMediator ?=20 So add the transport info then do the send. If I send this to a Synapse Proxy then the real sequence is out of = Quartz scope. Kim -----Original Message----- From: Andreas Veithen [mailto:andreas.veithen@gmail.com]=20 Sent: Friday, 27 March 2009 9:50 AM To: dev@synapse.apache.org Subject: Re: Class Mediator Exception after task schedule In a proxy service, the transport headers are set by the incoming transport. If you use the message injector then there is no incoming transport and the transport headers are not set [1]. Therefore the solution is straightforward: if the TRANSPORT_HEADERS property is null, you need to create a new HashMap and initialize the TRANSPORT_HEADERS property with this object. Andreas [1] Note that this would also be the case for a transport that has no concept of "header". On Thu, Mar 26, 2009 at 23:38, Kim Horn wrote: > In normal use within a proxy/ sequence this code, = CreateBasicAuthMediator, works fine when called in a sequence.. From the = debug statement the only line left not executed is, line 66: > > map.put("Authorization", "Basic " + = (String)Base64.encode(sAuth.getBytes())); > > Need to wrap this in try-catch; but I guess there is no map, as no = TRANSPORTHEADER. > I'l catch that too. I will check this. > > So no idea why map is null ? > So how do I do a send from this sequence then ? This is my ultimate = goal, this code was removed > from after the java call to simplify the problem example. > > What got me was the Quartz Error, before the stack trace. This seems = strange design that I am still in the Quartz task within a new sequence = ? > > To me the Synapse tasks are still really weird and do not fit in well = with Synapse. The link between sequences, proxies and tasks needs to be = at higher level. However, Low level java tasks are also required. = Synapse should be able to > Schedule proxies and sequences at a higher semantic level, than the = "magic" code used now. These should be not > In the scope of the quartz task. Even in Jeff Davis' book Tasks seem = to work by magic and the underlying mechanism of sending the message, is = inexplicable. > > > Thanks > Kim > > > > -----Original Message----- > From: Andreas Veithen [mailto:andreas.veithen@gmail.com] > Sent: Thursday, 26 March 2009 7:58 PM > To: dev@synapse.apache.org > Subject: Re: Class Mediator Exception after task schedule > > 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 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: >> ---------- >> >> =A0> name=3D"GetGuid"> >> =A0 =A0 >> =A0 =A0 >> =A0 =A0 =A0 >> =A0 =A0 >> =A0 =A0 >> =A0 >> =A0 >> =A0 =A0 >> =A0 =A0 >> =A0 =A0 =A0 >> =A0 =A0 >> =A0 >> =A0 >> =A0 =A0 >> =A0 >> =A0 >> =A0 =A0 >> =A0 =A0 =A0> STUFF"/> >> =A0 =A0 >> =A0 =A0 >> =A0 =A0 >> =A0 =A0 >> =A0 >> >> >> CLASS is >> --------- >> public class CreateBasicAuthMediator implements Mediator { >> =A0 =A0 =A0 =A0private static final Log log =3D >> LogFactory.getLog(CreateBasicAuthMediator.class); >> =A0 =A0 =A0 =A0private String reqUsername =3D null; >> =A0 =A0 =A0 =A0private String reqPassword =3D null; >> >> =A0 =A0 =A0 =A0public int getTraceState() { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 0; >> =A0 =A0 =A0 =A0} >> >> =A0 =A0 =A0 =A0public void setTraceState(int traceState) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0traceState =3D 0; >> =A0 =A0 =A0 =A0} >> >> =A0 =A0 =A0 =A0public String getType() { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return this.getClass().getName(); >> =A0 =A0 =A0 =A0} >> >> =A0 =A0 =A0 =A0public boolean mediate(MessageContext synCtx) { >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0log.debug("CreateBasicAuthMediator: = Create Auth Header Started..."); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0reqUsername =3D (String) = synCtx.getProperty("Username"); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0reqPassword =3D (String) = synCtx.getProperty("Password"); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (reqUsername =3D=3D null) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0log.debug("CreateBasicAuthMediator: ERROR: No UserName..."); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new = SynapseException("Username property MUST be provided!"); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (reqPassword =3D=3D null) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0log.debug("CreateBasicAuthMediator: ERROR: No Password..."); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0throw new = SynapseException("Password property MUST be provided!"); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0log.debug("CreateBasicAuthMediator: = Creating Auth String..."); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0String sAuth =3D reqUsername + ":" + = reqPassword; >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0log.debug("CreateBasicAuthMediator: = Done String..."); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// =A0 =A0 =A0Extract authentication = headers >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0org.apache.axis2.context.MessageContext mc =3D ((Axis2MessageContext) >> synCtx).getAxis2MessageContext(); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Map map =3D (Map) >> = mc.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS)= ; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0log.debug("CreateBasicAuthMediator: = Got Map..."); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// Set the authentication headers >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0map.put("Authorization", "Basic " + = (String) >> Base64.encode(sAuth.getBytes())); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0log.debug("CreateBasicAuthMediator: = Auth Created succeeded!"); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return true; >> =A0 =A0 =A0 =A0} >> >> } >> >> >> >> >> -- >> View this message in context: = http://www.nabble.com/Class-Mediator-Exception-after-task-schedule-tp2271= 7175p22717175.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 > > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org For additional commands, e-mail: dev-help@synapse.apache.org