I have a JAX-RS Web Service that returns a KMZ file.
I am running into an issue returning hte .kmz file when this is deployed to a test glassfish server. Deploying this code to a local glassfish server I have no issues and it returns the kmz normally.
#GET
#Path("bar/v1")
#Produces("application/vnd.google-earth.kmz")
public Response getKmz() {
Client client = ClientBuilder.newClient();
WebTarget resource = client.target(URL);
System.out.println(resource.getUri().toString());
Response test = resource.request().get();
System.out.println(test.toString());
return test;
}
When deployed to the test server the test.toString() being printed so this code is being called. There is no other errors in the logs.
Looking at the transaction in Firefox HttpRequester
the request is as follows:
GET http://foo/bar/v1
accept: application/vnd.google-earth.kmz
-- response --
0
Any ideas what could be causing the file not to be returned? I checked the glassfish settings both locally and on the test server and they were the same.
Related
I've deployed my Java web application to a AWS server, but I get an 502 proxy error like this when making a get request:
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /product.
Reason: Error reading from remote server
The database connection works fine if the application is deployed locally with an online database.
I've tried to configure .ebextensions and my YAML file looks like these:
option_settings:
option_name: Timeout
value: 1000
This is my draft version of my site and you can see the error code: http://platformaruralpreno.eu-west-2.elasticbeanstalk.com/product
I am developing a sharepoint web service client with Apache CXF and I am having a lot of problems with the NTLM authentication when the client runs on the weblogic server.
If I run a simple test on Eclipse, the code works perfectly, but If I run the same code on a web application deployed on weblogic 10.3.6, the NTLM authentication fails and sends the following error:
org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with http://win-server-2008/sitios /sitio_registro/_vti_bin/Lists.asmx
I don't know what could be the difference between running the same code on a test and on a web application deployed on weblogic. Any idea?
The authentication code snipet is:
Client client = ClientProxy.getClient(listsSoap);
HTTPConduit http = (HTTPConduit) client.getConduit();
if (http instanceof AsyncHTTPConduit) {
AsyncHTTPConduit conduit = (AsyncHTTPConduit) http;
DefaultHttpAsyncClient defaultHttpAsyncClient;
try {
defaultHttpAsyncClient = conduit.getHttpAsyncClient();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
Credentials credentials = new NTCredentials( conexionSharepointConfigVO.getUser(), conexionSharepointConfigVO.getPwd(), "", "" );
defaultHttpAsyncClient.getCredentialsProvider().setCredentials( AuthScope.ANY,credentials);
((BindingProvider) listsSoap).getRequestContext().put(Credentials.class.getName(), credentials);
}
UPDATE: I tested the same code in Tomcat 6.0.43 and it works ok.
You can either create a Windows service setting the service to run under the desired account or use the "Run as different user" option when opening the command prompt so WebLogic will start from the command line as the desired user.
Background:
I am using Spring web MVC along with JSP and HTML/JavaScript to write a website. I have added a search function, which sends a query to imdbapi.org and receives a JSON object containing movie/tv show information (via AJAX). The JSON object contains a "poster" field for each result, which is a URL to an image (on imdb server). The results are then displayed showing the poster if available, using jQuery..
someDiv.append($("<img src='"+results[i].poster+"'></img'").addClass("resultImg"));
Problem:
This works absolutely fine when running on STS built-in server and accessing locally eg.
http://localhost:8080/myWebPage.whatever
I have a ubuntu server box with Tomcat 7 installed, when deploying to the server I get a 403 error for each image. Example from chrome console:
GET http://ia.media-imdb.com/images/M/MV5BMTY2NDY4NDA0OV5BMl5BanBnXkFtZTcwNTI4MzUyMQ##._V1._SY317_CR5,0,214,317_.jpg 403 (Forbidden)
More Info:
Have tested in chrome and firefox with same results.
If I cannot fix then one solution would be to download to a temp folder on the server I think...
Is this a configuration problem on my box with the tomcat server?
Is this a configuration problem on my box with the tomcat server?
No, Not at all, Your server configuration has nothing to do with the external resource accessibility,If you are getting #._V1._SY317_CR5,0,214,317_.jpg 403 (Forbidden) - this clearly mean's that the server is refusing your request.
And it seem's many people's have these kind of problem with IMDB - see this
I have "made it work", it is not a direct solution to the question but a workaround. Using a local proxy on my server I download the image into memory in java and then return to the web page...
Java (server side)
#RequestMapping(value="/pages/proxyImg")
public ResponseEntity<byte[]> proxyImage(String url) {
log.info("Image Proxy server: " + url);
try {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.IMAGE_JPEG);
return new ResponseEntity<byte[]>(IOUtils.toByteArray(new URL(url).openConnection().getInputStream()), headers, HttpStatus.CREATED);
} catch(Exception e) {
e.printStackTrace();
return null;
}
}
Javascript
someDiv.append($("<img src='"+"proxyImg.htm?url="+results[i].poster+"'></img'"));
I have a WCF based web service and hosted on local machine written in c#. I want to get a response from this hosted service in my GWT client side.
Please check the following code:
url = "localhost:8089/request"
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
Request response = builder.sendRequest(null, new RequestCallback() {
#override
public void onResponseReceived(Request request, Response response) {
Window.alert(response + " ");
}
});
Everytime when i am trying to run the code it shows an "http://localhost:8089 is not allowed by Access-Control-Allow-Origin."
PS: i searched for this error but i don't want to disable the web security of all browsers.
Is there any alternative solution to do get response of localhost server running on different porn on same machine. That is why i want to call a url in client side.
Please suggest a solution.
Edit
Let me explain you full scenario in points:
GWT application is hosted on some server (www.abc.com)
WCF is a web service installed at each client.
A client open his/her browser and put the url (www.abc.com/page)
This page want to access the web services hosted on a client machine.
Can't you configure your WCF service to send an Access-Control-Allow-Origin: www.abc.com response header?
Otherwise, I guess you could use a proxy servlet in www.abc.com that proxies the call to the getRemoteAddr, assuming there's no proxy in-between.
I have deployed war on weblogic with following URL
http://xx.xx.xx.xx:6767/em/index.html
My cisco loadbalancer probe following URL
http://xx.xx.xx.xx:6767/em
and on getting http 200 response it make status of my servers to active.
But currently weblogic is providing 302 status code.
I am unable to identify why it doing so?
I check above both URL through browser and its working fine.
Regards,
imran
A HTTP 302 response is not an error. Only 4nn (client) and 5nn (server) are errors. A 302 simply means that the response is been redirected to another URL. The webserver is apparently redirecting http://xx.xx.xx.xx:6767/em to http://xx.xx.xx.xx:6767/em/ or http://xx.xx.xx.xx:6767/em/index.html.
You just need to let your loadbalancer probe http://xx.xx.xx.xx:6767/em/ or http://xx.xx.xx.xx:6767/em/index.html.
See also:
HTTP status code definitions