繁体   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