簡體   English   中英

部署其余Web服務時出錯

[英]error while deploying rest web service

我是新來的休息網絡服務。

http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/中選取示例

在點擊URL http://localhost:8080/RESTfulExample/rest/hello/mkyong我收到了這個奇怪的錯誤:

在此輸入圖像描述

細節是:

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.1022
    System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
    clr.dll             : 4.0.30319.1022 (RTMGDR.030319-1000)
    dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
    dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : http://localhost:8080/rs1/rest/hello/hi,

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of http://localhost:8080/rs1/rest/hello/hi, resulted in exception. Following failure messages were detected:
        + Exception reading manifest from http://localhost:8080/rs1/rest/hello/hi,: the manifest may not be valid or the file could not be opened.
        + Data at the root level is invalid. Line 1, position 1.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [9/16/2014 11:30:26 AM] : Activation of `http://localhost:8080/rs1/rest/hello/hi`, has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [9/16/2014 11:30:26 AM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from http://localhost:8080/rs1/rest/hello/hi,: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Xml.XmlException
        - Data at the root level is invalid. Line 1, position 1.
        - Source: System.Xml
        - Stack trace:
            at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
            at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
            at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
            at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
            at System.Xml.XmlCharCheckingReader.Read()
            at System.Xml.XsdValidatingReader.Read()
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

我正在使用eclipse kepler和apache tomcat 6

我也在使用IE瀏覽器。 我使用Tomcat 8,針對REST的球衣,帶有LDAP安全約束,將用戶引導到登錄頁面。 登錄頁面顯示正常,但在身份驗證后,此錯誤仍然存​​在。 我們的用戶群主要是IE用戶,所以使用Chrome,firefox等並不是一個真正的選擇(雖然網站按預期工作)。

只是注意到在IE中將網站添加到“可信站點”可以解決問題。

對日志文件進行一些挖掘會使IE看起來好像正在嘗試啟動應用程序(ClickOnce)並期待清單文件。 這是令人困惑的,也許是誤導,因為我們的網站沒有申請。 非常感謝任何幫助。

更新:我設法解決了這個問題。 在查看我的域類之后,我發現我沒有為響應指定MIME類型。 在我的域(其余)類方法中添加@Produces(“text / html”)注釋解決了這個問題:

例:

@GET
@Produces("text/html")
public Response welcome()
{
return Response.ok("This should now work in IE").build();
}

我想如果IE沒有在響應頭中專門獲取此mimetype,則假定您正在嘗試提供應用程序(ClickOnce)。 我希望IE更像Chrome或Firefox。

我有同樣的問題。 如果您使用其他瀏覽器,如Chrome或IE,它將起作用

我知道可能我遲到了。 雖然我是初學者,但我想分享一下我解決這個問題的方法。 所以,我有同樣的錯誤,但我解決了它采取這些步驟:

  1. 打開您的網絡瀏覽器(即我使用Chrome)
  2. 打開apache tomcat的主屏幕

http:// localhost :{port}(默認情況下在Eclipse中,端口:8080)

  1. 打開“經理應用”。 在我的例子中,我需要修改位於apache路徑安裝中的tomcat-user.xml文件。(因此,你將獲得經理許可)
  2. 當您打開de Manager App時,您將在一行中看到/ RESTfulExample。 檢查它是否正在運行
  3. 最后,在您的Web瀏覽器中寫入

    HTTP://本地主機:8080 / RESTfulExample / REST /打招呼/你好%20world

  4. 你會看到

    澤西說:你好世界

我希望你能在腦海中找到另一種解決方案

如果您使用Spring MVC遇到此問題,那么您可以通過在@RequestMapping注釋中添加produce = mime類型來解決此問題。 結果看起來與此類似:

...
@RequestMapping(value = "/mapping-address", produces = "text/html;charset=UTF-8")
...

當我使用@ResponseBody注釋注釋一個返回String的方法時,我遇到了這個問題。

我有同樣的問題,這不是一個答案,只是為問題添加更多信息。 如果我的IE 11處於該域/ URL的兼容模式,我才會得到它。

如果我關閉兼容模式,響應將按您的預期解釋。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM