File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to fix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to fix "Problem accessing the absolute URL" exception?" Watch "How to fix "Problem accessing the absolute URL" exception?" New topic
Author

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

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

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.


Love all, trust a few, do wrong to none.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

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.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

@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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

@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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

@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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

Yes many pages. I referred to this link also

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

and the same errors again
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

I tried this method also. But all my efforts are failing. I referred this link
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

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

Joined: Sep 15, 2009
Posts: 800

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

Yes, but I have to check and make sure.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Jun 25, 2001
Posts: 15957
    
  19

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Ok. Do you mean I should not use println() inside a loop while trying to read form a stream?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Sep 15, 2009
Posts: 800

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to fix "Problem accessing the absolute URL" exception?
 
Similar Threads
Can't include other page content with RequestDispatcher.include()
jstl <c:import url= /> not working
Doubts on JSTL - import
help on c:import tag problem
import tag in JSTL