error while deploying rest web service
Asked Answered
R

5

11

I am new to rest web service.

Picked the example from http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/

While hitting the URL http://localhost:8080/RESTfulExample/rest/hello/mkyong I am getting this strange error :

enter image description here

And the details are :

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.

I am using eclipse kepler and apache tomcat 6

Resoluble answered 16/9, 2014 at 7:31 Comment(1)
have u use Poster for the same?Alastair
V
15

I am also experiencing this with IE. I am using Tomcat 8, jersey for REST with an LDAP security restraint which directs the user to a login page. The login page displays fine, but after authentication, this error persists. Our user base is largely IE users so using Chrome, firefox etc is not really an option (although the site works as expected on them).

Just a note that adding the site to 'Trusted Sites' in IE gets rid of the problem.

A bit of digging into the log file makes it appear as if IE is trying to launch an application (ClickOnce) and expecting a manifest file. This is baffling and perhaps misleading as there is no application at our site. Any help with this is greatly appreciated.

UPDATE: I managed to solve this issue. After reviewing my domain classes it occurred to me that I was not specifying a MIME type for the response. Adding an @Produces("text/html") annotation to my domain (rest) class methods solved the problem:

Example:

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

I guess if IE does not specifically get this mimetype in the response header it assumes you are attempting to deliver an application (ClickOnce). I wish IE would be more like Chrome or Firefox.

Vela answered 17/12, 2014 at 18:49 Comment(2)
I have the same problem. Also managed to figure out that the problem only happens for me on IE 11 if I am running the site in compatibility mode. Otherwise it works fine.Flowerage
Wwwow, IE does it again!! If I follow a link to my URL, it works fine. If I click refresh, it works fine. But if I then click on the address bar and press enter (with the SAME URL untouched), it throws that error!!Flowerage
H
3

I had the same problem. If you use other browser like Chrome or IE, it'll work

Howrah answered 15/10, 2014 at 5:1 Comment(0)
B
1

I know probably I'm late. Although I am a beginner I would like to share the way I solve this problem. So, I had the same error, but I solved it taking these steps:

  1. Open your web browser (i.e I used Chrome)
  2. Open the main screen of apache tomcat

http://localhost:{port} (by default in Eclipse, port:8080)

  1. Open the "Manager App". In my case, I needed to modify the tomcat-user.xml file which is located in the apache path installation.(So, you will have manager permits)
  2. When you open de Manager App, you will see your /RESTfulExample in a row. Check that it's running
  3. Finally, write in your web browser

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

  4. And you will see

    Jersey say : hello world

I hope you can have another solution in your mind

Brittani answered 2/8, 2015 at 22:14 Comment(0)
P
1

If you experience this with Spring MVC then you may resolve the issue by adding produces = mime type to the @RequestMapping annotation. The result would look similar to this:

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

I had this issue when I annotated a method, which returns a String, with @ResponseBody annotation.

Promotion answered 27/6, 2018 at 21:47 Comment(0)
F
0

I have the same problem, and this isn't an answer, but just to add some more info to the problem. I only get it if my IE 11 is in compatibility mode for that domain/url.

If I turn compatibility mode off, the response is interpreted as you would expect.

Flowerage answered 3/10, 2016 at 13:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.