Initialize smooks by reading files from remote location

268 views Asked by At

I am trying to read smooks from remote location my code is :

    public Smooks createSmooks() throws Exception {             
        Smooks smooks = new Smooks("\\\\qa01\\conf\\order\\realec\\outbound.xml");
        return smooks;
     }

But it is giving following exception :

 java.io.IOException: Failed to access data stream for resource 
 [qa01/conf/order/realec/outbound.xml]. Tried filesystem, classpath and URL.

Previously, these files were placed with in jar. So I had no issues by reading it in such a way:

 public Smooks createSmooks() {
  Smooks smooks = new Smooks("./conf/order/realec/outbound.xml");
  return smooks;
 } 

Can you please help me creating smooks object for files placed at some remote location?

1

There are 1 answers

0
Tom Fennelly On BEST ANSWER

From your code, I assume the file you're reading is a smooks config file. In any case, you should be able to open an InputStream to the remote config and then provide that to the Smooks constructor.