Is it possible to trigger GC via JMX in JBoss 6?
My problem is that the platform MBeans are not being published at all.
I enabled JMX with the jboss.platform.mbeanserver as follows:
JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=n"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=8007"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.69.68.217"
JAVA_OPTS="$JAVA_OPTS -Djboss.boot.server.log.dir=/app/logs/cps/log"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/app/jboss6/boot/jboss-logmanager.jar"
A similar question was asked here.
JBoss JMX twiddle Runtime not registered
Many thanks,
Lee
Related
I'm trying to use external security provider, like nCipherKM on Wildfly24.0.0 and JDK 11.0.11, however with no luck so far.
I've configured standalone.conf with:
JDK_JAVA_OPTIONS="-cp /opt/nfast/java/classes/nCipherKM.jar"
and
JAVA_OPTS="$JAVA_OPTS $JDK_JAVA_OPTIONS"
And I see wildfly started with that classpath, however, when I want to use it with the application, I'm getting the following in the server.log:
java.security.NoSuchProviderException: no such provider: nCipherKM
In the java.security I have added:
security.provider.13=nCipherKM
Any ideas what I'm missing?
Thanks
After looking into the nCipher user guide I noticed that after I ran this:
`java --module-path /opt/nfast/java/classes com.ncipher.provider.InstallationTest
Installed providers:
1: SUN
2: SunRsaSign
3: SunJSSE
4: SunJCE
Unlimited strength jurisdiction files are installed.
The nCipher provider is not correctly installed.`
See, something is not correctly set in the java.security file.
So, instead just putting security.provider.13=nCipherKM I actually put
security.provider.13=com.ncipher.provder.km.nCipherKM
The result is:
java --module-path /opt/nfast/java/classes com.ncipher.provider.InstallationTest
Installed providers:
1: SUN
2: SunRsaSign
3: SunJSSE
4: SunJCE
5: nCipherKM
Unlimited strength jurisdiction files are installed.
The nCipher provider is installed, but is not registered at
the top of the providers list in the java.security file. See
the user guide for more information about the recommended
system configuration.
nCipher JCE services:
Alg.Alias.AlgorithmParameters.DESede
...
Then in the standalone.conf I used the exact --module-path option as I did for the installationTest, like this:
JDK_JAVA_OPTIONS="--module-path /opt/nfast/java/classes" JAVA_OPTS="$JAVA_OPTS $JDK_JAVA_OPTIONS"
And restarted wildfly service.
And, application can now reach the nCipherKM and the key loads with success! :)
Hope this helps someone out there.
We have keycloak 3.2.0 working on Docker.
When we run it, we add the ARGS --server-config standalone-ha.xml
e.g
Docker run foo bar jboss/keycloak:4.5.0.Final --server-config standalone-ha.xml
Purely because we're running a few nodes to the same DB
Upgrading to 4.5, the documentation here:
https://www.keycloak.org/docs/latest/server_installation/index.html#_standalone-ha-mode
Says, also add
--server-config standalone-ha.xml
However, when i do that (From version 4.0 onwards), i get
21:12:03,574 INFO [org.jboss.modules] (main) JBoss Modules version 1.8.6.Final
java.lang.IllegalArgumentException: WFLYSRV0191: Can't use both --server-config and --initial-server-config
at org.jboss.as.server.Main.assertSingleConfig(Main.java:395)
at org.jboss.as.server.Main.determineEnvironment(Main.java:169)
at org.jboss.as.server.Main.main(Main.java:96)
at org.jboss.modules.Module.run(Module.java:352)
at org.jboss.modules.Module.run(Module.java:320)
at org.jboss.modules.Main.main(Main.java:593)
21:12:03,973 FATAL [org.jboss.as.server] (main) WFLYSRV0239: Aborting with exit code 1
Now, if i run keycloak WITHOUT --server-config, and i enter the container, PS AUX shows its running standalone-ha.xml as config.
But thats because we are migrating from a DB which has 3.2.0 previously installed.
How do i enable and constantly make sure that standalone-ha.xml gets selected by passing parameter --server-config to choose the *-ha.xml configuration?
Thanks
It is a problem in Keycloak. Using -c instead of --server-config helps.
See https://issues.jboss.org/browse/KEYCLOAK-9393 for more details.
Could you help me enable jmx port for Jboss6.1. I tried added many options to start script my application, but this is didn't help.
My last attempt was like:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_ARGS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
JBOSS_CLASSPATH="../lib/jboss-logmanager.jar"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9002"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.244.222.201"
Jboss just didn't start after this.
Version Jboss from log: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8)
I'm fixed problem after added
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9002"
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.6.194.242"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/app/jboss-eap-6.1/lib/jboss-logmanager-1.4.0.Final-redhat-1.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/app/jboss-eap-6.1/lib/slf4j-jboss-logmanager-1.0.2.GA-redhat-1.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/app/jboss-eap-6.1/lib/log4j-jboss-logmanager-1.0.1.Final-redhat-2.jar"
and
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.logmanager"
Now I have another error, but this new story.
ps. New error:
2018-07-19 17:47:40,716 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 5) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "logging"),
("console-handler" => "CONSOLE")
Here my zkServer.cmd file :
#echo off
setlocal
call "%~dp0zkEnv.cmd"
set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
echo on
call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
endlocal
The skServer.sh script will run the zkEnv.sh script which in-turn will look for a script '../conf/zookeeper-env.sh'
create a file on the conf folder called zookeeper-env.sh
Paste this into the file and restart Zookeeper:
JMXLOCALONLY=false
JMXDISABLE=false
JMXPORT=4048
JMXAUTH=false
JMXSSL=false
First obtain the hostname (or reachable IP eg. lan/public/NAT address):
hostname -i
# or find ip
ip a
next add following options to ZOOMAIN (assumed hostname my.remoteconsole.org and desired port 8989)
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=8989
-Djava.rmi.server.hostname=my.remoteconsole.org
More details about available options in java docs (http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html).
ADD org.apache.zookeeper.server.quorum.QuorumPeerMain in server-start.
The class org.apache.zookeeper.server.quorum.QuorumPeerMain will start a JMX manageable ZooKeeper server. This class registers the proper MBeans during initalization to support JMX monitoring and management of the instance.
In addition to above answer by Marcell du Plessis, if you are running zookeeper as a systemd service, then you can specify jmx port in the environment variable.
[Unit]
Description=Apache Kakfa Zookeeper
Requires=network.target
After=network.target
[Service]
Type=simple
User=user
Group=users
ExecStart=/your-zookeeper-install-path/bin/zkServer.sh start
ExecStop=/your-zookeeper-install-path/bin/zkServer.sh stop
TimeoutStopSec=180
Restart=on-failure
Environment="JMX_PORT=9999"
[Install]
WantedBy=multi-user.target
Alias=zookeeper.service
I am not able to run my spring mvc+openjpa applicaton on jboss AS 7.1.x in my windows laptop.
After deployment when i execute it, it says -
org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "com.caobusiness.selfcare.entity.DummyTable#1698b9" to PersistenceCapable failed. Ensure that it has been enhanced.
After searching, i found that open jpa entities needs to be enhanced either during built time or run time. I am trying to enhance entity during runtime using javaagent, but it fails.
my jboss standalone.conf looks like
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
JAVA_OPTS="$JAVA_OPTS -javaagent:D:\openjpa-2.2.0.jar"
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
I do not want to go for built time enhancement as of now. I have gone through posts stackoverflow post and why enhancement is needed
Will appreciate some leads.