java.net.UnknownServiceException: no content-type 解决办法

来源:互联网 发布:悉知和知悉是什么意思 编辑:程序博客网 时间:2024/05/16 14:48
Exception in thread "main" java.net.UnknownServiceException: no content-type
 at java.net.URLConnection.getContentHandler(URLConnection.java:1192)
主要原因是服务器端没有返回content-type字段,而且SUN JDK作为客户端时没有进行if failed, then guess and try的操作
有两种解决办法:
1. 在服务器端Tomcat 6.0/conf/web.xml加上
    <mime-mapping>
        <extension>wsdl</extension>
        <mime-type>application/xml</mime-type>
    </mime-mapping>
2. 在客户端进行guess and try:
原文:http://wyangtan.spaces.live.com/?_c11_BlogPart_pagedir=Next&_c11_BlogPart_handle=cns!2511BB45B09CF44E!245&_c11_BlogPart_BlogPart=blogview&_c=BlogPart
原创粉丝点击