How to run Spring batch project in SpringSource Tool Suite - spring-batch

First,I'm trying to learn Spring-batch,I have an completed Spring-batch project.Launch this project need start_up.sh in linux platform,but how to run it in SpringSource Tool Suite? What arguments need add to run configurations?
Second,If I want to run an separate job, how to configure?
Please help me.

I have a hard time understanding your question, but I try to answer nevertheless:
I assume you are talking about the startup.sh which is used to start Tomcat. If this is the case, you probably have a web project, so it can be deployed in STS to Tomcat or Springsource tc Server. Just click on the project and drag it to either of them in the Servers tab. (Or right click on any of them and then Add/Remove...)
This one is even more just a shot in the dark: use
java org.springframework.batch.core.launch.support.CommandLineJobRunner testJob.xml testJob where testJob.xml is the one containing the definition of your job and testJob is the name of it.

Related

jBPM 6 in Eclipse

I have just started my working with jBPM6. I can make new jBPM Process with "a simply hello world process", but I don't know how to use it and i'm looking for some tutorial, in which I can see how to use jBPM in Eclipse, some example etc. Can anyone help me? It will be helpful for me if some tutorial/user guide show step by step how to do something in Eclipse with jBPM.
Greetings
rizon
If you are unable to run the default hello world project, then you might not have included all the required jar files.
Just include all jar files and you should be fine.
I think jBPM distribution that is downloaded from jBPM site contains complete distribution with embedded JBoss AS, H2 database and Eclipse environment. By running ant install.demo it downloades complete distro.
Try to do the following:
download jbpm installer
unzip it in some directory and run "ant install.demo". This will download all the necessary files to your machine
run "ant start.demo". This will run JBoss AS, H2 database and Eclipse
on finish, type "ant stop.demo"
Details are described in install.html file.
Afterwards, if you want to run Eclipse only, simply type "ant start.eclipse".

Easiest way to deploy OSGi framework from Eclipse?

I am developing a server with Jetty (servlet container). I am successfully running the server within Eclipse with an osgi-framework run configuration. Everything fine.
What is the best way to export this run configuration so that I have a valid config.ini and all plugins (the workspace bundles and the ones from my target platform) and am able to run the osgi-framework without Eclipse IDE running.
I tried to make a product to get the config.ini and all the bundles but I cannot run the framework with java -jar org.eclipse.osgi_3.6.2.R36x_v20110210.jar.
It is not finding the bundles in the plugin folder, because obviously the names do not match exactly (e.g.: com.mine.at-3.3.-3234234.jar instead of com.mine.at.jar)
There are about 150 bundles and I do not want to edit the config.ini manually.
What did I miss?
What worked pretty well for me was to make a new product, based on the (working) run configuration, and export the product. That project should then be 'runnable', or at least pretty close.
Did you try that?
Hope it helps, Frank

Efficient dev cycle with Maven, Tomcat/Glassfish, Archetype?

So far i've been using tomcat and glassfish to develop a testing webapp, without maven. And the usual development-till-deploy cycle is simple :
develop in eclipse ide, with a WebContent folder, which is the root webapp folder that has the WEB-INF, web.xml, WEB-INF/lib, n all. The compiled classes location in eclipse is set to WEB-INF/classes.
after coding, i could just click on the reload button in glassfish admin console for that specific webapp. In tomcat, i believe it's reload also in the tomcat manager.
i could access the web application in the browser
Now if i would like to create a new webapp, that'll make use of latest stuffs of jsf, spring, jpa, hibernate, postgresql :
what recommendation of archetype should i use in the creation of the project ?
can i still use my previous steps of development? because i think it's very easy without having to repackage everything into a war file, or copying it into the tomcat's webapp folder everytime i want to test. Saving the files in eclipse, hit on the reload in the admin console / tomcat manager, and i could instantly test the updated webapp.
Or what do you usually do in the webapp development cycle ? Please share your experiences, =)
Thank you !
Development Cycle with Maven and Friends
Use Maven to drive your code-build-test-deploy-release cycle.
Start with Maven Archetype that suits closest to your web-app. This will create the whole folder structure for you and will add Jar depencies.
Use an embeded light-weight server like Jetty, this will be very fast on dev machine without sucking resources and is highly configurable. Plus, you can set it to auto-reload changes.
Most of Maven project are supposed to be test-driven. Of which Maven takes care of using it's surefire plug-in. So, every build will have a test phase.
You can define multiple profile for various environments (test, dev, prod, Win, Unix..). These profile will alter the behaviour of the project to be compatible with the environment.
Use Cargo, again a Maven plugin to deploy your builds on test or production server, which can be Glassfish, Tomcat, Jetty or any oter webserver.
Use Liquibase with or without Maven :) to manage your database changes the same way you manage your code change.
I came from almost similar project as yours in my previous company. Development with Maven makes things so smooth and the change is appreciable.
A little Google search shows that someone has worked on archetypes for JSF and JPA with Spring
Edit#1 -- added more details
Feasibility and Ease of Use
Maven is born out of neccessity to simplify the dev process for large and distributed code.
Maven is very well integrated with Eclipse -- so it's painless.
Jetty keeps monitoring source folders, so your changes gets deployed almost immediately.
You can customize the build to skip tests, to not build dependecies. When you just edit a UI component, Jetty will silently copy it to "target" folder.
If you're worried about copying and redeploying. You must read THIS to see how efficiently things are done, keeping in mind that you don't have to compile-test-deploy everytime you change a JSP or HTML.
That said, I would like to mention that Maven might be a challanging learning. This is an object oriented way of development cycle, to say. Most of us, who are used to build script, can find a bit tedious/verbose initially.
Resources
I would suggest to go through the following resources
Maven Book - Maven basics
Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
Maven 2 Effective Implementation -- this book really helped us a lot.
for the q2 :
You can still run/debug app with tomcat from within the IDE (eclipse) even if you change the directory structure. (like the maven dir structure instead of eclipse's dynamic web dir structure)
Project properties - >
project facets - >
Dynamic Web Module ->
Click the appearing "further configuration available"
and set your content dir and context root.
You dont have to package everytime you want to run/debug it.
Another option is using Jetty
And I am sure there are more options others will tell as well.

How to solve problem with out of synchronization of J2EE module dependency in Eclipse?

I have two projects : my-lib and my-web.
my-lib is built using the Java compiler of Eclipse, and a short Ant task is run on some properties files, which are then modified (as explained here).
This is not a pretty solution, but it works.
Now, as my-web is dependent of my-lib, I define my-lib as a Java EE Module Dependency of my-web.
However, when I attach my-web to the Tomcat in Eclipse, and try to publish, I get the following exception:
'Publishing to Tomcat at localhost' has encountered a problem.
Resource is out of sync with the file system: '/my-lib/target/classes/my-app.properties'
This file is indeed one of the files modified by the Ant task.
How can I correct this problem, as I need to have the Ant task run on the my-lib.
If you have the Ant task run as an external builder or external task, you can configure it to refresh the project, workspace, or selected resources after execution. When specifying the task/builder click on the Refresh tab and pick the appropriate one for your needs.
There's more information in the eclipse help.

How to run Eclipse launch configurations programmatically?

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.
I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.
What would be the best way to run a .launch file outside of the UI?
Edit: I am trying to unify the tests run on the build server and the IDE. I do not
particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .
This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.
there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps
Ant4Eclipse may provide a good starting point on how to do this.
Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.
I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.
After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.
You could also use the shell command Eclipse uses. To get it:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash
I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.
This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.
Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.