Not able to set options in JAVA_OPTS in JBoss openshift - jboss7.x

I want to change the server running timezone. So I want to add timezone option in JAVA_OPTS.
(-Duser.timezone=GMT).
I have tried to edit '/var/lib/openshift/548c33cce0b8cd44d3000083/jbossas/bin/standalone.conf' in JBoss cartridge of openshift, but failed because of Permission denied.
I have referred one solution mentioned in https://forums.openshift.com/how-to-pass-jvm-options-to-jboss-7as.
That is to add "export JAVA_OPTS="$JAVA_OPTS -Duser.timezone=GMT" in 'pre_start_jbossas' file in action_hooks folder and push it.
I did the same and it is working fine. The timezone options is correctly added in java_opts at the time of server start up.
Problem here is, at the time of cartridge restart, the timezone option is not present in Java_Opts. Please provide some solution.

Use JAVA_OPTS_EXT instead. Remember to put trailing and leading spaces, like:
export JAVA_OPTS_EXT=" -Duser.timezone=GMT "

Related

DNS unable to resolve canonical hostname

I'm unable to solve the below error since hours in Solr Admin. Please help me.
Unable to resolve canonical hostname for local host,​ possible DNS misconfiguration. Set the 'solr.dns.prevent.reverse.lookup' sysprop to true on startup to prevent future lookups if DNS can not be fixed.
The standard JVM accepts -D<param name>=<value> to set global configuration values available to the running application.
Depending on how you're starting Solr, you can edit solr.in.cmd in Windows or solr.in.sh in Linux or OS X.
Search for SOLR_OPTS and see how it uses -D... parameters to set new values. -Dsolr.dns.prevent.reverse.lookup=true is what you'd add as a setting like this.
Fixing DNS would be to make sure that localhost resolves locally at least.
The most direct way to fix this issue is to start Solr with the system property solr.dns.prevent.reverse.lookup=true in the command line.
For instance under Windows in a PowerShell console :
bin\solr.cmd start "-Dsolr.dns.prevent.reverse.lookup=true"

how to add db directory to web.xml

I have a java web app configured with apache v9.0 and eclipse IDE. What I need is to keep my database in C:\db so It cannot be access directly from outside and should be away from my webapp project directory. What I don't is how to let my web app know that if a user request for a file it should go and check it in my C:\db and reply back with the file.
Based in my research, some was saying to specify my directory in my webapp web.xml file and others was saying I need to specify it in my tomcat/conf/server.xml file.
I'd really appreciate if somebody tell me what to do?
Try adding your database path C:\db as JVM argument and accessing it in application. you may try this as two ways either set as system property and access when it required or set as JVM argument and access it.
SetSystemProperties
System.setProperty("database", "C:\\db");
.
.
access it as and when required
String databasepath= System.getProperty("database");
Setting as JVM Arguments.
Double Click on your tomcat server on which your web application is present.
Click on "Open launch configuration" link and go to Arguments Tab.
in vmArguments apend the entry like below.
-Ddatabase="C:\db"
A -D is placed in front of each system property that we are passing in as a VM argument, and following this is an equal sign followed by the value of that system property.
And access it in your project where its required like below.
String databasepath= System.getProperty("database");

Archiva ignoring Security.properties

Seems like archiva 2.2 is completely ignoring Security properties
I am following this document:
I have set up the security.properties file under
D:\Apache\Archiva-2.2.0\conf
When I am setting a new password for a user in Archiva UI I am still getting:
You must provide a password containing at least 1 numeric character(s).
security.properties content:
# Security Policies
#security.policy.password.encoder=
security.policy.password.previous.count=9999
security.policy.password.expiration.days=99999
security.policy.password.expiration.enabled=false
security.policy.allowed.login.attempt=3
# Password Rules
security.policy.password.rule.alphanumeric.enabled=false
security.policy.password.rule.alphacount.enabled=false
security.policy.password.rule.alphacount.minimum=0
security.policy.password.rule.characterlength.enabled=true
security.policy.password.rule.characterlength.minimum=3
security.policy.password.rule.characterlength.maximum=0
security.policy.password.rule.musthave.enabled=false
security.policy.password.rule.numericalcount.enabled=false
security.policy.password.rule.numericalcount.minimum=0
security.policy.password.rule.reuse.enabled=false
security.policy.password.rule.nowhitespace.enabled=true
Stop her running and make a backup of your conf/archiva.xml file.
example:
service archiva stop
cp archiva.xml archiva.xml.orig
Edit the config values you want to modify within the main XML configuration file: conf/archiva.xml
Changing the numeric character count:
<numericalcount>
<minimum>0</minimum>
<enabled>false</enabled>
</numericalcount>
Changing the password expiration limit:
<expiration>
<enabled>false</enabled>
<days>999999</days>
</expiration>
These values should already be in your config file (they were in mine). Perhaps they were copied there after my unsuccessful attempts to configure them through the web UI.
Additionally, prevent any user caching behaviour while you're making changes:
<useUsersCache>false</useUsersCache>
Start her up again:
service archiva start
I found a workaround...
stop Archiva
Open the Archiva DB using squirrel sql
Go to SA/JDOUSER table
Column LAST_PASSWORD_CHANGE
Right click to make editable
Modify the value to 10 years from now...
Restart Archiva
Get your 10 years of quiet....

RabbitMQ error on startup - erlexec: HOME must be set

For some reason I cannot start RabbitMQ anymore after it crashed.
I am getting the following error:
erlexec: HOME must be set
I've tried to export my home to /home/ubuntu but still getting the same error.
Any ideas?
I'm assuming that you are trying to start rabbitmq with something like service start rabbitmq-server. If so, the service command strips out environment variables. So you will need to either define it in your start up script or in a config file for your startup script (see https://unix.stackexchange.com/a/44378).
Additionally, I believe the rabbitmq home directory is actually /var/lib/rabbitmq/.
I have found suitable solution for myself. You can run epmd service before RabbitMQ server. This is fixing issue with HOME variable and others.
erlexec needs the environment variable HOME to be set in order to place a cookie (that contains a string). If HOME was for some reason unset in the environment that you are running rabbitmq (or rabbitmqctl) in, then you will get this error.
Try to check if HOME is defined by typing:
$ env
to get the list of defined environments. If it was not defined try to define it with
$ export HOME=/var/lib/rabbitmq
If you are using python3 and tox, note that tox by default does not pass current environment variable to the test environment. You will have to add the following to tox.ini
setdev =
HOME=/var/lib/rabbitmq
Just wanted to mention it because it gave me a headache the entire day today and I finally understood what was the issue and I though I should share this hint.

XX:OnOutOfMemoryError on setenv.sh

i want to set a script which will restart the server automatically.
And i write the following code to setenv.sh file
JAVA_OPTS="$JAVA_OPTS -XX:OnOutOfMemoryError=/usr/local/apache-tomcat-5.5.30/bin/shutdown.sh;/usr/local/apache-tomcat-5.5.30/bin/startup.sh;"
It not working properly.
I am using tomcat 5.
To answer your question - I don't think the error handler can run several commands. If you want to do this, then write a small restart script and run your custom script.
However, I would think about this again. Not every OutOfMemoryError means the server should be restarted automatically. You'd better to get a notification and then profile the server to get the cause of the OOME, so you can get rid of it.
P.S
Any reason to use the old tomcat 5.5? tomcat 7 is quite mature.
Use CATALINA_OPTS instead
CATALINA_OPTS="${CATALINA_OPTS} -XX:OnOutOfMemoryError=\"/bin/sleep 30;/bin/kill %p; /bin/sleep 60; /bin/kill -9 %p\""