• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

How to fix "Problem accessing the absolute URL" exception?

 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I am trying to run the sample code

I am getting

There is a OpenDNS like kind of software installed on our network and we are using a proxy server to connect to the internet where all our traffic is screened. The following code is not working.

I referred this link. The author said that the problem was with his DNS settings. However I cant change my DNS settings? What can I do to resolve this issue?

Can anyone please tell me? Thank you all in advance.
 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you want to import that page? There is no other way to access that page if you cannot change your DNS settings. Otherwise you may have to make that page available locally.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Mathur: I am currently working on a project where few pages will be loaded from already existing applications.

I think I got the solution, hope this should work. It is to remove the url to be screened from my proxy server. Wrote a mail to our admin. Request still in process. Don't know whether this fix will work or not.

What do you guys say? any ideas?
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:@Mathur: I am currently working on a project where few pages will be loaded from already existing applications.

I think I got the solution, hope this should work. It is to remove the url to be screened from my proxy server. Wrote a mail to our admin. Request still in process. Don't know whether this fix will work or not.

What do you guys say? any ideas?



Yes, if the admin could provide access to the url, then it will work.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would also like to know whether this problem has something to do with the VM parameters. Can I place my proxy id and password in the VM parameters list and try streaming the page? I read about the same kind of problem in a post here

http://support.sas.com/kb/16/958.html

However I could not understand few things in it because I have zero knowledge about VM parameters. Never heard about them and read about them.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:I would also like to know whether this problem has something to do with the VM parameters. Can I place my proxy id and password in the VM parameters list and try streaming the page? I read about the same kind of problem in a post here

http://support.sas.com/kb/16/958.html

However I could not understand few things in it because I have zero knowledge about VM parameters. Never heard about them and read about them.



You can try putting these parameters in the file you use to start your servlet container (server start file). And check if it works.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Mathur: I tried my my attempt has failed. I gave my proxy details and proxy port. But I cant find an option to get the proxy password.

Can you please suggest me? Thank you in advance.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:@Mathur: I tried my my attempt has failed. I gave my proxy details and proxy port. But I cant find an option to get the proxy password.

Can you please suggest me? Thank you in advance.



Add following:-

-Dhttp.proxyUser=${userName}
-Dhttp.proxyPassword=${password}
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Mathur: I tried with these settings

-Dhttp.proxyUser=akash.malwa.proxy
-Dhttp.proxyPassword=logmein667#
-Dhttp.proxyHost=192.168.6.241
-Dhttp.proxyPost=8080

Previously I got Connection refused: connect, exception. Now I am getting a FileNotFoundException. The full stack trace is
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:@Mathur: I tried with these settings

-Dhttp.proxyUser=akash.malwa.proxy
-Dhttp.proxyPassword=logmein667#
-Dhttp.proxyHost=192.168.6.241
-Dhttp.proxyPost=8080



??? What is the error that you are getting?
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Palak Mathur wrote:
??? What is the error that you are getting?


Please refer the above edited post. Before I recognized and edited the post you replied. Thanks for the quick reply.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:

Palak Mathur wrote:
??? What is the error that you are getting?


Please refer the above edited post. Before I recognized and edited the post you replied. Thanks for the quick reply.



Did you try some other page?
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes many pages. I referred to this link also

https://coderanch.com/t/206904/sockets/java/accessing-URL-through-java-behind

and the same errors again
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried this method also. But all my efforts are failing. I referred this link
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even when I try to open a connection to a machine on my network it is throwing FileNotFoundException.

The url I gave is

http://192.168.53.32:8080/test/sample.html
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:Even when I try to open a connection to a machine on my network it is throwing FileNotFoundException.

The url I gave is

http://192.168.53.32:8080/test/sample.html



Are you able to ping the local machine? Also check with admin, if it is allowing you to access those web urls through the proxy.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Palak Mathur wrote:Are you able to ping the local machine? Also check with admin, if it is allowing you to access those web urls through the proxy.


