You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Natarajan.T" <na...@crimsonlogic.co.in> on 2004/09/21 16:43:22 UTC

Proxy Con. Problem in Weblogic.

Hi FYI,

 

I am doing web crawling in my application using proxy setting. like the
below code..

 

Properties systemSettings = System.getProperties();

systemSettings.put("http.proxySet", "true");

systemSettings.put("http.proxyHost",
profileBean.getProfileParamBean().getProxyHost().trim());

systemSettings.put("http.proxyPort",
profileBean.getProfileParamBean().getProxyPort().trim());

System.setProperties(systemSettings);

 

 

This code working fine in Tomcat5.0 but I am getting runtime error in
Weblogic8.

 

How can I handle this problem???

 

Advance Thanks.

 

 

Regards,

Natarajan.

 

 


Re: Proxy Con. Problem in Weblogic.

Posted by Dmitry Serebrennikov <dm...@earthlink.net>.
This, of course, isn't the right forum for this question...
Not to encourage off-topic posts, but I just happened to know at least 
part of the answer since we just went through the same issue.

First thing to do is to make sure you are setting these properties 
before the first URLStreamHandler for "http" is created. In WebLogic, 
this means you really must specify them on the command line with -D 
options, because by the time your code starts to run, WebLogic has 
already initialized the stream handler. This may or may not help, 
depending on which JVM is being used.

Also, WebLogic supplies its own http stack, they don't use Sun's stack 
that ships with the JVM. Tomcat does, so the behavior will be different. 
As long as you are using WebLogic's http stack, be aware that it has 
different configuration options than the standard Sun's stack. I think 
the proxy settings use the same -D options, but I may be wrong.

You can control which stack is used in various ways. WebLogic recognizes 
a -D option called: weblogic.net.http.URLStreamHandlerFactory. Google 
for it and you will find out how it is supposed to work. I know it works 
at least some of the time, but I wasn't able to get it to work for me.

Another way that does work is to set a URLStreamHandler on the URL 
object when you create it (see java.net.URL constructors). You can 
create a URLStreamHandler object explicitly and this way force the use 
of Sun's stack. Sun's handler is called sun.net.www.protocol.http.Handler.

Hope this helps.
Good luck!

Dmitry.


Natarajan.T wrote:

>Hi FYI,
>
> 
>
>I am doing web crawling in my application using proxy setting. like the
>below code..
>
> 
>
>Properties systemSettings = System.getProperties();
>
>systemSettings.put("http.proxySet", "true");
>
>systemSettings.put("http.proxyHost",
>profileBean.getProfileParamBean().getProxyHost().trim());
>
>systemSettings.put("http.proxyPort",
>profileBean.getProfileParamBean().getProxyPort().trim());
>
>System.setProperties(systemSettings);
>
> 
>
> 
>
>This code working fine in Tomcat5.0 but I am getting runtime error in
>Weblogic8.
>
> 
>
>How can I handle this problem???
>
> 
>
>Advance Thanks.
>
> 
>
> 
>
>Regards,
>
>Natarajan.
>
> 
>
> 
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org