Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EGL Development Tools » How to deploy batch program
How to deploy batch program [message #820972] Wed, 14 March 2012 20:09 Go to next message
Milan Horvat is currently offline Milan HorvatFriend
Messages: 2
Registered: March 2012
Junior Member
Hi,
I developed a program which reads xmls from another db system and fills tables in my database with the data from those xmls. It works fine in EDT Eclipse environment using debug or run facility. Now I want to export the program outside the Eclipse to start it from command line. Is it posible and how? I can't find out the procedure to do this.

Later I want this program to start automaticaly every day at the same time on the production machine.

(I also tried to make the same program in RBD but I was more successful with EDT, surprisingly).

This is information I got from EDT Project Home page:
EGL supports creation of batch-style Java programs that can be run from command line, offering the ability to perform post-processing on a database, report generation, and more.

Regards,
Milan

Re: How to deploy batch program [message #821009 is a reply to message #820972] Wed, 14 March 2012 20:57 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Hi Milan,

We don't yet have deployment support for batch programs, but there's a couple ways you can get the environment working outside the IDE.

1. Deploy your DD file into a web project, then copy the resulting *-bnd.xml files from the target Web project's Java source folder (typically found underneath 'Java Resources') into the 'src' folder of the project containing your program.
2. Create a file "rununit.properties" in the toplevel of the project's 'src' folder and give it settings such as:
egl.application.property.file=myDD
egl.application.property.file.myPackage.myProgram=myDD

Where 'myPackage.myProgram' is the qualified name of your program, and 'myDD' is the name of the descriptor you deployed. This sets up the default DD file when your binding does not specify a specific file to use.

As for getting the program to run automatically each day, which operating system is the production machine? If Linux/Unix you can set up a cron job to take care of this.

Hope this helps!

-Justin
Re: How to deploy batch program [message #828802 is a reply to message #821009] Sun, 25 March 2012 10:12 Go to previous messageGo to next message
Milan Horvat is currently offline Milan HorvatFriend
Messages: 2
Registered: March 2012
Junior Member
Hi Justin,

Thank you for your help.

I had to do some additional work to make my program succesfully run outside the Eclipse:

1.) I have to change this:
// dsm SQLDataSource? = SysLib.getResource("binding:MOBOS");
// dsa SQLDataSource? = SysLib.getResource("binding:SQLKAR");
dsm SQLDataSource? { @Resource { uri="binding:MOBOS" } } ; // .8 syntax
dsa SQLDataSource? { @Resource { uri="binding:SQLKAR" } } ; // .8 syntax

2.) I copied everything from bin directory to some-directory outside, also bin\xxxx-bnd.xml and bin\rununit.properties.

3.) I had to rename xxxx-bnd.xml to xxxx.egldd-bnd.xml !!

4.) Copied com.ibm.icu_4.4.2.v20110208.jar and org.eclipse.edt.runtime.java_0.8.0.v201203151558.jar to some-directory\bin

5.) Made some runit.bat file which I can include in windows scheduller or run manualy:
set CP=C:\some-directory\bin
set CP=%CP%;C:\some-directory\bin\org.eclipse.edt.runtime.java_0.8.0.v201203151558.jar
set CP=%CP%;C:\some-directory\bin\com.ibm.icu_4.4.2.v20110208.jar
set CP=%CP%;C:\some-directory\sqljdbc4.jar

java -cp %CP% my.pac.kage.MyProgram

rem pause


