SMBJ no longer working when I modify JMX port settings - rmi

I have an application running under spring boot utilizing SMBJ to mount and read remote files, and it works perfectly. However I am trying to set up some datadog reporting and trying to use JMX as a datasource for datadog...
TO do this I am staring the springboot jar with the following:
ENTRYPOINT java -Djava.rmi.server.hostname=myhost
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.port=8089
-Dcom.sun.management.jmxremote.rmi.port=8089
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-jar demo-0.0.1-SNAPSHOT.jar
And once I do this, SMBJ no longer creates the mount. If I remove these parameters the code works fine again and SMBJ is able to create/mount to the share, If I have them it simply times out trying to create the share. I thought maybe it was the RMI hostname change, but removing just this this doesn't seem to fix it.
Can anyone offer any help on this? Is SMBJ really dependent on the jmxremote settings? It certainly seems to be..I have tried removing the overriding of the ports, so they go to their default ports as well, but this didn't fix it either.
Any help would be appreciated.

Related

How to change configuration in play dynamically via JMX

I have my configuration for my Scala Play application in my application.conf file.
For now, everytime I want to change the configuration I have to make a deployment.
Can anybody help me finding out, how to expose the Configuration as a MBean?
I would like to change the configuration without deployment.
Didn't find any documentation on this.
Redeploy just for a configuration change is really boring and I understand you want to avoid that.
Changing configuration while the application is running is a risky operation and I would not recommend going in that direction.
But there are a few techniques that the framework provides that would only require a restart of the application.
Play allows you to point to an external file with your configuration
$ your-app -Dconfig.file=/full/path/to/conf/application-prod.conf
Besides that in your conf file you can use environment variables, so you can configure different servers differently using the same application.conf
my.key = defaultvalue
my.key = ${?MY_KEY_ENV}
And run your app using
$ your-app -DMY_KEY_ENV=bar
Reference:
https://www.playframework.com/documentation/2.4.x/Production
https://www.playframework.com/documentation/2.4.x/ProductionConfiguration

How to run multiple JBoss EAP 6.3 instances as Windows services

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.

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).

How to force Typesafe Activator to listen 0.0.0.0:8888

I recently installed Typesafe Activator to a VM. Applications created by activator can be accessed after port forwarding, but Activator seems to listen localhost. How to change this to WAN?
It looks like setting system properties http.address and http.port will now do this job, e.g.
./activator -Dhttp.address=0.0.0.0 -Dhttp.port=80
Would launch Activator on a WAN on port 80 (assuming matching permissions, etc).
It is hardcoded right now and there's no way to change short of recompiling from source. https://github.com/typesafehub/activator/blob/master/ui/app/activator/UIMain.scala#L99
Maybe we could prefix this with if (System.getProperty("http.address") == null)
File an issue on github?
Update: this is now fixed so that -Dhttp.address works (and above source link no longer goes to the right place)
Base on Michael Nash's answer, but should be
./activator ui -Dhttp.address=0.0.0.0 -Dhttp.port=80
for version 1.2.10

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.