Dear lolo,
I tried to access URL information from my client, i will put the code below. I have my server and node running on another machine, and client in my machine. Is that any other permissions to be set while using the URL? my code for the client is as follows.
URLExtractor.java
-------------------------
package sample.url;
import java.util.*;
import java.io.*;
import java.net.*;
import org.apache.log4j.Logger;
import org.jppf.JPPFException;
import org.jppf.client.JPPFClient;
import org.jppf.server.JPPFStats;
import org.jppf.server.protocol.JPPFTask;
import org.jppf.task.storage.*;
import org.jppf.utils.*;
public class URLExtractor
{
static Logger log = Logger.getLogger(URLExtractor.class);
public static void main(String args[])
{
try {
// JPPF client initialization
JPPFClient client=new JPPFClient();
//String strURL = "
http://www.marketics.com";
//URLs myURL=new URLs(strURL);
List<JPPFTask> tasks = new ArrayList<JPPFTask>();
tasks.add(new ExtractTask());
// submit and get results
List<JPPFTask> results = client.submit(tasks, null);
//ExtractTask extractTask = (ExtractTask) results.get(0);
//URL url=(URL) extractTask.getResult();
//InputStream is= (InputStream) extractTask.getResult();
// Results after reading url
//System.out.print(url.toExternalForm());
// Statistics
JPPFStats stats = client.requestStatistics();
System.out.println("End statistics :\n"+stats.toString());
System.out.println("\nTasks executed normally\n");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
----------------------------------------------
ExtractTask.java
package sample.url;
import org.jppf.server.protocol.JPPFTask;
import java.io.*;
import java.net.*;
public class ExtractTask extends JPPFTask {
InputStream is=null;
URL url;
int c;
public ExtractTask(){
//this.url=url;
}
public void run(){
try{
url=new URL("
http://www.marketics.com");
is=url.openStream();
if(is.available()>0){
int i=is.available();
while(((c=is.read())!= -1)&&(--i > 0)){
System.out.print((char)c);
}
}
}catch(Exception e){
e.printStackTrace();
}
System.out.println("-----------\nTask Done\n------------");
}
/*public Object getResult(){
return url;
}*/
}
---------------------------------------
its just helding up at
run.url.noui:
run.extracturl:
[echo] starting the 'URL Extraction Application'
[java] ClassServerDelegate.init(): Attempting connection to the class serve
r
[java] ClassServerDelegate.init(): Reconnected to the class server
[java] JPPFClient.init(): Attempting connection to the JPPF driver
[java] JPPFClient.init(): Reconnected to the JPPF driver
and no execution taking place. while i can run other applications.
pls get me a solution, its very urgent.
regds,
abhilash