3 Replies Latest reply on Aug 4, 2011 11:23 AM by zearys

    Start process on JBoss Server

    zearys

      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)

        • 1. Re: Start process on JBoss Server
          rob.stryker

          Hi Zearys!

           

          Unfortunately this is not a bug with JBoss Tools, or even have anything to do with it JBoss Tools is a set of eclipse plugins developers use to help develop their application.

           

          The issue you're having here is clearly an issue with the proper useage of the actual JBoss AS Runtime, and not the eclipse plugins. Your question would be better answered over on the JBoss AS forums =]

          • 2. Re: Start process on JBoss Server
            zearys

            Srr, my bad.

            • 3. Re: Start process on JBoss Server
              zearys

              I resolved my problem,

               

              It was a path issue as the executable of SQL*Loader wasn’t directly on my server.

               

              When I execute in a java application it seem to use the JVM paths environment and can find/execute same command as CMD vs my JBoss Server instance who don’t seem to know this environment. (I’m far away from a pro so this is the explanation I deduce from my knowledge on these languages/technologies.)

               

              So in fact, all I needed to do was to specify the path of sqlldr.exe. :

              String[] exec = new String[] {"C:/Program Files/Oracle/ClientX/bin/sqlldr.exe","userid=ab@devl/abc","control=C:/controls.txt","log=C:/" }