How to run multiple JBoss EAP 6.3 instances as Windows services - jboss

We are migrating our JBoss EAP 4.3 infrastructure to EAP 6.3 (standalone).
We currently run several instances on each machine by having different server folders:
JBOSS_HOME\server\instance_1
...
JBOSS_HOME\server\instance_n
and a different set of startup scripts for each instance:
JBOSS_HOME\bin\run_instance_1.bat ; JBOSS_HOME\bin\service_instance_1.bat
...
JBOSS_HOME\bin\run_instance_n.bat ; JBOSS_HOME\bin\service_instance_n.bat
This way you can define SERVERNAME and SERVERIP for each instance from service_instance_X.bat.
The problem I'm facing is that I cannot seem to find a similar mechanism on EAP6.3. The closest I got was this command:
JBOSS_HOME\bin\standalone.bat -Djboss.bind.address=%SERVERIP% -Djboss.bind.address.management=%SERVERIP% -Djboss.server.base.dir
=%JBOSS_HOME%\%INSTANCENAME%
which does the job, but that does not help when running it as a service.
There is one promising option to prunsrv which is ++JvmOptions, where you can pass -D and -X options to JVM at service install time, but even when the install command runs successfully with the added options, it keeps starting up using JBOSS_HOME\standalone as jboss.server.base.dir.
Should I rather have custom service.bat, standalone.bat and standalone.conf.bat scripts? Looks like the best approach, but migrating or patching might become troublesome.
Any ideas would be welcome.
Sebastian

I had it working with the last option I mentioned: custom service_instancename.bat, standalone_instancename.bat and standalone_instancename.conf.bat.
But I had to edit several parts of the scripts. Definitely not ideal, but I see no other choice. If anyone came up with a better idea, please share.

Related

How to disable/bypass JBoss EWS 2.0 logging on OpenShift?

I am able to deploy a war on OpenShift using git (git add, push ...) and it works. The only problem that I encountered is that all my logs are doubled (only when I deploy on OpenShift) whereas locally (using apache tomcat 7 with only log4j framework) all my logs are only logged one time.
After having searched one day on the Internet, I have found two ways to normally fix that problem, which is to find how to disable/bypass JBoss EWS 2.0 logging on OpenShift:
Clues found on Google
1) Add a JAVA_OPT to Startup
Now, when starting the application server, you will need to add a JAVA_OPT. This flag will make sure that the JBoss Log Manager does not pick up your logging configuration and your own logging JARs will work as normal.
./standalone.sh -Dorg.jboss.as.logging.per-deployment=false
And now your application will now log using the packaged JARs, effectively bypassing JBoss Logging.
Source: http://blog.jyore.com/?p=234
2) It looks like you have a log4j configuration file in your deployment. Try passing
-Dorg.jboss.as.logging.per-deployment=false
to disable that configuration from being used.
--
James R. Perkins
Source: https://community.jboss.org/thread/224127
My implementation of these clues
For implementing these solutions I did two things:
1) I created and git push this hook below:
vim .openshift/action_hooks/pre_start_jbossews-2.0
echo "executing pre_start_jbossews-2.0"
# I also tried with JAVA_OPTS
export JAVA_OPTS_EXT="-Dorg.jboss.as.logging.per-deployment=false"
echo "Value is: $JAVA_OPTS_EXT"
Note: this hook is well triggered, because I can see the echo when the server restarts after having pushed the modifications.
2) I also added this line in catalina.properties:
vim .openshift/config/catalina.properties
-Dorg.jboss.as.logging.per-deployment=false
Conclusion at that time:
Unfortunately none of these solutions disable/bypass JBoss EWS 2.0 default logging.
I am currently stuck with double log lines, so any help would be greatly appreciated, I count on you guys.
Thank you very much in advance for your help.
On Openshift the right way to setup persistent environment values is to use rhc tool:
rhc set-env JAVA_OPTS_EXT=-Dorg.jboss.as.logging.per-deployment=false -a myapp
Then try to explicitly stop and start your application (with rhc stop and rhc start).

mapreduce programs using eclipse in CDH4

