Announcement Announcement Module
Collapse
No announcement yet.
Errrorrr :java.lang.IllegalArgumentException: Cannot parse date value "-1" for "Expir Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Errrorrr :java.lang.IllegalArgumentException: Cannot parse date value "-1" for "Expir

    I am tyring to use http:outbound-gateway to download a page from website here is the context file


    <int:gateway id="requestGateway"
    service-interface="com.bosch.test.RequestGateway"
    default-request-channel="requestChannel"/>

    <int:channel id="requestChannel"/>

    <int:channel id="replyChannel"/>

    <int:channel id="rest"/>

    <int-http:outbound-gateway request-channel="requestChannel"
    reply-channel="replyChannel"
    url="http://www.google.co.in"
    http-method="GET"
    expected-response-type="java.lang.String">
    </int-http:outbound-gateway>

    <int:service-activator input-channel="replyChannel"
    output-channel="rest" id="httpserviceactivator" auto-startup="true"
    ref="test" method="httpservice">
    </int:service-activator>


    And here is the Test class

    public static void main(String[] args) {


    Authenticator.setDefault(new ProxyAuthenticator("Username", "Password"));
    System.setProperty("http.proxyHost", "Host");
    System.setProperty("http.proxyPort", "Port");
    ApplicationContext context=new ClassPathXmlApplicationContext("ApplicationContext .xml");
    RequestGateway gateway=(RequestGateway)context.getBean("requestGa teway");
    gateway.echo("Testing here");
    System.out.println("End");

    }


    But i am getting a error below is the stack trace can anyone please help

    Dec 1, 2011 4:16:36 PM org.springframework.integration.gateway.MessagingG atewaySupport doSendAndReceive
    WARNING: failure occurred in gateway sendAndReceive
    org.springframework.integration.MessageHandlingExc eption: HTTP request execution failed for URI [http://www.google.co.in]
    at org.springframework.integration.http.outbound.Http RequestExecutingMessageHandler.handleRequestMessag e(HttpRequestExecutingMessageHandler.java:268)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:97)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.dispatch(UnicastingDispatcher.java:9 7)
    at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:61)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemp late.doSendAndReceive(MessagingTemplate.java:318)
    at org.springframework.integration.core.MessagingTemp late.sendAndReceive(MessagingTemplate.java:239)
    at org.springframework.integration.core.MessagingTemp late.convertSendAndReceive(MessagingTemplate.java: 274)
    at org.springframework.integration.gateway.MessagingG atewaySupport.doSendAndReceive(MessagingGatewaySup port.java:224)
    at org.springframework.integration.gateway.MessagingG atewaySupport.sendAndReceive(MessagingGatewaySuppo rt.java:203)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invokeGatewayMethod(GatewayProxyFact oryBean.java:305)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.doInvoke(GatewayProxyFactoryBean.jav a:268)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invoke(GatewayProxyFactoryBean.java: 259)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy3.echo(Unknown Source)
    at com.bosch.test.Test.main(Test.java:42)
    Caused by: java.lang.IllegalArgumentException: Cannot parse date value "-1" for "Expires" header
    at org.springframework.http.HttpHeaders.getFirstDate( HttpHeaders.java:478)
    at org.springframework.http.HttpHeaders.getExpires(Ht tpHeaders.java:347)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.getHttpHeader(DefaultHttpHeader Mapper.java:773)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.toHeaders(DefaultHttpHeaderMapp er.java:332)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.toHeaders(DefaultHttpHeaderMapp er.java:61)
    at org.springframework.integration.http.outbound.Http RequestExecutingMessageHandler.handleRequestMessag e(HttpRequestExecutingMessageHandler.java:248)
    ... 20 more
    Exception in thread "main" java.lang.IllegalArgumentException: Cannot parse date value "-1" for "Expires" header
    at org.springframework.http.HttpHeaders.getFirstDate( HttpHeaders.java:478)
    at org.springframework.http.HttpHeaders.getExpires(Ht tpHeaders.java:347)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.getHttpHeader(DefaultHttpHeader Mapper.java:773)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.toHeaders(DefaultHttpHeaderMapp er.java:332)
    at org.springframework.integration.http.support.Defau ltHttpHeaderMapper.toHeaders(DefaultHttpHeaderMapp er.java:61)
    at org.springframework.integration.http.outbound.Http RequestExecutingMessageHandler.handleRequestMessag e(HttpRequestExecutingMessageHandler.java:248)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:97)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.dispatch(UnicastingDispatcher.java:9 7)
    at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:61)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemp late.doSendAndReceive(MessagingTemplate.java:318)
    at org.springframework.integration.core.MessagingTemp late.sendAndReceive(MessagingTemplate.java:239)
    at org.springframework.integration.core.MessagingTemp late.convertSendAndReceive(MessagingTemplate.java: 274)
    at org.springframework.integration.gateway.MessagingG atewaySupport.doSendAndReceive(MessagingGatewaySup port.java:224)
    at org.springframework.integration.gateway.MessagingG atewaySupport.sendAndReceive(MessagingGatewaySuppo rt.java:203)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invokeGatewayMethod(GatewayProxyFact oryBean.java:305)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.doInvoke(GatewayProxyFactoryBean.jav a:268)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invoke(GatewayProxyFactoryBean.java: 259)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy3.echo(Unknown Source)
    at com.bosch.test.Test.main(Test.java:42)

  • #2
    Hello
    As workaround try to use this attribute:
    mapped-response-headers="-"
    Artem Bilan

    Comment


    • #3
      Let me explain.
      The problem is just only in the "Expires" header from Response.
      It is logical that "-1" is wrong long value for milliseconds of Date.
      So, there are several case how to go:
      1. Exclude all HTTP headers as I've shown above
      2. Use the same attribute for Comma-separated list of names of HttpHeaders, which you need
      3. Implement your own org.springframework.integration.mapping.HeaderMapp er

      And now I think: maybe this is the point to introduce new attributes: excluded-request-headers & excluded-response-headers?
      Last edited by Artem Bilan; Dec 5th, 2011, 04:26 PM.

      Comment

      Working...
      X