11

私は残りのWebサービスが初めてです。

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ケプラーとApache Tomcat 6を使用しています

4

5 に答える 5

15

私もIEでこれを経験しています。ユーザーをログインページに誘導するLDAPセキュリティ制限付きのREST用のTomcat 8ジャージーを使用しています。ログイン ページは問題なく表示されますが、認証後もこのエラーが続きます。私たちのユーザー ベースは主に IE ユーザーであるため、Chrome や firefox などを使用することは実際にはオプションではありません (サイトは期待どおりに動作しますが)。

サイトをIEの「信頼済みサイト」に追加すると、問題が解決することに注意してください。

ログ ファイルを少し掘り下げると、IE がアプリケーション (ClickOnce) を起動しようとして、マニフェスト ファイルを予期しているように見えます。私たちのサイトにはアプリケーションがないため、これは不可解であり、おそらく誤解を招く可能性があります. これに関するヘルプは大歓迎です。

更新: この問題を解決できました。ドメイン クラスを確認した後、応答の MIME タイプを指定していないことに気付きました。@Produces("text/html") アノテーションをドメイン (rest) クラス メソッドに追加すると、問題が解決しました。

例:

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

IE が応答ヘッダーでこの mimetype を明確に取得しない場合、アプリケーション (ClickOnce) を配信しようとしていると見なされます。IE が Chrome や Firefox のようになればいいのにと思います。

于 2014-12-17T18:49:16.780 に答える
3

私も同じ問題を抱えていました。Chrome や IE などの他のブラウザを使用している場合は、動作します

于 2014-10-15T05:01:42.513 に答える
1

私はおそらく私が遅れていることを知っています。私は初心者ですが、この問題を解決する方法を共有したいと思います。したがって、同じエラーが発生しましたが、次の手順で解決しました。

  1. Web ブラウザーを開きます (つまり、Chrome を使用しました)。
  2. Apache Tomcat のメイン画面を開く

http://localhost :{port} (Eclipse のデフォルトではポート:8080)

  1. 「マネージャーアプリ」を開きます。私の場合、Apache パスのインストールにあるtomcat-user.xmlファイルを変更する必要がありました (そのため、管理者権限が必要になります)。
  2. de Manager アプリを開くと、/RESTfulExample が一列に表示されます。実行されていることを確認します
  3. 最後に、Web ブラウザーで書き込みます。

    http://localhost:8080/RESTfulExample/rest/hello/hello%20world

  4. そして、あなたは見るでしょう

    ジャージーは言う:こんにちは世界

頭の中で別の解決策を考えていただければ幸いです

于 2015-08-02T22:14:51.060 に答える