I am able to ping it. Beside I tried another example from this link. All attempts are failing.

I am getting the following exception
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank god!!! The problem is with

System.getProperties().put("http.proxyPort", "80");

The port has to be set to 8080. Now its working. However I am not getting the entire web page. And I am not sure this is the right approach. Because I am hard coding the properties using System.getProperties().put(String,String)

Whereas I have only class files. The developers who supplied the code to me have proxy disabled, so they don't need to use the code.

I want to know is there any way to add these to the VM parameter list?
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:Thank god!!! The problem is with

System.getProperties().put("http.proxyPort", "80");

The port has to be set to 8080. Now its working. However I am not getting the entire web page. And I am not sure this is the right approach. Because I am hard coding the properties using System.getProperties().put(String,String)

Whereas I have only class files. The developers who supplied the code to me have proxy disabled, so they don't need to use the code.

I want to know is there any way to add these to the VM parameter list?



Check the posts above, we have already suggested how to set the system property using VM parameter list. You should not require this code then.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but I have to check and make sure.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I see there is not VM parameter to set the proxy user is and proxy password. So we have to use the Authenticator class as I see it.
 
Saloon Keeper
Posts: 28242
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using a read line but a print string. That means that no line-terminator characters are being output. Use println() instead.

In addition to the loss of fidelity, end-of-line typically triggers a buffer flush, without which you could fail to push out all of the input. Although an explicit flush after end-of-file wouldn't hurt.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:You are using a read line but a print string. That means that no line-terminator characters are being output. Use println() instead.

In addition to the loss of fidelity, end-of-line typically triggers a buffer flush, without which you could fail to push out all of the input. Although an explicit flush after end-of-file wouldn't hurt.



I did not understand
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:You are using a read line but a print string. That means that no line-terminator characters are being output. Use println() instead.

In addition to the loss of fidelity, end-of-line typically triggers a buffer flush, without which you could fail to push out all of the input. Although an explicit flush after end-of-file wouldn't hurt.



Tim,

Which part of code are you referring to? Please quote that part.
Thank you.

Regards,
Palak Mathur
 
Tim Holloway
Saloon Keeper
Posts: 28242
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. Do you mean I should not use println() inside a loop while trying to read form a stream?
 
Tim Holloway
Saloon Keeper
Posts: 28242
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chaitanya karthikk wrote:Ok. Do you mean I should not use println() inside a loop while trying to read form a stream?



No, I mean the problem is that you didn't use a println(). You used print().

For a truly faithful (and higher-performance) copy, you would actually want to use a bulk copy, pre-allocating a fixed-sized buffer and filling it up as much as possible on each read/write iteration instead of line-by-line. But in the case of an HTTP output stream, it isn't essential to do that.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

chaitanya karthikk wrote:Ok. Do you mean I should not use println() inside a loop while trying to read form a stream?



No, I mean the problem is that you didn't use a println(). You used print().

For a truly faithful (and higher-performance) copy, you would actually want to use a bulk copy, pre-allocating a fixed-sized buffer and filling it up as much as possible on each read/write iteration instead of line-by-line. But in the case of an HTTP output stream, it isn't essential to do that.



In his another code that he quoted in a later post, he has used println() though without knowing the advantages and disadvantages. Thank you for the explanation and above all having an eye for such details. I surely missed it.
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

chaitanya karthikk wrote:Ok. Do you mean I should not use println() inside a loop while trying to read form a stream?



No, I mean the problem is that you didn't use a println(). You used print().

For a truly faithful (and higher-performance) copy, you would actually want to use a bulk copy, pre-allocating a fixed-sized buffer and filling it up as much as possible on each read/write iteration instead of line-by-line. But in the case of an HTTP output stream, it isn't essential to do that.



Now I am really confused. I dont understand what you are saying. Can you please explain in little bit detail. I am sorry.
 
In the renaissance, how big were the dinosaurs? Did you have tiny ads?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic