Help needed to organize my trooper project

75 views
Skip to first unread message

ter...@gmail.com

unread,
Jun 13, 2013, 11:25:59 AM6/13/13
to troope...@googlegroups.com
Hello,

I'm a new user of Trooper, it's perfect for my needs (batch mode) but I have few questions on the deployment if you have a little time for helping me.

I created a project on eclipse with batch-core dependency on my pom.xml, I have my batches on directory /java/main/resources/external as mentionned in the documentation and I have overrided some config files (server-nature-config.xml and WEB-INF) to add ldap authentification in jetty. All is working well in eclipse but when I want to deploy my app in a maven shade jar file it won't work because many files called in the code by absolute path are inside my big jar (bootstrap.xml for example).

Can you explain me how to best organise my code/jarfiles/resources ?
Can I make one jar for the bootstrap and put my external directory where I want in my server, just by mentionning the project_path in bootstrap.xml ?
It will be in production environnement, not critical at all but I prefer doing it right.

Thanks for your help !
Benoit
(Sorry for my poor english)

Regunath Balasubramanian

unread,
Jun 14, 2013, 1:01:22 AM6/14/13
to ter...@gmail.com, troope...@googlegroups.com
Hello Benoit,

I gather you are trying to build a single fat jar that contains all of your code and the Trooper binaries. Is that true? That unfortunately is not possible - you need independent jar files at least for Trooper modules. 
The configuration files under /resources/external are meant to be deployed outside the application jar. These are picked up by Trooper using the FileLocator class (this looks into config locations i.e. /resources/external and on the classpath). The only deviation to this is bootstrap.xml which is specified as absolute path since it is the startup configuration.

You may deploy as follows:
a) Package all binaries into module specific jar files (say via maven build) - for e.g. you will have jars like batch-core-1.2.3.jar, your-app-1.0.0.jar etc.
b) Deploy the config files i.e. XML files into a directory that follows /resources/external anywhere under the projects root specified in bootstrap.xml

Here is a Maven build file that deploys Trooper batch (copies dependencies to enable  execution from command line) : 

You can then run your Trooper like this:
java -cp ".target/your-app-1.0.0.jar:./target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher ./src/test/resources/external/bootstrap.xml
Hope this helps.

Regu

benoit de RANCOURT

unread,
Jun 14, 2013, 9:19:24 AM6/14/13
to Regunath Balasubramanian, troope...@googlegroups.com
Thanks for your help !

I modified my pom.xml as you advised, I just add an exclude on the external directory to avoid having it on my app.jar (useless if I deploy it in my server) and I add BootstrapLauncher as mainClass in the manifest. It's all working now, Trooper is very useful !

Now I have to work on logback to create one log by batch, if you have a solution ;)

Bye,
Benoit.



2013/6/14 Regunath Balasubramanian <regu...@gmail.com>

benoit de RANCOURT

unread,
Jun 14, 2013, 9:41:13 AM6/14/13
to Regunath Balasubramanian, troope...@googlegroups.com
Haaaaa, I have a little bug with the StandAloneBatchClient :
15:35:50.538 [main] ERROR o.t.p.b.i.s.jmx.JobAdministrator - Error triggering job execution: No job parameters incrementer found for job=SimpleJob
org.springframework.batch.core.launch.JobParametersNotFoundException: No job parameters incrementer found for job=SimpleJob

My job works well when I start Trooper in batch mode.

Any idea ?
Benoit.


2013/6/14 benoit de RANCOURT <ter...@gmail.com>

Regunath Balasubramanian

unread,
Jun 17, 2013, 1:24:23 AM6/17/13
to benoit de RANCOURT, troope...@googlegroups.com
Hi Benoit,

Glad to hear that your issue is resolved.
May I know what you use Trooper for - I mean what company/organization you work for and what business functionality is implemented in Trooper?
I am not sure I understand your Logback requirement well - Trooper already uses Logback and the configuration is logback.xml and located in the same directory as bootstrap.xml.

Cheers,
Regu

Regunath Balasubramanian

unread,
Jun 17, 2013, 1:30:57 AM6/17/13
to benoit de RANCOURT, troope...@googlegroups.com
Benoit,

The exception trace is quite limited and it is therefore hard to figure out what failed here. Is it possible for you to share your spring-batch-config.xml and the command/settings that you used to run StandAloneBatchClient?

In general, while running StandAloneBatchClient, you would specify it as follows : 

java -cp "<class path including Trooper and your app jars>" org.trpr.platform.batch.client.StandAloneBatchClient ../../../resources/external/bootstrap.xml tagCloudJob

Note here that you need to mention the Batch job name i.e. "tagCloudJob" in this case as an additional parameter at the end. 
Btw, does your job require any startup parameters?

Cheers,
Regu

benoit de RANCOURT

unread,
Jun 17, 2013, 9:22:19 AM6/17/13
to Regunath Balasubramanian, troope...@googlegroups.com
Hi,

I found the problem causing my exception. It's because I didn't set the incrementer attribute in the job bean. Now it's working.

I will use Trooper as you say for my company. I'm working in R&D department of a big company of national electricity and I need to admin a software who helps researchers to do theirs statistics studies (we have a big database for that).
I need to import new datas each days from many sources so that's why I'm very interested to use Trooper and Spring batch.

All is working now (thanks a lot for your help ! ), I just need to configure logback to create one log file per job instead of all messages flooded in one big logfile, particulary when jobs start asynchronously. Maybe it's not possible, I don't know.

Benoit.


2013/6/17 Regunath Balasubramanian <regu...@gmail.com>

Regunath Balasubramanian

unread,
Jun 17, 2013, 9:29:34 AM6/17/13
to benoit de RANCOURT, troope...@googlegroups.com
Hi Benoit,

Glad to hear that you found the problem and are able to test your batch jobs independently using the StandaloneBatchClient.
When you are ready to deploy the system in production, would you consider mentioning your company name and its use of Trooper on the Trooper web-site? We could mention it under a new section "Trooper Users".

Cheers,
Regu
Reply all
Reply to author
Forward
0 new messages