Regards,
Milan
Re: How to deploy batch program [message #830541 is a reply to message #828802] Tue, 27 March 2012 19:22 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Glad you got it working, but I wonder about #3 where you had to rename the bind file. This should not be necessary; it makes me think your rununit.properties entry listed the full file name, which might explain this. The entry does not expect the file extension, so for file 'myDD.egldd' deployment would create the file 'myDD-bnd.xml' and an entry in rununit.properties "egl.application.property.file.myProgram=myDD" (not "...=myDD.egldd").

-Justin
Re: How to deploy batch program [message #871183 is a reply to message #820972] Fri, 11 May 2012 10:28 Go to previous messageGo to next message
Gianluca Donati is currently offline Gianluca DonatiFriend
Messages: 10
Registered: May 2012
Junior Member
Hi,
I followed the instructions in this topic but I was not able to run the test program I wrote. It seems to have trouble in finding resources. The execution of la.bat immediately ends with the following statements:

C:\Documents and Settings\donati\Desktop\testegl>java -cp "C:\Documents and Sett
ings\donati\Desktop\testegl\it.errepidistribuzione.egl.logisticaavanzata\bin;C:\
Donati\Eclipse\EDT\workspace\sqljdbc4.jar;C:\Documents and Settings\donati\Deskt
op\testegl\lib\org.eclipse.edt.runtime.java_0.8.0.v201204041632.jar;C:\Documents
and Settings\donati\Desktop\testegl\lib\com.ibm.icu_4.4.2.v20110823.jar" it.err
epidistribuzione.egl.logisticaavanzata.server.TestPgm

Exception in thread "main" java.lang.NullPointerException
at resources.edt.binding.BindingResourceProcessor.getBinding(BindingReso
urceProcessor.java:141)
at resources.edt.binding.BindingResourceProcessor.resolve(BindingResourc
eProcessor.java:63)
at eglx.lang.SysLib.getResource(SysLib.java:238)
at it.errepidistribuzione.egl.logisticaavanzata.server.TestPgm.ezeInitia
lize(TestPgm.java:57)
at it.errepidistribuzione.egl.logisticaavanzata.server.TestPgm.<init>(Te
stPgm.java:49)
at it.errepidistribuzione.egl.logisticaavanzata.server.TestPgm.main(Test
Pgm.java:44)

For investigating purposes, I tried browsing EDT source files from Eclipse CVS, but most are missing, especially those in resources.* packages, and the source of eglx.lang.SysLib does not contain any getResource function. I browsed from ":pserver:anonymous@dev.eclipse.org:/cvsroot/tools" as said in "wiki.eclipse.org/EDT:Developer%27s_Guide_to_Getting_Started_on_EDT" .

I'm attaching the folder where I exported the project, the only missing files are org.eclipse.edt.runtime.java_0.8.0.v201204041632.jar and com.ibm.icu_4.4.2.v20110823.jar, too big to attach.

Thank you for your attention.
Gianluca
  • Attachment: testegl.zip
    (Size: 210.75KB, Downloaded 394 times)
Re: How to deploy batch program [message #871710 is a reply to message #871183] Mon, 14 May 2012 18:03 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Hi Gianluca,

I see what's going on; go ahead and open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EDT

A workaround might be to change the resource looking from the global scope to inside the main function.

As for the "missing code", some stuff in CVS was very recently moved around, so several classes are in a different place now (see the other projects in the 'runtimes' folder).

-Justin
Re: How to deploy batch program [message #871961 is a reply to message #871710] Tue, 15 May 2012 08:12 Go to previous messageGo to next message
Gianluca Donati is currently offline Gianluca DonatiFriend
Messages: 10
Registered: May 2012
Junior Member
Hi Justin,

thank you for your reply, I had to move the SQLDataSource statement in each function where the resource is used, but now it's working!!

I opened a bug (bugs.eclipse.org/bugs/show_bug.cgi?id=379498), but I don't know if the component (JavaGen) is right...
Re: How to deploy batch program [message #872046 is a reply to message #871961] Tue, 15 May 2012 11:15 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Hi Gianluca,

Glad to hear it worked! Thanks for opening the bug, JavaGen was correct.

-Justin
Re: How to deploy batch program [message #889494 is a reply to message #872046] Tue, 19 June 2012 09:36 Go to previous messageGo to next message
Gianluca Donati is currently offline Gianluca DonatiFriend
Messages: 10
Registered: May 2012
Junior Member
Hi,

after downloading 0.8.1M2, I have new troubles in finding SQL resources. It's all ok if I run my program in EDT, but deploying like I did with 0.8.0 (and then worked) leads to a new exception I can't fix.

I'm attaching the output and the folder where I exported the project.

Thank you for your attention.
Gianluca
  • Attachment: output.txt
    (Size: 3.10KB, Downloaded 464 times)
  • Attachment: Logistica.zip
    (Size: 1.12MB, Downloaded 388 times)
Re: How to deploy batch program [message #889781 is a reply to message #889494] Tue, 19 June 2012 15:07 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Hi Gianluca,

It looks like you need to update your classpath for the Java process. We did some refactoring for the extensibility of the Java runtime, and now there are multiple jar files containing different components. You can see the current list of required jars for a release by expanding the "EDT Java runtime" container in Project Explorer, located underneath one of your EGL projects. The new plug-ins that you should add to your classpath are:

org.eclipse.edt.runtime.java.sql
org.eclipse.edt.runtime.java.jee

-Justin
Re: How to deploy batch program [message #889790 is a reply to message #889781] Tue, 19 June 2012 15:38 Go to previous messageGo to next message
Gianluca Donati is currently offline Gianluca DonatiFriend
Messages: 10
Registered: May 2012
Junior Member
hi Justin,

I did as you suggested, but I only got a new exception, very similar to the old one.

  • Attachment: output.txt
    (Size: 3.97KB, Downloaded 974 times)
  • Attachment: laricmer.bat
    (Size: 0.62KB, Downloaded 353 times)
Re: How to deploy batch program [message #889795 is a reply to message #889790] Tue, 19 June 2012 16:34 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Okay, for that new message it sounds like you need to regenerate your EGL source (there were breaking runtime changes in this milestone, this is a pre-1.0 product so a lot of APIs are still being worked on and will be frozen in the 1.0 release). When you view the source in the IDE you're going to see some new validation errors. In the case of the latest error message, you need to change the code from "SysLib.getResource()" to "Resources.getResource()". There might be other validation errors too; if so you can list them here and I'd be happy to help you make the appropriate updates.

-Justin
Re: How to deploy batch program [message #889904 is a reply to message #889795] Wed, 20 June 2012 08:11 Go to previous message
Gianluca Donati is currently offline Gianluca DonatiFriend
Messages: 10
Registered: May 2012
Junior Member
A project clean of all three projects involved fixed the problem. I had already done conversions from SysLib.getResource() to Resources.getResource, but most of my binding are done implicitly with @Resource annotation.
Thank you once more, Justin

Gianluca
Previous Topic:How does sql prepare statement really work?
Next Topic:Highlighting for EGL primitive types removed
Goto Forum:
  


Current Time: Fri Apr 19 21:15:47 GMT 2024

Powered by FUDForum. Page generated in 0.03783 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top