(I use glassfish 3.1 with felix osgi)
I need to write a batch script that updates one of my OSGI bundles.
The most basic idea is to move bundle jar from autodeploy folder, and return it after a few seconds. Is there a "cleaner" way to do it? Can I easily run commands in felix telnet from a batch file?
thank you
you can also use BundleContext.installBundle method
http://www.osgi.org/javadoc/r4v43/org/osgi/framework/BundleContext.html#installBundle(java.lang.String, java.io.InputStream)
Related
My automation deployment environment I have web.war file deployment under tomcat.
Lets assume this web.war application contains mix.jar file which is under /lib directory of web.war archive file.
(mix.jar releases giving by different DEV team and they don't responsible for giving web.war and the organization practice is putting the latest mix.jar file into the web.war archive file manually )
Can anyone help me to automate this process from CHEF recipe ?
Basically what I need during the chef deployment is, putting the mix.jar file into the web.war/lib directory under tomcat container.
Our current practice is open the web.war file from Winrar and put the mix.jar file into it and redeploy it into tomcat.
But I want to automate this process.
Jar files are just zip files so you can probably write some code using either the zip command line tool or the RubyZip gem (I would go for the latter but depends on your comfort level with Ruby code) to do this on the fly, but please don't. Chef is really not built for this kind of task and it will be very frustrating to build the code in a robust manner. If you need it ASAP and want to build a fragile version now and fix the process afterwards that's more understandable, but otherwise probably just talk to your dev team about what this is and why you need it added to their build process. Some problems are best solved with communication rather than code.
I have a Spring Boot project that I'm running as an executable jar started as an init.d service on Linux.
I understand I can create a .conf file with the same name as the jar file to specify JVM parameters. However, I would ideally like to "hard code" some parameters so there is no risk of the .conf file being missing. This is a real risk as each deployment will have a different jar name because of the version number.
Also I know I can set the environment variable JAVA_OPTS, but I'm not sure how to do this if I'm launching the Spring Boot as a init.d service using a symlink to the jar file.
Lastly I know I can replace the init.d script completely using the embeddedLaunchScript parameter, but I fell this overkill for what I want to accomplish and would want updates to the script in further releases.
Is there a way to specify JVM parameters in the Maven plugin or some other programmatic method?
Alternatively is there a way to hard code a static CONF file name? Looking at the embeddedLaunchScriptProperties it looks like confFolder can the folder, but not the name of the .conf file.
As of Spring boot 2.0, you can set the inlinedConfScript property of the build plugin. You can now reference a file that includes the appending or overwriting the JAVA_OPTS variable before the application starts. More details can be found in the Spring Documentation.
Congratulations on the spring state machine, I found it yesterday and have been trying it out, specifically the turnstile example running in STS. I found it very easy and intuitive to build a FSM.
Because spring shell doesn't work well in STS I tracked down the instructions to run the examples from the command line in the reference doc,
"java -jar
spring-statemachine-samples-turnstile-1.0.0.BUILD-SNAPSHOT.jar"
,
but running it got an error
"no main manifest attribute, in spring-statemachine-samples-turnstile-1.0.0.BUILD-SNAPSHOT.jar".
Although not even a novice in using gradle, I tried fixing this by adding this line to build.gradle in the jar section
"manifest.attributes['Main-Class'] = 'demo.turnstile.Application'"
(which doesn't handle the various sub-projects I know) but got this error
"NoClassDefFoundError: org/springframework/shell/Bootstrap".
If it is possible to run the samples from gradle, could you include them in the reference document? I tried running the samples using
gradle run
but it there was no interaction with the shell scripts.
Samples are designed to be run as executable jar and with shell so that you can interact without a need to recompile with every change. Your error indicates that you didn't build that sample jar as mentioned in docs.
./gradlew clean build -x test
This will automatically use spring boot plugin which will add the necessary jar manifest headers to jar meta info to make it a true executable jar. Essentially every every sample is a spring boot app.
Building SM sample projects in Windows Environment:
Open Command prompt (windows key + r -->cmd-->Enter), Change directory to project root folder spring-statemachine-master (Inside the Extracted folder).
Run gradlew install to get all spring dependencies copied to local machine.
Run gradlew clean build -x test to get the spring shell jars built. Courtesy Janne
These steps should ideally get all .jar built, look into \build\libs folder of respective sample project for jar files.
Run the like any other java jar file java -jar [jar-file-name.jar] (make sure to be change directory to jar file directory location).
One more thing where I was stuck was, How to give events to SM:
It's like this sm event EVENT_NAME_AS_DEFINED_IN_CLASS. Ref
E.g.: sm event RINSE --> to washer project
I have a bash script inside my .war file & i want to call it to run from my web page(probably jsp).How can i do that?
The bash script uses root privilages.I will call it with gksudo.Can that be done?Is .war file writable?I use Tomcat.
I think there is a .war file that is part of the Beanshell project and that .war is capable of running Beanshell scripts in Java code, which means you could do pretty much anything.
There might be better ways of doing this but this is all I know right now.
I am searching for a way to generate a run able equinox configuration of deployed OSGI bundles.
A build server deploys our OSGI bundles via maven and tycho-plugin and placed them in the m2 directory.
Now, the next step is to collect the bundles from the deployment directory and put them together in a equinox configuration and start up the container.
Collect the bundles and configure the equinox container manually is not the way I prefer so now I looking for a way to do this automatically via script.
There are solutions like ANT script?
Hoping for Help
Build a "product" (i.e. a fully self-contained OSGi runtime).
See the tycho docs in general [1] and esp. exercise 5 of the tycho tutorial [2] with solution [3]
[1] http://eclipse.org/tycho/documentation.php
[2] http://eclipsecon.org/sessions/building-eclipse-plugins-and-rcp-applications-tycho
[3] https://github.com/jsievers/tycho-demo/tree/master/exercises/Exercise_06_Solution
One thing you could do is generate an config.ini file which you can put in your configuration/ directory. The osgi.bundles entry in there allows you to specify what bundles to install and start, e.g.:
config.ini content:
osgi.bundles=org.eclipse.osgi.services#start, ../mydirectory/mybundle.jar#start
You may need to specify the configuration directory when launching equinox to ensure the config.ini is picked up, e.g.
java -jar plugins/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar -configuration configuration
You can use https://github.com/sarod/equinox-config-builder to easily generate a config.ini from a plugins directory.