I am very new to Java, eclipse and Hadoop things, so pardon my mistake if it my question seems too silly.
The question is:
I have 3 node CDH4 cluster of RHEL5 on cloud platform. CDH4 setup has been completed and now I want to write some sample mapreduce programs to learn about it.
Here is my understanding to how to do it:
To write Java mapreduce programs I will have to install Eclipse in my main server, right? Which version of eclipse should i go for.
And just installing eclipse will not be enough, I will have to do some setting changes so that it can use my CDH cluster, what are the things needed to do this?
and last but not least, could you guys please suggest some sites where i can get more info regarding same, remember i am just beginner in all these..:)
Thanks in advance...
pankaj
Pankaj, you can always visit the official page. Apart from this you might find these links helpful :
http://blog.cloudera.com/blog/2013/08/how-to-use-eclipse-with-mapreduce-in-clouderas-quickstart-vm/
http://cloudfront.blogspot.in/2012/07/how-to-run-mapreduce-programs-using.html#.UgH8OWT08Vk
It is not mandatory to have Eclipse on the main server(main server=master machine???). Any of the last 3 versions of eclipse work perfectly fine. Don't know about earlier versions. You can either run your job through Eclipse directly or you can write your job in Eclipse and export it as a jar. You can then copy this jar to your JT machine and execute it there through the shell using hadoop/jar command. If you are running your job directly through the eclipse you need to tell it the location of your NameNode and JobTracker machines though these properties :
Configuration conf = new Configuration();
conf.set("fs.default.name", "hdfs://NN_HOST:9000");
conf.set("mapred.job.tracker", "JT_HOST:9001");
(Change the hostnames and ports as per your configuration).
One quick suggestion though. You can always search for these kind of things before posting the question. A lot of info is available over the net and it is very easily accessible.
HTH

Jboss load system properties from file

Can I make jboss load system properties from a file without writing any explicit code for it?
Yes you can.
In JbossAS versions prior to 7.x there is PropertiesService. It's dead simple to use. I am using it with JBoss 5.1.0.GA, and it works like a charm.
Unfortunatelly PropertiesService mbean is absent in JBossAS 7.x, but there are other ways as described in official admin guide.
Here is another solution. Post author claims it's possible to list your properties files in command line while starting server instance:
./standalone.sh --properties=1.properties --properties=2.properties
and their contents should be added to System Properties.

Launch ColdFusion from command line

Is there a way to launch ColdFusion from the command-line?
I am not talking about launching the CF and related services with the net start command.
I remember doing this in the past. Basically, running CF from the command-line offered two advantages:
You didn't need to keep it as a Service and either have it always launch at boot-up or have to deal with the Services Manager
(more importantly) It echoed back to the screen all kinds of messages, especially error messages, which were helpful when actively developing (because you didn't need to go dig in the ColdFusion log files to find them)
It is possible that I'm mis-remembering and that this hasn't been available since ColdFusion 5.0. Is it at all possible with ColdFusion 9?
Update: Environment: Multi-server configuration with JRun.
Two ways to do this:
In development, add the server to ColdFusion Builder, and all the messages you talk about will show up in the console tab.
Start ColdFusion from the command line. The instructions are slightly different per environment but basically you want to get to bin directory and issue jrun start cfusion or coldfusion start or something similar . Post your environment for more specifics.
Go to C:\JRun\bin and issue jrun start cfusion
In your ColdFusion9/bin Folder you can find stop.bat and start.bat. Executing the latter gives you exactly what you want.

JBoss Application Server redeploy

I need a windows shell script which will redeploy my .ear file. I wrote one:
net stop "JBAS50SVC"
copy /y O:\TEMP\app.ear C:\jboss-4.2.3.GA\server\default\deploy\app.ear
net start "JBAS50SVC"
But the problem is that when I try to stop the JBoss service it does not fully unload itself (my suggestion), so when I start it there's no app deployed in JBoss.
You mentioned that JBoss becomes very slow when you use autoDeploy and keep the server running for a month or more. That's likely to be because your permanent generation memory is filling up over time. See this related question.
I think you'd be best served by using the autoDeploy feature as other suggest, and restarting the entire server periodically to clear out PermGen. There's several ways to track PermGen utilization; I add the following to JAVA_OPTS in run.conf:
-XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -Xloggc:$LOGDIR/gc.log
Typically to redeploy an application that is self-contained in an ear in jboss just requires replacing the ear. If there is more to the application (such as classes that have to go in the jboss lib directory) then it may require a restart.
In terms of how to restart it, it depends what you are using to start jboss as a service. Some service starters do not actually control the jvm after they start it, so restarting the service just starts a second instance. You can shutdown jboss with the shutdown script in the JBOSS_HOME/bin directory (shutdown.bat) and then deploy and restart the service. Be sure to pause when you do this, as the shutdown command will issue the shutdown request, the server may still be running.
You can just COPY/RENAME the EAR file to deploy directory. JBoss will automatically take care of re-deployment for you.
As mentioned earlier jboss automatically deploys everything you copy into the deploy directory by default.
If not, check if you are working on a vhost that doesnt autodeploy ear files.
<Host name="vhost2" autoDeploy="false" .... />
other than that, I feel like this is a totally different error due to the fact that jboss takes care of deployment for you. Please check the log files for startup errors of your application.
You might want to check the JBoss community wiki on this, there are undoubtedly easier and more reliable methods than a batch file.
Stopping the server should not undeploy the application - that wouldn't make much sense.