JBoss Fuse Specified service reference is null - esb

I have two bundles, one is DB related and another one simple. DB bundle will export osgi service reference. Another one will get the service reference.
It is working fine when installing one by one. The service reference is null when starting the Jboss fuse karaf container.
Can i set bundle ordering ? or Can i set delay for completing DB bundle?
I need to install bundle after completing DB bundle.
Advance Thanks.

The actual code you have to write depends on how your bundles start. Do you use a Java class as BundleActivator? Spring? Blueprint?
Generally speaking, each bundle must specify its dependencies. There are 2 kinds of dependencies:
dependeny on some classes in packages exported by other bundles
dependency on a service provided by some other bundle
Your bundle should declare packages and services (Java interfaces) it needs. This way you "force" JBoss/Karaf to start bundles in the correct order and avoid null service references.
Have a look at this guide:
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html-single/Managing_OSGi_Dependencies/index.html

Related

Services and env in manifest file?

I have a web (online calculator for an example) which developed by my fellow tem members. Now they want to deploy in PCF using manifests.
Languages used : python, php and javascipt.
I gone through the docs about pcf with manifest.yml
In that I don't have any idea about services and env.
What is that services and how can I find the services for the above project and also how can I find the environment variables?
And tell whether these fields are mandatory to run the project in PCF.
To your original question:
What is that services and how can I find the services for the above project and also how can I find the environment variables? And tell whether these fields are mandatory to run the project in pcf.
Does your app require any services to run? Services would be things like a database or message queue. If it does not, then you do not need to specify any services in your manifest. They are optional.
Similarly, for environment variables, you would only need to set them if they are required to configure your application. Otherwise, just omit that section of your manifest.
At the end of the day, you should talk with whomever developed the application or read the documentation they produce as that's the only way to know what services or environment variables are required.
In regards to your additional questions:
1)And also I have one more query...like in our application we used python ok! In that we use lots of pacakages say pandas,numpy,scipy and so on...how can I import all the libraries into the PCF ??? Buildpacks will contain version only right?
Correct. The buildpack only includes Python itself. Your dependencies either need to be installed or vendored. To do this for Python, you need to include a requirements.txt file. The buildpack will see this and use pip to install your dependencies.
See the docs for the Python buildpack which explains this in more detail: https://docs.cloudfoundry.org/buildpacks/python/index.html#pushing_apps
2)And also tell me what will be the path for my app name if Java I can enclose jar files
For Java apps, you need to push compiled code. That means, you need to run something like mvn package or gradle assemble to build your executable JAR or WAR file. This should be a self contained file that has everything necessary to run your app, compile class files, config, and all dependent JARs.
You then run cf push -p path/to/my-app.jar (or WAR, whatever you build). The cf cli will take everything in the app and push it up to Cloud Foundry where the Java buildpack will install things like the JVM and possibly Tomcat so you app can run.
what should I do for application devloped using pyhton , JavaScript and php....
You can use multiple buildpacks. See the instructions here.
https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html
In short, you can have as many buildpacks as you want. The last buildpack in the list is special because that is the buildpack which will set the start command for your application (although you can override this with cf push -c if necessary). The non-final buildpacks will run and simply install dependencies.
3) we were using postgresql how can I use this in pcf with my app
Run cf marketplace and see if there are any Postgres providers in your Marketplace. If there is one, you can just do a cf create-service <provider> <plan> <service name> and the foundation will create a database for you to use. You would then run a cf bind-service <app> <service name> to bind the service you create to your app. This will generate credentials and pass them along to your app when it starts. You app can then read the credentials out of VCAP_SERVICES and use them to make connections to the database.
See here for more details:
https://docs.cloudfoundry.org/devguide/services/application-binding.html
https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES

How to load a java class in torquebox at startup?

How do I go about loading a java class in torquebox at startup? Here is the issue I am running into, one of my gems needs a certain java class available (com.sun.org.apache.xpath.internal.VariableStack), it is available if I load irb in jruby in the local environment, but using the torquebox console it is not found. This causes the server to fail when it tries to boot as the gem needs this class. I believe I found a jar file (I THINK jaxp-ri-1.4.2.jar contains it) that contains this class but I have not been able to figure out how to load it successfully in torquebox at startup.
TB's modules setup some class isolation by default - so you might not see internal classes such as com.sun.xxx. try looking into JBoss' proprietary descriptor jboss-web.xml to relax access to some of the packages.
here's how classes are isolated by default in TB/JBosss: https://developer.jboss.org/wiki/JBossClassLoadingUseCases

How to Set Maven Parameters in OpenShift

I'm completely new to OpenShift and so far ran in hundreds of bugs while trying to create my first application. Now I want to configure Maven to use my own goals. So far I tried:
adding a Jenkins and configuring the Maven Build - the Jenkins didn't take up the changes and finally stopped building altogether
adding a file .openshift/action_hook/pre_build with the content export MAVEN_ARGS="clean package -Popenshift" as explained here
adding a file .openshift/action_hook/build with the content mvn clean package -Popenshift as explained there
Evidently, the documentation is somewhat obsolete... so what is the correct way?
I finally managed to get the Jenkins to build with my goals. The misconception was that it would use the configured Maven goals INSTEAD of the default ones, when it would just use them additionally (he never had to, since the shell script failed). So deleting the script and adding a custom Maven build works.

How to integrate Parasoft (JTest) in Hudson?

I normally use JTest Parasoft as a plugin in Eclipse.
But now, I need to integrate JTest in Hudson, at a way that in the Post-build, JTest should run its tests over a Maven project.
So my questions are :
How to integrate JTest in Hudson? I found a plugin CppTest by Parasoft and not JTest...
How to specify the tests which should be run on the project? For example, configure JTest to run "Find unused code" which is included in "Static Analysis"...?
Thank you a lot.
Jtest has fully functional command line interface so generally integration should not be a problem.
As for your questions:
1) there is a Jtest plugin for Maven, so you will be able to trigger your post-build action easily. It's thoroughly described on http://build.parasoft.com .
2) you can specify the Test Configuration of your choice by using -Dparasoft.config option (i.e.: mvn parasoft:jtest -Dparasoft.config="user://Unused Code").
You can find all the parameters which can be used with parasoft:jtest goal described here: http://build.parasoft.com/docs/maven-parasoft-plugin/jtest-mojo.html .
We have integrated Jenkins with Jtest (Linux)
Downloaded the Jtest installers and installed in Jenkins server (in slaves too if you have slaves attached)
Env variables for same has been set (JTEST_HOME)
And now without any entries for Jtest in Pom or build.xml files, we
can directly call the jtestcli commands either in invoke shell
section or use Jtest goals with maven too.
We need to make sure that we have maven-parasoft-plugin 3.12 and Jtest dependencies available in maven repo (for maven projects) and we should have parasoft-ant-3.12.jar available which we need to place in ant lib folder (for ant projects).

Store environment-specific OSGI Configurations for CQ

I'd like to store the Felix configurations we've made in SVN and have them applied to CQ in the packages produced by an automated build. To do this I have been following the instructions found in this CQ5 OSGI Configuration Document to create sling:OsgiConfig configuration nodes that get checked into SVN.
How can I store environment-specific configurations? For example, I want a different logging configuration for the DEV environment than the PROD environment will use. I would like to store the config for both environments in SVN ideally and have the environment pick which config to use somehow based on the environment.
How can I do that--or is there a different approach that I should be using for environment-specific configurations?
To have environment-specific configurations, you should use Run Modes in CQ5 - there is plenty of information here on how to achieve this_page
Hope this helps.