JBoss Community

Start process on JBoss Server

created by zearys in JBoss Tools - View the full discussion

Hi,

 

I’m using SQLLoader to load data into my tables from a process. I would like to lunch this process once a user presses a button in my web interface. So I made tests in a single main before adding and everything was fine. Once I place the code on my JBoss Server nothing work anymore.

 

I would like to know why the code don't react same way on Jboss sever as on a regular java application for process execution? And what may I do to make the same code react the same way?

 

In a main, executed as java application, this code results X successful lines:

 

String[] exec = new String[] {"sqlldr","userid=ab@devl/abc","control=C:/controls.txt","log=C:/" };
 
BufferedReader br = new BufferedReader(new InputStreamReader(new ProcessBuilder(exec).start().getInputStream()));
 
while (br.readLine() != null) {}

 

  1. Controls.txt:
LOAD DATA
INFILE 'C:/03_JUN-11_0210SFAEXDDEFS20110712014140.txt'
APPEND
INTO TABLE S1_DATA_TEST
TRAILING NULLCOLS
(EXERCICE                CONSTANT                          2011,
 NO_PERIODE          CONSTANT                          3,
 REGISTRE                POSITION(14:20)                CHAR TERMINATED BY WHITESPACE,
 ENTITE                      POSITION(44:47)                CHAR TERMINATED BY WHITESPACE,
 A                                  POSITION(69:74)                CHAR TERMINATED BY WHITESPACE,
 PERIODE                  POSITION(219:224)           CHAR TERMINATED BY WHITESPACE,
 DESCRIPTION         POSITION(234:474)           CHAR TERMINATED BY WHITESPACE,
 B                                  POSITION(475:496)           DECIMAL EXTERNAL "to_number(replace(:B,'.',','))",
)

 

And once on the JBoss server with the same code :

09:58:29,339 ERROR [STDERR] java.io.IOException: CreateProcess: sqlldr userid=ab@devl/abc control=C:/controls.txt log=C:/ error=2

09:58:29,339 ERROR [STDERR]  at java.lang.ProcessImpl.create(Native Method)

09:58:29,339 ERROR [STDERR]  at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)

09:58:29,339 ERROR [STDERR]  at java.lang.ProcessImpl.start(ProcessImpl.java:30)

09:58:29,339 ERROR [STDERR]  at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)

09:58:29,339 ERROR [STDERR]  at exportation.Sqlldr.executer(Sqlldr.java:74)

09:58:29,339 ERROR [STDERR]  at exportation.Sqlldr.executer(Sqlldr.java:34)

09:58:29,355 ERROR [STDERR]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

09:58:29,355 ERROR [STDERR]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

09:58:29,355 ERROR [STDERR]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

09:58:29,355 ERROR [STDERR]  at java.lang.reflect.Method.invoke(Method.java:585)

Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community