Announcement Announcement Module
Collapse
No announcement yet.
java.io.StreamCorruptedException: invalid stream header Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.io.StreamCorruptedException: invalid stream header

    java.io.StreamCorruptedException: invalid stream header

    Hello,
    I get the following exception when I try to retrieve my serialized collection from a remote service, via httpInvoker client. The remote invocation seems to work the first time, exception is thrown the second time. I am using spring-2.5.5.jar. the server application is on Tomcat. Protocol used on server is https. I am using jdk1.6.0_07. Am I using this incorrectly.


    Here is my applicationContext.xml for client

    Code:
    	<bean id="myHttpClient" class="com.dsainc.pcf.remoting.http.HttpClientFactoryBean">
      		<property name="username" value="user" /> 
      		<property name="password" value="password" /> 
      		<property name="authenticationHost" value="server.com"/>
    	</bean>	
    
    
    	<bean id="acqPlanServiceHttpInvokerProxy" 		class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    		  <property name="serviceUrl" value="/acqplan/acqPlanService.htm" />
    		  <property name="serviceInterface" value="com.dsainc.pcf.remote.acqplan.AcqPlanService" /> 
    		  <property name="httpInvokerRequestExecutor" ref="requestExecutor" /> 
    	</bean>
     
     
    	<bean id="requestExecutor" class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor">
     		<property name="httpClient" ref="myHttpClient"/>
    	 </bean>


    afterPropertiesSet method of HttpClientFactory

    Code:
    public void afterPropertiesSet() throws Exception {
        	System.out.println("httpClient after Properties set ");
    	        if ((username == null) || (password == null)) {
                throw new IllegalArgumentException(
                        "You must set the username, password and "
                                + "authenticationHost properties");
            }
            MultiThreadedHttpConnectionManager mt = new MultiThreadedHttpConnectionManager();
            
            httpClient = new HttpClient(mt);
           
            System.out.println("httpClient created");        
            
            httpClient.getHostConfiguration().setHost(authenticationHost, 443, "https");
            
            System.out.println("host Url " + httpClient.getHostConfiguration().getHostURL());
            
            httpClient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    
            System.out.println(httpClient.getParams().getCookiePolicy());
            
            httpClient.getParams().setAuthenticationPreemptive(true);
    
            System.out.println("setting authentication premptive ");
            
            Credentials credentials = new UsernamePasswordCredentials(username, password);
            
            AuthScope as = new AuthScope(authenticationHost,0,authenticationRealm);
            
            httpClient.getState().setCredentials(AuthScope.ANY, credentials);
            httpClient.getState().setCredentials(as, credentials);
           
            httpClient.getParams().setConnectionManagerTimeout(60000);
            
            System.out.println(httpClient.getState().getCredentials(AuthScope.ANY));
      }
    test to access remote service
    Code:
    	// login to remote application via the myHttpClient bean
    
                 // access service on remote host
    	List<CabinetDO> cabinets = (List<CabinetDO>)acqService.getCabinets(Integer.valueOf("2009"),"USER", "ORGID");
    	if (cabinets != null) {
    		System.out.println(" Cabinet size " + cabinets.size());
    		System.out.println(" cabinet 1 " + cabinets.get(0).getCabinetName());
    	}	else {
    		System.out.println(" returned  null");
    		return;
    	}
    
    	
    	//second trip by httpInvoker to get Cabinets
    	cabinets = (List<CabinetDO>)acqService.getCabinets(Integer.valueOf("2009"),"USER", "ORGID");
    system output and stack trace of exception
    Code:
    Cabinet size 12
     cabinet 1 DAAA21-09-A-1111
    
    showCookiesInHttpClient
    Name SMSESSION
    Value UrTD3As7S1nB92oUxkXjxDUJVDaGMjq82m400SRAENCaxwICAAzijvwu6OUYggvLrc1aPC+XDA5tfwjIzgSAHjHp8qdsXJrumyI6twMbbG/0PqmD3uTkTUAY6gNPZ5AxFBoxIeLzss4weHekNZam6hHzr+xtfyMn+NCPACUleJYbtCMyVG0qo5q43daPPVoDjjiC3amYRHuN8f8v1suZQH0FpQeXEFV7NJor/I/TxxefnS4Tfw44AtGXyeRXSHR73tWHb+E190OKqZFqGDDWDX2Bt2k+o7AXWobharQgD47Zly3tPlQxOzrMicFQ/7LUXHvTpkeIDwYMUMr5+lHOMfkV7k0RMZj/C6CfqeVBcyPCYbUBbYRQcStR1+VDjOCHsCDUfstE6wDIFiiVUde6eEBdisNP5h1NcnWI3j02ZiL7qEXfJGTrh/iLdddK9nHmz/v16FK90lj9AIOr7SWnwSCi9ApvQGyeucZFIxRC6yCWeLYmgB5vg9UqJyWHB750WYUwa3Y1xYyDASaPQRntRg5QRg3ZU4YaSwpbcBFXNg5eRM8Os/+3jf1crGJVaXl3Jkaa03LuCQhAWJFFcfRlJ/bx7lBxLKE4+2CRy3zBccKIJW+1xCsIs5z+qNXj6OT7+6huV+yy2FWVk5QpimG4om6ITJPLlQcBZCbj2ezhlO1WCu4oX+/LcjpMC2YLDITndd/WlwqaVhd/llc65yuy9MaLkA6/2zLxz6qg+IF02mGOEaOY8x4J1MaPGKrekJkcLicsFXYdUR5BS3abKuNO3xI10cwjE1LMl9Rr9oWnIxGLI90ioTeDH6lhkbYaSIDpSTmjd97weiuDC75dslO37Aects5FA/iZ339VCMebsccgJKJ0A+aLgy34USQP7JC3o5Y7je4s74+tzx44yVqHTwTdmhTIgvuwTKnrRUK5xyITpzI00j7QH7+0/blMsxGy2fO5Cu/pMB7JIW/0ZkPKxHsQ3hUMiPcWGj45rRqp1tkA8y5UT8+FjV1tPKG+64EC81E5kwLG/HDZUNQvvU843Lev4UwzgD3hjVGd0of/n8hTOv7U9pqqGU+AYVlPMT8KDbfezUonWPYYeQ85YTvvlBC8M4C73qk3
    Path /
    Domain .com
    Comment null
    Expiry null
    Secure true
    Name JSESSIONID
    Value 2AF28C38353CEF3CACBE7DCDA3C71507
    Path /acqplan
    Domain server.com
    Comment null
    Expiry null
    Secure true
    
    Exception in thread "main" org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [/acqplan/acqPlanService.htm]; nested exception is java.io.StreamCorruptedException: invalid stream header: 3C48544D
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:211)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:144)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy1.getCabinets(Unknown Source)
    	at com.intertech.client.AccountRequestClient.main(AccountRequestClient.java:249)
    Caused by: java.io.StreamCorruptedException: invalid stream header: 3C48544D
    	at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
    	at java.io.ObjectInputStream.<init>(Unknown Source)
    	at org.springframework.core.ConfigurableObjectInputStream.<init>(ConfigurableObjectInputStream.java:47)
    	at org.springframework.remoting.rmi.CodebaseAwareObjectInputStream.<init>(CodebaseAwareObjectInputStream.java:81)
    	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.createObjectInputStream(AbstractHttpInvokerRequestExecutor.java:270)
    	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.readRemoteInvocationResult(AbstractHttpInvokerRequestExecutor.java:238)
    	at org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.doExecuteRequest(CommonsHttpInvokerRequestExecutor.java:129)
    	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:134)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:191)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:173)
    	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:141)
    	... 4 more
Working...
X