GetInputStream() function of OrdHttpUploadFile
Hi all,
I encounter a problem of using interMedia. I hope someone can
help me cause the problem is quite urgent.
I use "OrdHttpUploadFile" as the file type for the uploaded
image from "OrdHttpUploadFormData"'s "getFileParameter()". The
file is ok and when I use "file.getContentLength()", it return
the right file size. But when I do "file.getInputStream
().available()", it return "0". Therefore I cannot get the
InputStream of that file.
From the API, it is said that the function "getInputStream()"
will return a common java.io.InputStream of a file. But the
return result here is something
like "oracle.ord.im.OrdVBAInputStream@73af". I would like to
know how to get the InputStream correctly.
Thanks in advance.
Yinman
oracle.ord.im.OrdVBAInputStream is a class that extends
java.io.InputStream. OrdVBAInputStream does not override the
available() method to return a meaningful number. This is
definately a bug.
However, you should be able to read from the OrdVBAInputStream
object. Just ignore the 0 returned from available() method.
richard
Similar Messages
-
Inputstream.....help me...
Hi guys,
i've a question for you.
My Jsf Application allow user to upload a txt file thanks to a Myfaces
component.
I want manipulate later this file and i know that exist getInputStream
function that allow it.
My question is that i have to add to my application a java class that
does some operations on the file that i have uploaded.
The matter is that my application load a file in a bufferedReader with
BufferedReader br = new BufferedReader(file);
How can i put the inputstream of my uploaded file in the bufferedReader
to reuse my java application?
Please help me,i'm a newbie..excuse me for my englishUse FileInputStream
-
Hi Friends
I'm developing Chat Application. I used to http tunneling to transfer the data from server to client and vice versa. I can send a request to server, but I couldn't get the reponse from server. I got exception as IOException when I used getInputStream() function from URLConnection. But the same program is running in netscape and I got response back from server.
Here is the code
try { URL docBase = new URL("http://203.129.254.19:2005"); URL url = new URL(docBase,""); URLConnection urlc = url.openConnection(); System.out.println(urlc.getExpiration()); System.out.println("sa:"+urlc); DataInputStream in = new DataInputStream(new BufferedInputStream(urlc.getInputStream())); //PrintStream out = new PrintStream((url1.openConnection()).getOutputStream()); System.out.println(in); str = in.readLine(); in.close(); }catch(Exception e){ str = "Error:"+e; e.printStackTrace(); }
the error i got in IE Browser
java.io.IOException
at com/ms/net/wininet/WininetURLConnection.getInputStream (WininetURLConnection.java)
at Testing.init (Testing.java:18)
at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
at com/ms/applet/AppletPanel.run (AppletPanel.java)
at java/lang/Thread.run (Thread.java)
Thanks,
SanthoshTry to use java plugin ver 1.4.0 or upwards
renjith -
Currently I'm using Runtime.exec() to execute a command. Unfortunately I've been unsuccesful in capturing the output of that execution. I was wondering if it would be possible to have my program open an xterm (Linux, of course) window and then send the command to the xterm for execution. That way xterm captures the output and displays it. Not the ideal solution for me, but it's better than having no output at all.
Tyler RyanThe runtime.exec function will return a Process object. (See: http://java.sun.com/j2se/1.4/docs/api/java/lang/Process.html) You can use the getInputStream() function the read the output the program generates on stdout and the getErrorStream() function to read the output that is send to stderr. That should give you the exact same thing that xterm displays.
An alternative might be to redirect the output of you program to a file and display that. You can the read the contents of that file and display is. e.g. Runtime.exec("MyProg > somefile")
Xterm can be launched with command line options to start an certain program. Using Runtime.exec("xterm -e MyProg") should do the job. See http://www.xfree86.org/4.2.0/xterm.1.html for xterms command line options. -
I'm running IIS + WL 6.1 and in my servlet code, when I use request.getInputStream(),
it has nothing in the input stream
for e.x.
InputStream istream = request.getInputStream();
BufferedInputStream buf = new BufferedInputStream(istream);
byte[] b = new byte[1024];
while(buf.available()>0){
buf.read(b);
System.out.println("printing:"+b);
buf.available is not greater than zero.
But when I tried with just WL6.1, everything is fine.
I'm using forward path to forward my request.
Please help.
thanks
VijayToo much code to review in depth.
Couple of things that jumped out at me
1 - request.sendRedirect sent at the end. You should do any request forward/redirects as soon as possible in the jsp - before your response gets committed. It is illegal to forward/redirect after a response has been committed. That might explain the errors.
2 - As a suggestion, view source on the page, and save the file as html. Or use the functionality to "save a webpage" to your local computer. Try loading that HTML page in all the browsers. That should help you diagnose is it the HTML code, or is it the JSP side of things that is broken.
hope this helps,
evnafets -
I can't seem to find a function to check to see if a connection was success
Hello everyone. I'm running into 2 problems that I can't seem to find functions for after reading the java API on socket and serverSocket.
If a client closed a connection on my server, like if someone telnets into my server, then closes the console, i get the following:
Event from: localhost-> null
Exception in thread "Thread-1" java.lang.NullPointerException
at server.MultiThreadServer.run(MultiThreadServer.java:62)
at java.lang.Thread.run(Thread.java:803)This is the check i do to avoid getting this, but it doesn't seem to work:
//close a connection on this condition.
if(csocket.getRemoteSocketAddress() == null || input.equals("bye"))
System.out.println("Connection closed by client.");
break;
}If I attempt to run a server socket on a socket that is already being used, I'd like to print out a statement saying its being used and do something about it, like let the user enter another port number. Right now I have:
public class MainTest {
public static void main(String args[]) throws Exception
//get console input
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter port to run server on: ");
String input = stdin.readLine();
int servPort = Integer.parseInt(input);
try
ServerSocket ssock = new ServerSocket(servPort);
System.out.println("Listening on : " + ssock);
while (true) {
//waiting for client to connect to server socket
Socket sock = ssock.accept();
System.out.println(sock + " connected.");
//get host information
InetAddress clientIa = sock.getInetAddress( );
String clientName = clientIa.getHostName();
String clientIp = clientIa.getHostAddress();
int localPort = sock.getLocalPort();
System.out.println("hostname: "+clientName +
'\n' + "Ip address: " + clientIp
+":"+ localPort + "\n\n");
new Thread(new MultiThreadServer(sock)).start();
catch(IOException e)
e.printStackTrace();
}Me catching the IOException is too broad....if anything goes wrong it will spit out the error and stop program execution as it should.
I tried
if(ssock.isClosed()) { System.out.println("Socket is being used, try another");but it doesn't work.
Also inside my server program I'm connecting to another server and if that other server isn't running I'd like to print out an error message stating that.
Right now it will just say: Connection Refused if its not running.
here's that code:
public class MultiThreadServer implements Runnable {
Socket csocket;
MultiThreadServer(Socket csocket) {
this.csocket = csocket;
public void run() {
try {
//setting up channel to recieve events from the omnibus server
BufferedReader in= new BufferedReader(
new InputStreamReader(
csocket.getInputStream()));
//This socket will be used to communicate with the reciever
//we will need a new socket each time because this is a multi-threaded
//server thus, the (outputServ) will need to be
//multi threaded to handle all the output.
Socket outputServ = new Socket("localhost",1234);
if(outputServ.getLocalSocketAddress() == null)
System.out.println("OutputServer isn't running...");
//Setting up channel to send data to outputserv
PrintWriter out
= new PrintWriter(
new OutputStreamWriter(
outputServ.getOutputStream()));
while(true)
//accepting events from omnibus server and storing them
//in a string for later processing.
String input = in.readLine();
//accepting and printing out events from omnibus server
//also printing out connected client information
System.out.println("Event from: " + csocket.getInetAddress().getHostName()
+"-> "+ input +"\n");
out.println(input);
out.flush();
//close a connection on this condition.
if(csocket.getRemoteSocketAddress() == null || input.equals("bye"))
System.out.println("Connection closed by client.");
break;
//cleaning up
in.close();
out.close();
outputServ.close();
csocket.close();
} catch (IOException e) {
System.out.println(e);
e.printStackTrace();
}Both those conditions don't seem to work, if a client closes a connection it doesn't respond and if the server isn't running on port 1234, i get that connection refused.
Any help would be great!Thanks for the help guys!
adding -1 to the stream worked perfect:
i have it like this:
String input;
//accepting events from omnibus server and storing them
//in a string for later processing.
while ((input = in.readLine()) != null)
//accepting and printing out events from omnibus server
//also printing out connected client information
System.out.println("Event from: " + csocket.getInetAddress().getHostName()
+"-> "+ input +"\n");
out.flush();
out.println(input);
out.flush();
//close a connection on this condition.
if(in.read() == -1)
System.out.println("Connection closed by client.");
break;
//cleaning up
in.close();
out.close();
outputServ.close();
csocket.close();
} I had one last question, when I catch a socketExpection, such as, if the user enters a port that is already in use, I would like to give them the chance to enter another port before stopping the program.
I'm not sure how I can do this with exceptions though, like i have:
//setting up sockets
ServerSocket ssock = null;
Socket sock = null;
try
//setting up server to run on servPort
ssock = new ServerSocket(servPort);
catch (SocketException e )
System.out.println ("Socket error: " + e);
}now inside that catch block, is there a way for me to allow the user to enter another socket and try again? or am I approaching this wrong?
while(true)
if the port is already been used
allow the user to enter in another port number
else
break;
}I'm confused on how this will work though becuase:
once it hits this line:
ssock = new ServerSocket(servPort);the exception is thrown and it jumps down to the catch block,
now inside that catch block how would I let the user enter in another port number and try this line of code again?
ssock = new ServerSocket(servPort); //this time with the new servPort number?
Thanks! -
Problem while calling java function from html
when i tried to call a java function from html i'm getting an error
object don't support this property.
what could be the reason.
This is my html.
I got this from this forum only.
My applet is accessing the system property "user.home".
I ran it in IE
<DIV id="dvObjectHolder">Applet comes here</DIV>
<br><br>
<script>
if(window.navigator.appName.toLowerCase().indexOf("netscape")!=-1){ // set object for Netscape:
document.getElementById('dvObjectHolder').innerHTML = " <object ID='appletTest1' classid=\"java:test.class\"" +
"height=\"0\" width=\"0\" onError=\"changeObject();\"" +
">" +
"<param name=\"mayscript\" value=\"Y\">" +
"<param name=\"archive\" value=\"sTest.jar\">" +
"</object>";
}else if(window.navigator.appName.toLowerCase().indexOf('internet explorer')!=-1){ //set object for IE
document.getElementById('dvObjectHolder').innerHTML = "<object ID='appletTest1' classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"" +
" height=\"0\" width=\"0\" >" +
" <param name=\"code\" value=\"test.class\" />" +
"<param name=\"archive\" value=\"sTest.jar\">" +
" </object>"
</script>
<LABEL id="lblOutputText">This text will be replaced by the applet</LABEL>
<BR>
<input value="Javascript to java" type=button onClick="document.appletTest1.fromJavaScript()">I tried this example using the repy given to an earlier post.
But its not working with me.
What i did in addition was adding plugin.jar to classpath to import netscape.javascript.*;
Let me add some more details
1) I'll add the stack trace
2) my java progrma
3) batch file to sign the applet.
1) This is the stack trace i don't know whether u will undertand this
load: class test.class not found.
java.lang.ClassNotFoundException: test.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\FastranJava\AppletObject\bin\test\class.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
Exception in thread "Thread-5" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2) Java Program
import netscape.javascript.*;
import java.applet.*;
public class test extends Applet
private JSObject win;
private JSObject outputLabel;
private boolean buttonFromJavaClicked=false;
checkJavaScriptEvent evt=new checkJavaScriptEvent();
public void init()
try
evt.start();
win=JSObject.getWindow(this);
outputLabel=(JSObject)win.eval("document.getElementById('lblOutputText')");
outputLabel.setMember("innerHTML", "<center><h1>From Init<br>Your Home directory" + System.getProperty("user.home") + "</h1></center>");
catch(Exception e)
e.printStackTrace();
public void fromJavaScript()
buttonFromJavaClicked=true;
public void fromJavaScript2()
System.out.println("Started Form JavaScript2");
try
String strLbl="<center><h1>From JavaScript<br>Your Homedir:" + System.getProperty("user.home") + "</h1></center>";
outputLabel.setMember("innerHTML", strLbl);
catch(Exception e)
e.printStackTrace();
class checkJavaScriptEvent extends Thread
public void run()
while(true)
if(test.this.buttonFromJavaClicked)
System.out.println("OK buttonfromjava is true");
test.this.buttonFromJavaClicked=false;
fromJavaScript2();
try
Thread.sleep(3000);
catch(Exception e)
e.printStackTrace();
3) Batch file
del *.cer
del *.com
del *.jar
del *.class
javac -classpath ".;C:\Program Files\Java\jre1.5.0_06\lib\plugin.jar" test.java
keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
jar cf0 test.jar *.class
jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
del *.class -
Java getInputStream not working as expected
Hi all,
I am trying to receive data from a shell procedure in the database through java.
Therefore I created:
a java script (cf. below #1)
a database function (cf. below #2)
a shell script (cf. below #3).
#1
import java.io.*;
public class TestExec {
public static void main(String[] args) {
// public static int getPercentage() {
int percentage = 5;
try {
Process p = Runtime.getRuntime().exec("/home/oracle/HSG.sh");
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
percentage = Integer.valueOf(line).intValue();
System.out.println(line + percentage);
} catch (IOException e) {
e.printStackTrace();
//return percentage;
The script works fine when executed in the shell.
For the db-version the script was slightly changed (cf. // lines).
#2
CREATE OR REPLACE function func_tex
return number
IS LANGUAGE JAVA
name 'TestExec.getPercentage() return int';
#3
df -k /app|grep %|awk '{print $5}'|cut -f 1 -d '%'
The script returns only a single value.
Whenever I call the above function from the database (select func_tex from dual) I dont'receive the expected value from the shell script (63 in this case) but the variable value for percentage (int percentage = 5;) from my java script.
The Java class was loaded into the database with loadjava.
What am I doing wrong?
FJHSQL> create or replace and resolve java source named "df"
as
import java.io.*;
public class df {
public static void df(java.lang.String str) {
int percentage = 5;
try {
String cmd = "/home/oracle/hsg.sh " + str;
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
System.out.println(in.readLine());
} catch (Exception e)
e.printStackTrace();
Java created.
SQL> create or replace procedure df (str varchar2) IS LANGUAGE JAVA name 'df.df(java.lang.String)';
Procedure created.
SQL> set serverout on
SQL> exec dbms_java.set_output(1000000)
PL/SQL procedure successfully completed.
SQL> exec df('/opt')
98%
PL/SQL procedure successfully completed.whereby hsg.sh contains
#!/bin/bash
/bin/df -Pk $1 | /bin/grep % | /bin/awk '{print $5}' -
I need a timer function to ping the server every 5 secs??using threads.
I need a timer function to ping the server every 5 secs??
using threads...i have to use a thread coz i cant use Timer and Timer Task coz clients r on the JDK1.2 version.I have created a thread which keeps checking th ping msg & any server msg is pings 4 the1st time properly but then it just waits to read the response from server but it doesnt but the server shows that it has send the msgs to client???PLEASE HELP URGENTFew things are not clear from your post, like, are you using sockets and if you are, how are u reading writing to them (ur sample code would help)...
Anyways if you are, are you doing accept on your socket in a while(true) loop or just once... If you do it only once you will get the first ping message but none afterwards if the other side closes and opens new sockets for every send... What I am suggesting is something like the following:
ss = new ServerSocket(port);
while(true)
s = ss.accept();
is = s.getInputStream();
os = s.getOutputStream();
reader = new BufferedReader(new InputStreamReader(is));
writer = new BufferedWriter(new OutputStreamWriter(os));
String in = reader.readLine();
// do something with this string
s.close();
// put some check here to break out of this infinite loop
}// end of While -
Passing a socket to a timer invoked function
I am controlling a computer remotely using PrintWriter to a socket. I want a heartbeat timer to send a small xml message every 10 seconds. I need to know how to pass the fromClient PrintWriter to the timer invoked function.
I have a client that opens a connection using PrintWriter
try {
OrderSocket = new Socket(host, port);
fromClient = new PrintWriter(OrderSocket.getOutputStream(), true);
toClient = new BufferedReader(new InputStreamReader(OrderSocket.getInputStream()));
How can I get the socket from inside run()?I am having trouble with passing a socket to a timer task. The #### comments show what I want to do.
* To change this template, choose Tools | Templates
* and open the template in the editor.
package clienttcp;
import java.net.*;
import java.io.*;
import java.lang.String.*;
import java.util.Timer;
import java.util.TimerTask;
public class clientTCP {
public static void main(String[] args) throws IOException {
String host = "localhost";
int port = 4444;
Socket OrderSocket = null;
PrintWriter fromClient = null;
BufferedReader toClient = null;
try {
OrderSocket = new Socket(host, port);
fromClient = new PrintWriter(OrderSocket.getOutputStream(), true);
toClient = new BufferedReader(new InputStreamReader(OrderSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.printf("Don't know about host: %s.\n", host);
System.exit(1);
} catch (IOException e) {
System.err.printf("Couldn't get I/O for the connection to: %s.\n", host);
System.exit(1);
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String fromServer;
fromClient.println("First hi");
//###### I want a timer to do this every 10 seconds ##########################
// fromClient.println("hi");
while (true) {
// first process the reply then drop down to body
if ((fromServer = toClient.readLine()) != null) {
System.out.println("GrocServer: " + fromServer);
if (fromServer.equals("Bye.")) {
break;
fromClient.close();
toClient.close();
stdIn.close();
OrderSocket.close();
} -
Remotely call a PHP function?
My alliance in a game uses a tool to keep track of information. I am trying to make a program that allows me to simply copy information I want to submit to the system's clipboard and then push it to the "submit form" of the alliance's website.
At any rate, I have the clipboard part working. The part that isn't working is pushing the update to the server. The page I want is called:
spioparser.inc.php
The class declared in that PHP file is "Probeparser"
and the specific function in that file I want to call is "parseEntry($string,$flush=true)"
Is it even possible to have my java program open a connection to the server and send information to this function (this function will automatically insert it into the database.)?
The code I am using to try and connect to the server is this:
URL Gala = new URL("http://" +
"<username>:<password>@" +
"mtuogame.lhosting.info/GalaxyTool/secret/spioparser.inc.php");
HttpURLConnection Connection =
(HttpURLConnection) Gala.openConnection();
Connection.setDoInput(true);
Connection.setDoOutput(true);
Connection.setRequestProperty( "Content-type",
"application/x-www-form-urlencoded" );
Connection.setRequestProperty( "Content-length",
Integer.toString(Input.length()));
DataInputStream tmp = new DataInputStream(Connection.getInputStream());
readInput(tmp); //reads all input until EOF
PrintWriter out = new PrintWriter(Connection.getOutputStream());
out.print(Input); //sends the report to server?Thanks.
-KingdudIf you have things set up so that some HTTP request will call that function, then you can certainly call that HTTP request from Java code. As you already know.
But generally you can't just reach out over the network and run arbitrary executable code on somebody else's computer. (Think for a minute what security implications that would have.) Java or not, the answer is the same. -
Call a function from another software
hello,
Iam working on a program where i have to invoke a function from another software, is there any way i can do that? someone told me that i can use RMI to invoke the function but it seems to me like RMI is mainly for networked and distributed systems. any suggestions? i have an idea in my mind, if the software is programmed using c/c++ i can use the native coding to access the functions, well this is only a blind shot, not sure about it.
asrarHey asrar,
It is possible to call external programs from within the JVM. You need to do the following:
Process p = java.lang.Runtime.getInstance().exec("some.exe");
You can then do the following:
p.waitFor();
This will block until the process returns.
The Process class gives you access to 3 streams.
p.getInputStream(); returns a stream that the process sends to stdout.
p.getErrorStream(); returns a stream that the process sends to stderr.
p.getOutputStream(); returns a stream that allows you to send data to the process.
That is basically all you get.
regards,
Dr_N35S -
Unable to execute service SS_GET_PAGE and function getRssFeedForUrl.in ucm
When i update rss feed information i am unable to update the rss logo getting the below error
Unable to execute service SS_GET_PAGE and function getRssFeedForUrl.
$ucmapp41: !csUserEventMessage,anonymous,portalcmd1.bb.wan:8055!csFileServiceUserAgent,Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),GET!csServiceDataException,SS_GET_PAGE,getRssFeedForUrl!$!csSystemError,www.google.com!syExceptionType2,intradoc.data.DataException,www.google.com!syExceptionType2,java.net.UnknownHostException,www.google.com
intradoc.common.ServiceException: !csServiceDataException,SS_GET_PAGE,getRssFeedForUrl!$!csSystemError,www.google.com
at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:1760)
at intradoc.server.Service.buildServiceException(Service.java:1997)
at intradoc.server.Service.createServiceExceptionEx(Service.java:1991)
at intradoc.server.Service.createServiceException(Service.java:1986)
at intradoc.server.ServiceRequestImplementor.handleActionException(ServiceRequestImplementor.java:1460)
at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1427)
at intradoc.server.Service.doAction(Service.java:452)
at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
at intradoc.server.Service.doActions(Service.java:447)
at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1071)
at intradoc.server.Service.executeSubServiceCode(Service.java:3568)
at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:942)
at intradoc.server.Service.executeServiceEx(Service.java:3563)
at intradoc.server.ServiceRequestImplementor.executeSafeServiceInNewContext(ServiceRequestImplementor.java:973)
at intradoc.server.Service.executeSafeServiceInNewContext(Service.java:3558)
at intradoc.server.script.ServiceScriptExtensions.evaluateFunction(ServiceScriptExtensions.java:259)
at intradoc.common.DynamicHtmlMerger.computeFunction(DynamicHtmlMerger.java:1209)
at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:825)
at intradoc.common.DynamicHtmlMerger.substituteVariable(DynamicHtmlMerger.java:597)
at intradoc.common.DynamicHtml.substituteVariable(DynamicHtml.java:1244)
at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:986)
at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1006)
at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1050)
at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1086)
at intradoc.common.DynamicHtml.outputHtml(DynamicHtml.java:906)
at intradoc.common.DynamicHtmlMerger.executeDynamicHtmlToWriter(DynamicHtmlMerger.java:1818)
at intradoc.common.DynamicHtmlMerger.evaluateScriptToWriter(DynamicHtmlMerger.java:1645)
at intradoc.common.DynamicHtmlMerger.evaluateScriptNoErrorHandling(DynamicHtmlMerger.java:1615)
at intradoc.common.DynamicHtmlMerger.evaluateScriptEx(DynamicHtmlMerger.java:1573)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at sitestudio.SSClassHelper.invokeRaw(Unknown Source)
at sitestudio.SSClassHelper.invoke(Unknown Source)
at sitestudio.SSScriptExtensions.evaluateIncludeXmlEx(Unknown Source)
at sitestudio.SSWCMScriptExtensions.evaluateTemplate(Unknown Source)
at sitestudio.SSWCMScriptExtensions.getPlaceholderContent(Unknown Source)
at sitestudio.SSWCMScriptExtensions.evaluateFunction(Unknown Source)
at intradoc.common.DynamicHtmlMerger.computeFunction(DynamicHtmlMerger.java:1209)
at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:825)
at intradoc.common.DynamicHtmlMerger.substituteVariable(DynamicHtmlMerger.java:597)
at intradoc.common.DynamicHtml.substituteVariable(DynamicHtml.java:1244)
at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:986)
at intradoc.common.DynamicHtml.outputHtml(DynamicHtml.java:906)
at intradoc.common.DynamicHtmlMerger.outputDynamicHtmlPage(DynamicHtmlMerger.java:1769)
at intradoc.server.Service.buildResponsePage(Service.java:1199)
at intradoc.server.Service.doResponse(Service.java:1868)
at intradoc.server.FileService.doResponse(FileService.java:1412)
at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:664)
at intradoc.server.Service.doRequest(Service.java:1707)
at intradoc.server.ServiceManager.processCommand(ServiceManager.java:359)
at intradoc.server.IdcServerThread.run(IdcServerThread.java:197)
Caused by: intradoc.data.DataException: www.google.com
at rssfeeds.RssHelper.getXmlHttpContentsAsString(Unknown Source)
at rssfeeds.RssServiceHandler.getRssFeedForUrl(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:293)
at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
at intradoc.server.Service.doCodeEx(Service.java:490)
at intradoc.server.Service.doCode(Service.java:472)
at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
... 47 more
Caused by: java.net.UnknownHostException: www.google.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.Socket.connect(Socket.java:524)
at java.net.Socket.connect(Socket.java:474)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
at sun.net.www.http.HttpClient.New(HttpClient.java:304)
at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:839)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:791)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:716)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:960)
... 59 more
Any help is required
Thanks
SravaniHi Ryan,
Thanks for your reply.
Yes, I checked in the configuration manager and the DB (Logged into the DB and ran a query on Users) as well.
I can see the column name dPassword.
Thanks -
URLConnection.getInputStream() craches thread
Hi
I'm trying to parallelize a downloading process i'm developing, and my download started to behave a bit sporadic. The thread dies right after the System.out.println("1") in the following code snippet, s is an url.
for(String s:urls) {
try {
URL url = new URL(s);
URLConnection uc = url.openConnection();
System.out.println("1 " + s);
InputStream is = uc.getInputStream();
System.out.println("2");
BufferedReader br = new BufferedReader(new InputStreamReader(is));the output from strace (list of system commands) on my system shows the following relevant part:
[pid 4438] write(1, "1 http://alatest1-cnet.com.com/4"..., 513 http://alatest1-cnet.com.com/4941-3000_9-0-1.html) = 51
[pid 4438] write(1, "\n", 1
) = 1
[pid 4438] gettimeofday({1174556453, 323179}, NULL) = 0
[pid 4438] send(17, "GET /4941-3000_9-0-1.html HTTP/1"..., 177, 0) = 177
[pid 4438] recv(17, <unfinished ...>
[pid 4438] <... recv resumed> 0xb52e6cb0, 8192, 0) = ? ERESTARTSYS (To be restarted)
this is the last output from this pid, it seems like it just lies down and dies efter it got the ERESTARTSYS.
I have tried this on java 1.6.0 and 1.5.0_07 with linux kernel 2.6.17.7.
Am I calling the connecting function wrong, or is there some other error maybe?sorry to be a little unclear.
I don't get any exceptions, and i also added a catch(Exception e) { System.out.println(e); } to make sure.
The Thread doesn't hang, it just dies silently. -
URLConnection getInputStream()
Hi guys.
I am writing an applet that is getting information from a .php file. I am opening a connection to the .php and posting to it, then I am opening an input stream from the connection and reading from it.
From the input stream, I can easily open a stream reader and read the data from it, but when I try to pass the input stream to another function, the program stalls indefinitely.
Here is an example:
//works fine
URLConnection conCon = conURL.openConnection();
conCon.setDoOutput(true);
conCon.setUseCaches(false);
OutputStreamWriter conOut = new OutputStreamWriter(conCon.getOutputStream());
conOut.write(conPost);
conOut.flush();
conOut.close();
InputStream conIS = conCon.getInputStream();
BufferedReader buff = new BufferedReader(new InputStreamReader(conIS));
System.out.println(buff.readLine());
//but if instead I do
InputStream conIS = conCon.getInputStream();
conSeq = FastaParser.getSequence(conIS);
//elsewhere
public static String getSequence(InputStream is) throws IOException{
String seq = "";
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
String line = br.readLine();
return line;
//it times outThis is just an example. I am doing other things with the input stream. Is there any way to stop it from stalling here?
Edited by: shiroganeookami on Oct 19, 2007 9:21 AMshiroganeookami wrote:
well, here's the actual code:
...I don't see anything in that which would behave badly, other than possibly not checking your initially read string for null or checking string lengths before trying to use charAt(0) on it. I do see that you're conditionally building a "seq" string and then tossing it, returning only the last line (or null) you read, so that doesn't look right. But it doesn't look like it could possibly be the problem leading to this topic.
Looks like you better do some (more) debugging, by running in a debugger if possible, or at a minimum logging clues along the way, such as putting a
System.out.println("Here's the line I just read from the stream:" + line + ":");
in the do-while loop to see if it's getting in there and what you're reading from the stream.
And log other clues as well, such as at the end of the method to let yourself know whether the method returned or not, and before and after each br.readLine to let yourself know whether the readLine is hanging.
Maybe you are looking for
-
Radio buttons on interactive report
Hello all, I've added radio buttons to an interactive report. What would be the best way to submit the form when user selects the buttons? Thanks.
-
How can I transfer photos from my ipod touch to my computer
How can I transfer photos from my iPod touch to my laptop.?
-
How do I turn off all alerts for a specific email account
I want to disable all notifications for a specific email account and I can't find the options to do this. So basically I have 3 email accounts linked on my blackberry. I and I want to make it so that any time account #3 gets an email I don't get a re
-
Opening a PDF in AI CS3 font missing
I have old Interleaf created PDF's that I open in Illustrator that are missing the font PSOwstdutch, I've searched online and can't find the font anywhere. When AI changes the font to Arial, I get garbage instead of letters. Any help would be great.
-
Transfer investment measure asset to other compnay code
Dear All, This is required to my client , we have two company codes. Right now we are purchasing assests under capital investment measures in one co.code , from this one of the equipment to be transfered to another compnay code. when I am trying to t