Connect to a url using httpclient
I want to connect to a url using httpClient.
Can someone help me with the steps or the code to do so?
Also what jar files I need to have httpClient.
Thanks,
Thanks for the reply.I used the following code and geting the below error
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try
DefaultHttpClient http = new DefaultHttpClient();
final String username = "domain\\username";
final String password = "password";
UsernamePasswordCredentials c = new UsernamePasswordCredentials(username, password);
BasicCredentialsProvider cP = new BasicCredentialsProvider();
cP.setCredentials(AuthScope.ANY, c);
http.setCredentialsProvider(cP);
String urlString = "http://mymachine/ReportServer/Pages/ReportViewer.aspx?";
URL url = new URL(urlString);
HttpPost post = new HttpPost(url.toURI());
HttpResponse responseTest= http.execute(post);
System.out.println(" The statusline is"+responseTest.getStatusLine());
catch(Exception ex)
System.out.println("The exception is"+ex);
The error I am geting is
Apr 12, 2013 10:45:00 AM org.apache.http.client.protocol.RequestAuthenticationBa
se process
WARNING: NEGOTIATE authentication error: Invalid name provided (Mechanism level:
Could not load configuration file C:\Windows\krb5.ini (The system cannot find t
he file specified))
The statusline isHTTP/1.1 401 Unauthorized
Similar Messages
-
Connecting to a URL using real phone
Hi,
I have a URL that works perfectly when I use my PC browser.
I have a simple application in my Midlet to access the same URL , but when running the application on my phone and when it gets to connect to the URL, it asks me "This is going over data network, do you want to continue?" and I answer "yes", but nothing happens. I waited for a minute and still nothing happened.
The application is pretty simple. Has anybody seen this before? Any opinions or comments would be much appreciated
String invokeServlet(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
StringBuffer b = new StringBuffer();
TextBox t = null;
try {
c = (HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1) {
b.append((char) ch);
//System.out.println((char)ch);
t = new TextBox("First Servlet", b.toString(), 1024, 0);
} finally {
if(is!= null) {
is.close();
if(c != null) {
c.close();
return b.toString();
Thanks a million,
S.Call the function in a different thread of the application
it may solve the problem.
or try to trace the exception if there is as mentioned before. -
Error while connecting with the url using odata...please help
hi All,
I was trying to do one basic ODATA example which i got from the threads.
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>Table with OData Binding</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'
data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_bluecrystal"></script>
<script>
// the root URL of the OData service - prefixed with a local URL to a proxy which forwards the request,
circumventing cross-domain restrictions
// IMPORTANT: this proxy must be available for the code example to run!
var url = "http://services.odata.org/Northwind/Northwind.svc";
// create an ODataModel from URL
var oModel = new sap.ui.model.odata.ODataModel(url, true);
var oTable = new sap.ui.table.Table("sampleTable");
oModel.read("/Customers",null,null,null,function(){
var metadata = oModel.getServiceMetadata();
var entityCustomerRef = metadata.dataServices.schema[0].entityType[2];
var listOfProperties = entityCustomerRef.property;
for ( var i = 0; i < listOfProperties.length; i++) {
oTable.addColumn(new sap.ui.table.Column().setLabel(
new sap.ui.commons.Label({
text : listOfProperties[i].name,
})).setTemplate(
new sap.ui.commons.TextField().bindProperty("value",
listOfProperties[i].name))) }
oTable.setModel(oModel); // set model to Table
oTable.bindRows("/Customers");
oTable.placeAt("content"); // place model onto UI
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
but when i try to execute the same it is not loading any data and showing the error as :
2014-07-21 16:04:05 (default) : https://sapui5.hana.ondemand.com/resources/ - sap.ui.ModuleSystem sap-ui-core.js:80
2Failed to load resource: the server responded with a status of 501 (Not Implemented) http://services.odata.org/Northwind/Northwind.svc/$metadata
XMLHttpRequest cannot load http://services.odata.org/Northwind/Northwind.svc/$metadata. Invalid HTTP status code 501 odata.html:1
2014-07-21 16:04:16 The following problem occurred: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://services.odata.org/Northwind/Northwind.svc/$metadata'. - sap-ui-core.js:80
Failed to load resource: the server responded with a status of 501 (Not Implemented) http://services.odata.org/Northwind/Northwind.svc/CustomersXMLHttpRequest cannot load http://services.odata.org/Northwind/Northwind.svc/Customers. Invalid HTTP status code 501 odata.html:1
2014-07-21 16:04:17 The following problem occurred: HTTP request failed0,, - sap-ui-core.js:80;;
But i can launch the url with metadata through browser..kindly help???Hi Arun,
replace the following line in your code:
var url = "http/services.odata.org/Northwind/Northwind.svc";
with the following:
var url = "proxy/http/services.odata.org/Northwind/Northwind.svc";
It will either work fine or this error will be skipped. -
Connecting to an URL with a username and password?
hey, I was trying to connect to a URL using:
URL url = new URL("http://%20:[email protected]/Status.htm");
but it gets the 401 access denied page...
Does anyone know how to get it to login correctly?See http://www.javaworld.com/javatips/jw-javatip47.html
-
Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following error:
Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver. Please check that the library path is set up properly or switch to the JDBC thin client oracle/jdbc/driver/T2CConnection.getLibraryVersioNumber()
Checks performed:
RMS Application code location and directory contents:
[oracle@test-rms-app application]$ pwd
/binary_files/STAGING_DIR/rms/application
[oracle@test-rms-app application]$ ls -ltr
total 144
-rw-r--r-- 1 oracle oinstall 272 Dec 7 2010 version.properties
-rw-r--r-- 1 oracle oinstall 405 Jan 16 2011 expected-object-counts.properties
-rw-r--r-- 1 oracle oinstall 892 May 13 2011 ant.install.properties.sample
-rw-r--r-- 1 oracle oinstall 64004 Jun 6 2011 build.xml
drwxr-xr-x 9 oracle oinstall 4096 Jun 16 2011 rms13
drwxr-xr-x 3 oracle oinstall 4096 Jun 16 2011 installer-resources
drwxr-xr-x 3 oracle oinstall 4096 Jun 16 2011 antinstall
drwxr-xr-x 2 oracle oinstall 4096 Jun 16 2011 ant-ext
drwxr-xr-x 5 oracle oinstall 4096 Jun 16 2011 ant
-rw-r--r-- 1 oracle oinstall 11324 Dec 18 09:18 antinstall-config.xml.ORIG
-rwxr-xr-x 1 oracle oinstall 4249 Dec 18 10:01 install.sh
drwxr-xr-x 4 oracle oinstall 4096 Dec 18 10:06 common
-rw-r--r-- 1 oracle oinstall 16244 Dec 19 10:37 antinstall-config.xml
-rw-r--r-- 1 oracle oinstall 689 Dec 19 10:37 ant.install.log
[oracle@test-rms-app application]$
Application installation:
[oracle@test-rms-app application]$ ./install.sh
THIS IS the driver directory
Verified $ORACLE_SID.
Verified SQL*Plus exists.
Verified write permissions.
Verified formsweb.cfg read permissions.
Verified Registry.dat read permissions.
Verified Java version 1.4.2.x or greater. Java version - 1.6.0
Verified Tk2Motif.rgb settings.
Verified frmcmp_batch.sh status.
WARNING: Oracle Enterprise Linux not detected. Some components may not install properly.
Verified $DISPLAY - 172.16.129.82:0.0.
This installer will ask for your "My Oracle Support" credentials.
Preparing installer. This may take a few moments.
Your internet connection type is: NONE
Integrating My Oracle Support into the product installer workflow...
[move] Moving 1 file to /binary_files/STAGING_DIR/rms/application
Installer preparation complete.
MW_HOME=/u01/app/oracle/Middleware/NewMiddleware1034
ORACLE_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/as_1
ORACLE_INSTANCE=/u01/app/oracle/Middleware/NewMiddleware1034/asinst_1
DOMAIN_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/user_projects/domains/rmsClassDomain
WLS_INSTANCE=WLS_FORMS
ORACLE_SID=rmsdbtst
JAVA_HOME=/u01/app/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0
Launching installer...
To make sure I have connectivity from the app server to the database (on a database server) here are the steps followed:
[oracle@test-rms-app application]$ tnsping rmsdbtst
TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 19-DEC-2013 10:41:40
Copyright (c) 1997, 2008, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-rms-db.vonmaur.vmc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rmsdbtst)))
OK (0 msec)
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ sqlplus rms13@rmsdbtst
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Dec 19 10:46:18 2013
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ ping test-rms-db
PING test-rms-db.vonmaur.vmc (192.168.1.140) 56(84) bytes of data.
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=1 ttl=64 time=0.599 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=2 ttl=64 time=0.168 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=3 ttl=64 time=0.132 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=4 ttl=64 time=0.158 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=5 ttl=64 time=0.135 ms
--- test-rms-db.vonmaur.vmc ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4001ms
rtt min/avg/max/mdev = 0.132/0.238/0.599/0.181 ms
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ uname -a
Linux test-rms-app.vonmaur.vmc 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ cat /etc/*-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
[oracle@test-rms-app application]$
The database is created and all the batch file scripts have been successfully deployed. Now working on the application server. The Weblogic server is installed and 11g forms and reports are installed successfully.
Any help would be helpful.
Thanks,
Ram.Please check MOS Notes:
FAQ: RWMS 13.2 Installation and Configuration (Doc ID 1307639.1) -
Connection reset exception while accessing the server page using HttpClient
hi all,
In my servlet class I am using HttpClient to connect to the server.
while connecting i am getting the below exception...
please guide me guys..
Nov 21, 2007 4:29:23 PM org.apache.commons.httpclient.HttpMethodBase processRequest
INFO: Recoverable exception caught when processing request
Nov 21, 2007 4:29:23 PM org.apache.commons.httpclient.HttpMethodBase processRequest
WARNING: Recoverable exception caught but MethodRetryHandler.retryMethod() returned false, rethrowing exception
org.apache.commons.httpclient.HttpRecoverableException: java.net.SocketException: Connection reset
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1962)
at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2653)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1087)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:643)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:497)
at LoginToKotak.accountTxn(LoginToKotak.java:916)
at LoginToKotak.kotakAmountTxn(LoginToKotak.java:147)
at ResponseServlet_kotakMB.getAccountTxn(ResponseServlet_kotakMB.java:158)
at ResponseServlet_kotakMB.processRequest(ResponseServlet_kotakMB.java:128)
at ResponseServlet_kotakMB.doPost(ResponseServlet_kotakMB.java:197)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:595)Mallikarjuna,
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 1, column 7:As the error message specifies.. table XXCUR_TRADE_CUSTOMER_DETAILS doesnt exists.
Create a synonyms for this table in apps schema with all the grants.
Regards,
Gyan -
Error with opening a connection to a url (for cgi use)
i still am having trouble using a cgi executable on my server, but i cant seem to narrow down what my problem is.
i followed the following tutorial, but am still getting errors.
http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html
// first of all, am I doing this right? all the examples leave out the '.cgi' at the end, why?
//does it matter? i tried both ways, i even tried with the ?var1=something stuff at the end. nope.
url = new URL("http://www.somewhere.com/" + "write.cgi");
urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
// here is where I get an IOException error ---- error.getCause() yields an output of null
PrintWriter out = new PrintWriter(urlConnection.getOutputStream());
// i also am not sure how sending to the cgi works. my cgi file was written to parse a string
// such as this: "http://www.somewhere.com/fileio.cgi?field1=something&field2=something+else"
out.println("whatever i need to send it")
out.close();is it possible i'm getting this error because my cgi file isnt set up right? i am confident that it is ok, but i dont know for sure, nor do i know how to test it. typing in
/fileio.cgi?field1=something&field2=something+else into the working directory of my webpage yields an error that says something like that page isnt readable. i had hoped i could test the cgi this way...is there another way?
thanks!Using the URLConnection output stream doesn't append attributes to the url. If you want to send parameters on the url use
url = new URL("http://www.somewhere.com/write.cgi?field1=something&field2=something+else"); -
Need help on how to use HttpClient.
I am using HttpClient to implement login functionality of a website. This website has a login page(username, password, comapny number) and a submit button. On logging the server redirects the customer to Welcome page.
When I supply all the details needed of login page using HttpClient, server is returning the following response.
<html><head><title>Object moved</title></head><body>
<h2>Object moved to left arrow(<)a href="%2fwelcome.aspx">here</a>.</h2>
</body></html>
Can you please tell me what should I do to get to the welcome page?
I think I was successful in login, but the server is redirecting me to the welcome page. Am I right?
Or Is there any other best way to implement this?
Here is a snippet of the code I have written.......Plz any help is appreciated..
HttpClient httpClient = new HttpClient();
HttpClientParams params = httpClient.getParams( );
params.setBooleanParameter( HttpClientParams.REJECT_RELATIVE_REDIRECT, false );
params.setBooleanParameter( HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, false );
params.setIntParameter( HttpClientParams.MAX_REDIRECTS, 10 );
PostMethod postMethod = new PostMethod(url);
NameValuePair[] data = {
new NameValuePair("B1", "Login"),
new NameValuePair("companyNumber", "1234"),
new NameValuePair("user", "remo"),
new NameValuePair("password", "sha"),
postMethod.setRequestBody(data);
int responseCode = httpClient.executeMethod(postMethod);
System.out.println( "Response Code: " + postMethod.getStatusCode( ) );
String responseBody = postMethod.getResponseBodyAsString();
System.out.println(responseBody);
Edited by: 836726 on Jun 1, 2011 11:01 AMI'd recommend you start here: Getting Started with Adobe Connect - Adobe Connect User Community
-
Problems in Downloading a file from a web site using HttpClient
Hi,
My requirement is to download a file from a website using a java program. I have written a program using HttpClient API but I am unable to do so. Reality is that I don't know how to proceed with the HttpClient API to get the file downloaded. Same file can also be downloaded manually by login to that website, below mentioned steps are to be followed to download the file manually.
1. Login to the website using Login/Password (I have valid login/password)
2. Two options (links) are there (a) Report (b) Search [I am chosing report option]
3. Newly opened window shows two tabs (a) Today (b) From & To [I am selection Today tab]
4. Every tab has two radio button (a) File (b) Destination [Destination is selected by me]
5. When Search button is pressed. A link gets created when that link is clicked file download popup is opened which allows facility to open/save the file.
All these 5 step are to be followed in a java program to download the file. Please help in doing the same.// first URL which is used to open the website, this will have two text fields userName and password
String finalURL = "http://www.xyz.in/mstatus/index.php";
SMSGatewayComponentImpl obj = new SMSGatewayComponentImpl();
obj.sendMessage(finalURL);
public void sendMessage(String finalURL) {
String ipAddrs = "a.b.c.d";
int port = 8080;
boolean flag = false;
try {
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setProxy(ipAddrs,port);
client.setHostConfiguration(hostConfig);
// Create a method instance.
String cookieName=null;
String cookieValue=null;
// Here URL for the login page is passed and passing the user/password
PostMethod method = new PostMethod(finalURL);
method.setRequestHeader("userid","userName");
method.setRequestHeader("passwd","pwd");
// Execute the method.
int statusCode = client.executeMethod(method);
Cookie[] cookies = client.getState().getCookies();
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies;
cookieName = cookie.getName();
cookieValue = cookie.getValue();
System.err.println(
"Cookie: " + cookie.getName() +
", Value: " + cookie.getValue() +
", IsPersistent?: " + cookie.isPersistent() +
", Expiry Date: " + cookie.getExpiryDate() +
", Comment: " + cookie.getComment());
NameValuePair[] respParameters = method.getResponseHeaders();
String cookie = "";
for(NameValuePair o : respParameters){
System.out.println("Name : "+o.getName());
System.out.println("Value : "+o.getValue());
if("Set-Cookie".equalsIgnoreCase(o.getName()))
cookie = o.getValue();
NameValuePair[] footParameters = method.getResponseFooters();
System.out.println("****************** Footer Values *******************");
for(NameValuePair o1 : footParameters){
System.out.println("Name : "+o1.getName());
System.out.println("Value : "+o1.getValue());
// This is jthe URL which comes when login/passowrd is entered and Login button is pressed.
// I am trying to get the cookie from the first URL and pass this cookie for the second URL so that the session can be maintained
// Here I may be wron..don't know is this the right way to download the file like this.....????
finalURL = "http://www.xyz.in/mstatus/mainmenugrsms.php";
method = new PostMethod(finalURL);
method.setRequestHeader(cookieName,cookieValue);
method.setRequestHeader("userid","userName");
method.setRequestHeader("passwd","pwd");
method.setRequestHeader("Set-Cookie",cookie);
statusCode = client.executeMethod(method);
respParameters = method.getResponseHeaders();
for(NameValuePair o : respParameters){
System.out.println("Name : "+o.getName());
System.out.println("Value : "+o.getValue());
// and this is the final URL which i got when that final link which enabled file download from the website have been copied as a shortcut and
// pasted in a notepad. I was thinking that this will return the file as an input stream. but its not happening.
finalURL = "http://www.xyz.in/mstatus/dlr_date.php#";
method = new PostMethod(finalURL);
method.setRequestHeader("Set-Cookie",cookie);
method.setRequestHeader("userid","userName");
// userid and passwd field are obtained when login/password page contents are seen using view source of that html
method.setRequestHeader("type","1");
// trying to set the cookie so that session can be maintained
method.setRequestHeader(cookieName,cookieValue);
method.setRequestHeader("passwd","pwd");
statusCode = client.executeMethod(method);
ObjectInputStream objRetInpuStream = new ObjectInputStream(method.getResponseBodyAsStream());
System.out.println("objRetInpuStream : "+objRetInpuStream);
if(objRetInpuStream!=null)
System.out.println("objRetInpuStream available bytes : "+objRetInpuStream.available());
String returnFile=(String)objRetInpuStream.readObject();
System.out.println("Returned value \n : "+returnFile);
respParameters = method.getResponseHeaders();
for(NameValuePair o : respParameters){
byte[] responseBody = method.getResponseBody();
System.out.println("Response Body : "+new String(responseBody));
if (statusCode != HttpStatus.SC_OK) {
System.out.println("Error: " + method.getStatusLine());
} else {
System.out.println(method.getStatusLine());
} catch(Exception nfe) {
System.out.println("Exception " + nfe);
Output
=====
/home/loguser/batch> sh run.sh SMSGatewayComponentImpl
Classname : SMSGatewayComponentImpl
run.sh[4]: test: 0403-004 Specify a parameter with this command.
final URL : http://www.xyz.in/mstatus/index.php
client is :org.apache.commons.httpclient.HttpClient@190e190e
Cookie: PHPSESSID, Value: anqapu83ktgp8hlot06jtbmdf1, IsPersistent?: false, Expiry Date: null, Comment: null
Name : Date
Value : Thu, 06 May 2010 09:08:47 GMT
Name : Server
Value : Apache/2.2.3 (Red Hat)
Name : X-Powered-By
Value : PHP/5.1.6
Name : Set-Cookie
Value : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
Name : Expires
Value : Thu, 19 Nov 1981 08:52:00 GMT
Name : Cache-Control
Value : no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Name : Pragma
Value : no-cache
Name : Content-Length
Value : 4792
Name : Content-Type
Value : text/html; charset=UTF-8
Name : X-Cache
Value : MISS from dcp.pas.abc.in
Name : X-Cache-Lookup
Value : MISS from dcp.pas.abc.in:8080
Name : Via
Value : 1.0 dcp.pas.abc.in:8080 (squid/2.6.STABLE21)
Name : Proxy-Connection
Value : keep-alive
Cookie Value : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
****************** Footer Values *******************
Name-2 : Date
Value-2: Thu, 06 May 2010 09:08:47 GMT
Name-2 : Server
Value-2: Apache/2.2.3 (Red Hat)
Name-2 : X-Powered-By
Value-2: PHP/5.1.6
Name-2 : Expires
Value-2: Thu, 19 Nov 1981 08:52:00 GMT
Name-2 : Last-Modified
Value-2: Thu, 06 May 2010 09:08:47 GMT
Name-2 : Cache-Control
Value-2: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Name-2 : Pragma
Value-2: no-cache
Name-2 : Location
Value-2: index.php
Name-2 : Content-Length
Value-2: 0
Name-2 : Content-Type
Value-2: text/html; charset=UTF-8
Name-2 : X-Cache
Value-2: MISS from dcp.pas.abc.in
Name-2 : X-Cache-Lookup
Value-2: MISS from dcp.pas.abc.in:8080
Name-2 : Via
Value-2: 1.0 dcp.pas.abc.in:8080 (squid/2.6.STABLE21)
Name-2 : Proxy-Connection
Value-2: keep-alive
Cookie Value second time : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
**Exception java.io.EOFException**
Is my approach to download the file fromthe website ok????? please help me. -
JDBC connection pool failures when used by JMS stores
We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
a JMS Store.
<JDBCConnectionPool Name="sybaseJMSPool"
Targets="cluster00"
InitialCapacity="2"
MaxCapacity="10"
DriverName="com.sybase.jdbc2.jdbc.SybDriver"
Properties="[email protected]@;[email protected]@;charset=utf8"
URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
(note that the @xxx@ string are replaced by actual values).
We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
We deployed this configuration on a number of environments (testing, staging,
..). The actual hardware and network configuration is different for the different
system, but the WebLogic domain stays the same regarding this issue.
On the test system we frequently get the following exceptions:
<Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
<ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
<JMSServer "JMSServer00", store failure while writing message for topic
OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
<sybaseJMSPool>, prefix = <JMS00>: write failed
java.sql.SQLException: JZ006: Caught IOException:
com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
closed.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
(ErrorMessage.java:715)
at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
(SybStatement.java:1625)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
(SybPreparedStatement.java:91)
at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
(P6LogPreparedStatement.java:179)
at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
.>
java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
= <JMS00>: write failed
java.sql.SQLException: JZ006: Caught IOException:
com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
closed.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
(ErrorMessage.java:715)
at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
(SybStatement.java:1625)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
(SybPreparedStatement.java:91)
at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
(P6LogPreparedStatement.java:179)
at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
at weblogic.jms.store.JDBCIOStream.throwIOException
(JDBCIOStream.java:1213)
at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Before that this message appeared:
<Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
<node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
<Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
received a message over an uninitialized connection: 'JVMMessage from: 'null'
to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
offset: '34'''>
This problem did not occur on another system which was used during a 2 day stress
testing session.
It seems that the problem occurs after a period in which no user request where
made. The user requests trigger EJB's that start sending JMS messages.
When the problem occurs, the JMS messaging systems seems to lock up as no messages
are received anymore by the different listeners (MDBs).
Undeploying and redeploying the JBDC connection pool solves the problem. This
solution is unacceptable in case of a production system.
A similarly defined connection pool, which is used by the EJBs to make database
connection, does not manifest this problem.
<JDBCConnectionPool Name="sybasePool"
Targets="cluster00"
InitialCapacity="10"
CapacityIncrement="5"
MaxCapacity="50"
PreparedStatementCacheSize="150"
DriverName="com.sybase.jdbc2.jdbc.SybDriver"
Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
The JDBC connection pool is used as follows by the JDBC store
<JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
<JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
<JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
<JMSTopic JNDIName="ADIS.Status"
Name="StatusTopic" RedeliveryDelayOverride="300000"/>
<JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
Name="OrderChangeTopic" RedeliveryLimit="3"/>
</JMSServer>
Turning on the "Test Reserved Connection" with a appropriate test table does not
help.
Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
can be related to network problems. Nevertheless the connection pool should be
able to cope with this.
Can you provide any solution for this ? Or give us hints what can cause the problem
Zhenhao Qi wrote:
thanks! Joe.
The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
allowances for one thread to interrupt a second thread's JDBC call. If we
transmit your timeout request by calling setQueryTimeout() on the oracle
statement, and if you have a weblogic-controlled transaction we call
Statement.cancel() on any ongoing statement, we end up relying on whether
the Oracle driver implements and responds to those calls.
Are you doing weblogic-controlled transactions? Are you/can you
call Statement.setQueryTimeout() on your statements, or are these
generated JDBC queries?
If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
we have some other debug avenues. This would be good even if you really
want to use the thin driver, because we will do the same JDBC calls to
either driver, and the debug would prove (if) we set up a query timeout
and if we call cancel(). If we do, then we can know that it is the Oracle
driver failing in these regards.
Joe -
Error while posting xml file to URL using URLConnection
Hello everyone,
I am facing an issue from long time related to URLConnection. If this would be resolved by your help then I would be very grateful to you.
One application which posts xml file to URL hangs and after waiting for 5 mins it throws 504 error:
java.io.IOException: Server returned HTTP response code: 504 for URL: http:hostname.
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:715)
Same application is running fine without error on another environment from last 5 years. But on another env it is erroring out from the day 1.
We have many workarounds in place none worked.
I tried to use HttpClient from apache but that too hanged at URLConnection.getInputStream() method call.
App is running on iPlanet web server 6.1 using JDK 1.4.0_03
We still dont know why this program hangs at that particular line in only one env but many times it runs fine. That means 30% of the times it posts xml file without error but 70% times it errors out. So our program logic is to retry until post is successful.
Once this issue is resolved we will remove the logic of trying again and agian.
Please provide inputs.
Thanks,
NitinThe HTTP response 504 means that the server, acting as a gateway, has not received a response from an upstream server in the time it expected.
I think this is problem is due to the remote server that receives the XML and takes too long to return a response to the local application that posted the XML.
Try HttpClient and set the timeout variable of the HttpClient instance used.
Here http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/PostXML.java?revision=480424&view=markup
a Post XML sample.
NB: HttpClient > setTimeout method is deprecated. See : http://jakarta.apache.org/commons/httpclient/apidocs/index.html for an alternative
Hope That Helps -
Issue while creating connection pool in weblogic using SERVICE NAME
Found two issues while creating connection pool in weblogic using SERVICE NAME
1. While running apps from jdeveloper using xxx-jdbc.xml
weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Io exception: The Network Adapter could not establish the connection
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:214)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1051)
2. Configuriing the jndi in Weblogic server
weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:SERVICENAME
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:253)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1109)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1033)
Problem
database url is generated based on SID
eg: jdbc:oracle:thin:@localhost:1521:SID
Solution
(generate seperate url for SERVICE NAME)
jdbc:oracle:thin:@localhost:1521/SERVICENAME
------------------------It is so clear: host not found error for network connection and the other SID servcie name not found means your oracle instance name is not up. check with srvctl status for given servcie name or node, else check CRS_Stat -t if you are using RAC.
-
Accessing External Url using Http Utility | Error when using from Weblogic on Solaris
We are using Http Utility (http://jakarta.apache.org/commons/httpclient/) from
Apache for accessing external URL. A XML string is sent as POST parameter to the
URL and the response is also an XML string. The URL is accessed over HTTPS protocol.
I am setting the following parameters in the java class:
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// set the property
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
The java class written to access the external URL using Http Utility works perfectly
fine when it is run from either the command line (of Windows or Solaris using
main() ) or from weblogic on windows. The same java class throws an exception
when run from Solaris instance of Weblogic
2003-09-30 11:02:12,411 FATAL [com.bp.beyondbp.presentation.userregistration.action.LloydsValidator]
EXCEPTION: com.bp.beyondbp.presentation.userregistration.exception.LlyodsValidationFailedException,
MESSAGE: Write Channel Closed, possible SSL handshaking or trust failure;
CAUSE: (java.io.IOException: Write Channel Closed, possible SSL handshaking or
trust failure)
at com.bp.beyondbp.presentation.userregistration.action.LloydsValidator.postXMLtoLloyd(LloydsValidator.java:243)
at com.bp.beyondbp.presentation.userregistration.action.LloydsValidator.validateLlyodsForNewUser(LloydsValidator.java:95)
at com.bp.beyondbp.presentation.userregistration.action.PreferencesActionForm.validate(PreferencesActionForm.java:326)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust failure
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
Source)
at com.certicom.tls.record.ReadHandler.interpretContent(Unknown Source)
at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
Source)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(HttpConnection.java:1344)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:67)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:125)
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:779)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2179)
at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2534)
I tried to debug the problem by looking at system properties on windows and solaris,
the difference that I found was
On Windows
[exec] tModelInstanceInfo_description : com.sun.net.ssl.internal.www.protocol
On Solaris
[exec] tModelInstanceInfo_description : weblogic.utils|weblogic.tils|weblogic.net|weblogic.management
After this I changed the startWLS.sh on Solaris and set
-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol in java options.
On looking the system properties again, the output was
[exec] tModelInstanceInfo_description : com.sun.net.ssl.internal.www.protocol|weblogic.utils|weblogic.utils|weblogic.net|weblogic.management
But still the error is same. Can somebody help me out here as to what is going
wrong? Please find the java class attached for reference, please have a look at
postXMLtoLloyd() method in the class file..
[LloydsValidator.java]We are using Http Utility (http://jakarta.apache.org/commons/httpclient/) from
Apache for accessing external URL. A XML string is sent as POST parameter to the
URL and the response is also an XML string. The URL is accessed over HTTPS protocol.
I am setting the following parameters in the java class:
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// set the property
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
The java class written to access the external URL using Http Utility works perfectly
fine when it is run from either the command line (of Windows or Solaris using
main() ) or from weblogic on windows. The same java class throws an exception
when run from Solaris instance of Weblogic
2003-09-30 11:02:12,411 FATAL [com.bp.beyondbp.presentation.userregistration.action.LloydsValidator]
EXCEPTION: com.bp.beyondbp.presentation.userregistration.exception.LlyodsValidationFailedException,
MESSAGE: Write Channel Closed, possible SSL handshaking or trust failure;
CAUSE: (java.io.IOException: Write Channel Closed, possible SSL handshaking or
trust failure)
at com.bp.beyondbp.presentation.userregistration.action.LloydsValidator.postXMLtoLloyd(LloydsValidator.java:243)
at com.bp.beyondbp.presentation.userregistration.action.LloydsValidator.validateLlyodsForNewUser(LloydsValidator.java:95)
at com.bp.beyondbp.presentation.userregistration.action.PreferencesActionForm.validate(PreferencesActionForm.java:326)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1058)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:401)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
java.io.IOException: Write Channel Closed, possible SSL handshaking or trust failure
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown
Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
Source)
at com.certicom.tls.record.ReadHandler.interpretContent(Unknown Source)
at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
Source)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(HttpConnection.java:1344)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:67)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:125)
at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:779)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2179)
at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2534)
I tried to debug the problem by looking at system properties on windows and solaris,
the difference that I found was
On Windows
[exec] tModelInstanceInfo_description : com.sun.net.ssl.internal.www.protocol
On Solaris
[exec] tModelInstanceInfo_description : weblogic.utils|weblogic.tils|weblogic.net|weblogic.management
After this I changed the startWLS.sh on Solaris and set
-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol in java options.
On looking the system properties again, the output was
[exec] tModelInstanceInfo_description : com.sun.net.ssl.internal.www.protocol|weblogic.utils|weblogic.utils|weblogic.net|weblogic.management
But still the error is same. Can somebody help me out here as to what is going
wrong? Please find the java class attached for reference, please have a look at
postXMLtoLloyd() method in the class file..
[LloydsValidator.java] -
Unable to connect to an instance using EM but connecting fine with SQL*Plus
Good morning,
I followed these steps (from the 2 Day DBA document):
1. I created a template (including database) from an instance named "orcl" using DBCA, before proceeding to create the template, DBCA informed me that the instance would be shutdown, I told it to proceed.
2. The template was created successfully.
3. I am now unable to log into the orcl instance using EM, yet I can log into that instance without any problems using SQL*Plus.
The Question: Why am I not able to connect to the instance using EM ? and what do I need to do to correct this problem ?
Thank you very much for your help,
John.
PS: in case it may be helpful, the listener, tnsnames and Sqlnet files follow:
# listener.ora Network Configuration File: E:\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = E:\Oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:E:\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ORACLE2DAY1)(PORT = 1521))
ADR_BASE_LISTENER = E:\Oracle
# tnsnames.ora Network Configuration File: E:\Oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
DBCA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORACLE2DAY1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbca.localsite.com)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORACLE2DAY1)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORACLE2DAY1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localsite.com)
# sqlnet.ora Network Configuration File: E:\Oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)Hi Chinar,
What you suggested solved the problem.
I am grateful for your help but, please, the next time you suggest a process that takes over an hour to complete, let me know beforehand.
thank you for your help, I do appreciate it.
John.
PS: here are the result of the process:
0 07:57 [Oracle] [17G] [608M] E:\Temp>emca -deconfig dbcontrol db -repos drop
STARTED EMCA at Aug 15, 2010 7:58:21 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user:
Password for SYS user: abc123
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: y
Aug 15, 2010 7:59:37 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at E:\Oracle\cfgtoollogs\emca\orcl\emca_201
0_08_15_07_58_21.log.
Aug 15, 2010 7:59:38 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be p
erformed.
Aug 15, 2010 7:59:38 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Aug 15, 2010 8:06:59 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Aug 15, 2010 8:07:17 AM
0 08:09 [Oracle] [17G] [355M] E:\Temp>emca -config dbcontrol db -repos create
STARTED EMCA at Aug 15, 2010 8:09:23 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Listener port number: 1521
Listener ORACLE_HOME [ E:\Oracle\product\11.2.0\dbhome_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Password for SYSMAN user: Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
You have specified the following settings
Database ORACLE_HOME ................ E:\Oracle\product\11.2.0\dbhome_1
Local hostname ................ 192.168.3.134
Listener ORACLE_HOME ................ E:\Oracle\product\11.2.0\dbhome_1
Listener port number ................ 1521
Database SID ................ orcl
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
Do you wish to continue? [yes(Y)/no(N)]: y
Aug 15, 2010 8:10:51 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at E:\Oracle\cfgtoollogs\emca\orcl\emca_201
0_08_15_08_09_23.log.
Aug 15, 2010 8:11:10 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Aug 15, 2010 8:43:41 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Aug 15, 2010 8:44:09 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepos
itory
INFO: Uploading configuration data to EM repository (this may take a while) ...
Aug 15, 2010 8:47:39 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Aug 15, 2010 8:48:31 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareL
ib
INFO: Software library configured successfully.
Aug 15, 2010 8:48:31 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibra
ry
INFO: Deploying Provisioning archives ...
Aug 15, 2010 8:53:19 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibra
ry
INFO: Provisioning archives deployed successfully.
Aug 15, 2010 8:53:34 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Aug 15, 2010 8:54:22 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Aug 15, 2010 8:54:38 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Aug 15, 2010 9:12:50 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Aug 15, 2010 9:13:09 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://192.168.3.134:5501/em <<<<
<<<<<<<
Aug 15, 2010 9:14:22 AM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************ WARNING ************************
Management Repository has been placed in secure mode wherein Enterprise Manager
data will be encrypted. The encryption key has been placed in the file: E:/Orac
le/product/11.2.0/dbhome_1/192.168.3.134_orcl/sysman/config/emkey.ora. Please
ensure this file is backed up as the encrypted data will become unusable if this
file is lost.
Enterprise Manager configuration completed successfully
FINISHED EMCA at Aug 15, 2010 9:14:22 AM
0 09:14 [Oracle] [17G] [603M] E:\Temp> -
How to connect the database (JDBC) using service name rather than SID
How should we make the connection to the database using service name. Initially, we are using the SID to make the database connection, with following setting in the data-source.xml in OC4J using ABCDB as the SID.
<data-sources>
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="jdbc/ABCDB"
location="jdbc/ABCDB"
pooled-location="jdbc/OracleDSPooled"
xa-location="jdbc/xa/OracleDSXA"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="ABC"
password="ABC"
url="jdbc:oracle:thin:@191.1.4.126:1521:ABCDB"
/>
</data-sources>
It work, but now we need to make the connection using this service name ABCSERVICE, but it doesn't work in the OC4J (JDBC). May I know how should we handle this connection?
Thanks and Regards,
PangFinally, I got the solution to make the database connection using service name, with putting the tnsname setting in URL portion.
url="jdbc:oracle:thin:@(description=(address=(host=191.1.4.126)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME = ABCSERVICE)))"
And now, it is working fine.
Regards,
Pang
Maybe you are looking for
-
I went thru upgrade to ios7, then a few days later there was an alert in settings, so I clicked on the update to THAT upgrade... then my phone went black... no turning off or on. So I plugged into my PC and it will only show an iTunes logo a small wh
-
Adding a New Dimension to a CUBE
Hello Being in new at Oracle OLAP... If I need to add a new dimension, SHOULD I RECREATE the cube entirely again?? Is not there any other way?? Regards
-
Applied Receipts Register Report in AR - RXi Report
Hi Fincon, I have a client requirement wherein we need to customize the Applied Receipts register report in AR. After analyzing program andd the executable we discovered that the report is an RXi report spawned from a plsql program. From the SQL Trac
-
IPhone4 not mounting correctly in KDE
Hey everyone, I know this has come up before, and I have searched through the forum as well as using Google, but everything I have found doesn't work for me. The problem: I want to use iTunes in VirtualBox for my iPhone I have VirtualBox with a windo
-
hi there i want to play sound but i keep getting errors here is the code i am using: try InputStream in = getClass().getResourceAsStream("/fire1.wav"); Player p = Manager.createPlayer(in, "audio/x-wav"); p.start(); catch (MediaException me) { } catch