Re: Test Post to Servlet Doesn't Work.
Thank you for your suggestion. I just tried it but it doesn't perform a connection either. The only difference between what Hunter is doing in his code and mine is he is using a DataOutputStream and I am using a PrintWriter which shouldn't make any difference. He is also using the URLEncoder.encode method for both the name and value. All the URLEncoder.encode method does is scan the string for reserved and unsafe characters and replaces them with their URL encodings. This is equivalent to my line: out.println( cmd= + URLEncoder.encode( xml ) ); I don't bother to encode cmd because it doesn't have any reserved or unsafe characters in it. It is producing the same string value as Hunter's toEncodedString() method. I am beginning to think I don't have Orion configured properly or my application deployed properly because all the code examples I see all have the same structure and others seem to be able to make them work. Thank you for taking the time to look at my problem. Milton S. Boris Erukhimov wrote: It looks like you are not properly supplying arguments for POST method The right order based on Jason Hunter book example is below: To use it in your case just put your xml string into Properties object as a value against cmd as a name public static final InputStream sendPostMessage(Properties args, URL destination) throws IOException { String argString = ; if (args != null) { argString = toEncodedString(args); } URLConnection con = destination.openConnection(); // Prepare for both input and output con.setDoInput(true); con.setDoOutput(true); // Turn off caching con.setUseCaches(false); // Work around a Netscape bug con.setRequestProperty(Content-Type, application/x-www-form-urlencoded); // Write the arguments as post data DataOutputStream out = new DataOutputStream(con.getOutputStream()); out.writeBytes(argString); out.flush(); out.close(); return (con.getInputStream()); } /sendPostMessage private static final String toEncodedString(Properties args) { StringBuffer buf = new StringBuffer(); Enumeration names = args.propertyNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); String value = args.getProperty(name); buf.append(URLEncoder.encode(name) + = + URLEncoder.encode(value)); if (names.hasMoreElements()) buf.append(); } return buf.toString(); } toEncodedString Hope it helps ~boris Milton S wrote: Orion Interest Group, I have written a Java class to test server to server communication for a servlet running on Orion 1.5.2. Nothing seems to happen when I run the class while the same URL sent from the address/location edit box on a browser works perfectly. The host URL I am using is http://ducati:8080/petroweb/report; where ducati is the name of my notebook, petroweb is the application name, and report is the servlet I am trying to access. Following is the code I am using to make the POST. What should I look for to make this work? I have System.out.println's in my servlet code to notify the open command prompt, in which Orion is running, of any requests received. I also have, in my servlet, all GET requests resolving to the doPost method. My environment is Intel P850, MS Windows 2000 Professional. Sun jdks, Orion 1.5.2 (stable binaries). Thank you for your help. import java.io.*; import java.net.*; import java.util.*; public class PostTest { public static void main( String args[] ){ String xml = ?xml version=\1.0\ encoding=\utf-8\? + pwCmdXML + CommandSubmitJob/Command + CommandPasswordaPwd/CommandPassword + ProjectNameTheProject/ProjectName + ProjectTypepType/ProjectType + ObjectClassstuff/ObjectClass + ObjectList1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36/ObjectList + /pwCmdXML; try{ URL url = new URL( http://ducati:8080/petroweb/report?; ); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoOutput( true ); conn.setRequestMethod( POST ); PrintWriter out = new PrintWriter(conn.getOutputStream() ); out.println( cmd= + URLEncoder.encode( xml ) ); conn.connect(); out.flush(); out.close(); } catch( MalformedURLException err ){ System.out.println( MalformedURLException = + err.getMessage() ); } catch( IOException err ){ System.out.println( IOException = + err.getMessage() ); } } }
Test Post to Servlet Doesn't Work.
Orion Interest Group, I have written a Java class to test server to server communication for a servlet running on Orion 1.5.2. Nothing seems to happen when I run the class while the same URL sent from the address/location edit box on a browser works perfectly. The host URL I am using is http://ducati:8080/petroweb/report; where ducati is the name of my notebook, petroweb is the application name, and report is the servlet I am trying to access. Following is the code I am using to make the POST. What should I look for to make this work? I have System.out.println's in my servlet code to notify the open command prompt, in which Orion is running, of any requests received. I also have, in my servlet, all GET requests resolving to the doPost method. My environment is Intel P850, MS Windows 2000 Professional. Sun jdks, Orion 1.5.2 (stable binaries). Thank you for your help. import java.io.*; import java.net.*; import java.util.*; public class PostTest { public static void main( String args[] ){ String xml = ?xml version=\1.0\ encoding=\utf-8\? + pwCmdXML + CommandSubmitJob/Command + CommandPasswordaPwd/CommandPassword + ProjectNameTheProject/ProjectName + ProjectTypepType/ProjectType + ObjectClassstuff/ObjectClass + ObjectList1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36/ObjectList + /pwCmdXML; try{ URL url = new URL( http://ducati:8080/petroweb/report?; ); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoOutput( true ); conn.setRequestMethod( POST ); PrintWriter out = new PrintWriter(conn.getOutputStream() ); out.println( cmd= + URLEncoder.encode( xml ) ); conn.connect(); out.flush(); out.close(); } catch( MalformedURLException err ){ System.out.println( MalformedURLException = + err.getMessage() ); } catch( IOException err ){ System.out.println( IOException = + err.getMessage() ); } } }
Orion hangs when connections exhausted.
Has anyone experienced Orion hanging when all of the available connections from the pool are exhausted? I noticed a similar question posted by Joel Shellman back in August of 2000 but there was no response to his question. I can re-issue the same URL from a browser multiple times and once the application has taken the last pooled connection it hangs and never returns. Orion never lets go of the connection even after waiting for over an hour. Only way to get Orion working again is to boot. Connections are not being made in an EJB but in regular java classes that are called from a stateless session bean. My application is to be deployed on an Intranet and I expect the traffic to be minimal so a work around is to set up the connection pool with a large enough number of connections so that they are never used up, but Orion shouldn't be hanging. Is this an Orion problem or am I missing something in the data-sources.xml file? Thanks for any help. Milton S. I am running Orion 1.5.2 on NT 2000 Professional against an Oracle 8i database on NT 4.0 server using the Oracle Thin JDBC driver. Here is the data-source I am using: data-source class=com.evermind.sql.DriverManagerDataSource name=jdbc/PWOW_OracleCoreDS location=jdbc/PWOW_OracleCoreDS pooled-location=jdbc/PWOW_OraclePooledDS xa-location=jdbc/xa/PWOW_OracleXaDS ejb-location=jdbc/PWOW_OracleEjbDS connection-driver=oracle.jdbc.driver.OracleDriver min-connections=5 max-connections=10 username=uid password=pwd url=jdbc:oracle:thin:@server:1521:sid inactivity-timeout=10 connection-retry-interval=10 wait-timeout=300 /
Re: Orion hangs when connections exhausted.
And the obvious answer is yes. Greg Matthews wrote: just to get the obvious things out of the way first, are you calling connection.close() prior to the EJB method returning? doing this in a finally block is a good idea. - Original Message - From: Milton S [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Tuesday, July 03, 2001 5:36 AM Subject: Orion hangs when connections exhausted. Has anyone experienced Orion hanging when all of the available connections from the pool are exhausted? I noticed a similar question posted by Joel Shellman back in August of 2000 but there was no response to his question. I can re-issue the same URL from a browser multiple times and once the application has taken the last pooled connection it hangs and never returns. Orion never lets go of the connection even after waiting for over an hour. Only way to get Orion working again is to boot. Connections are not being made in an EJB but in regular java classes that are called from a stateless session bean. My application is to be deployed on an Intranet and I expect the traffic to be minimal so a work around is to set up the connection pool with a large enough number of connections so that they are never used up, but Orion shouldn't be hanging. Is this an Orion problem or am I missing something in the data-sources.xml file? Thanks for any help. Milton S. I am running Orion 1.5.2 on NT 2000 Professional against an Oracle 8i database on NT 4.0 server using the Oracle Thin JDBC driver. Here is the data-source I am using: data-source class=com.evermind.sql.DriverManagerDataSource name=jdbc/PWOW_OracleCoreDS location=jdbc/PWOW_OracleCoreDS pooled-location=jdbc/PWOW_OraclePooledDS xa-location=jdbc/xa/PWOW_OracleXaDS ejb-location=jdbc/PWOW_OracleEjbDS connection-driver=oracle.jdbc.driver.OracleDriver min-connections=5 max-connections=10 username=uid password=pwd url=jdbc:oracle:thin:@server:1521:sid inactivity-timeout=10 connection-retry-interval=10 wait-timeout=300 /
Re: Dynamic Loading of a Data Source
I have tried it and it does not seem to work or at least how I am doing it. To test it I have a functioning Oracle data source. I cut this data source out of the \config\data-source.xml descriptor file. I then restart Orion. Orion cannot find the data-source when I run my application. With Orion still running I paste the data source back into the \config\data-source.xml descriptor file and save it, Orion does not pick up the change. Is there some configuration setting that needs tweeking. Do I need to hook into the JNDI? Any advice on how to do this, if it is possible, would be greatly appreciated. Hani Suleiman wrote: Try it! I think it does work On Wed, 25 Apr 2001, Milton S wrote: Is it possible to dynamically load a new data source to Orion after it has started?
Dynamic Loading of a Data Source
Is it possible to dynamically load a new data source to Orion after it has started?
Dynamic Loading of a Data Source
Is it possible to dynamically load a new data source to Orion after it has started?