====== [[http://www.jboss.org/|JBoss]] ====== * [[http://labs.jboss.com/jbossas/downloads|JBoss release notes]] ===== Questions answered ===== === How to connect to JBoss via JMX? === First of all JBoss 6 uses [[https://jcp.org/en/jsr/detail?id=160|JSR-160]] extension for JMX protocol, and in order to enable support of it, copy the files: * ''jboss-cli-client.jar'' from JBoss AS 7.x / JBoss EAP 6.x ''bin/client/'' folder * ''jboss-cli-client.jar'' and ''jboss-modules.jar'' from JBoss 4 ''bin/'' folder and include them into the classpath to start JConsole and JVisualVM like in the following scripts: @echo off set CLASSPATH=%JAVA_HOME%\lib\jconsole.jar;%JAVA_HOME%\lib\tools.jar;jboss-cli-client.jar;jboss-modules.jar "%JAVA_HOME%\bin\jconsole.exe" "-J-Djava.class.path=%CLASSPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off set CLASSPATH=%JAVA_HOME%\lib\tools.jar;jboss-cli-client.jar;jboss-modules.jar "%JAVA_HOME%\bin\jvisualvm.exe" "-cp:a" "%CLASSPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9 **The native endpoint** is configured using the following configuration snippet: ''%%%%'' configures a special JBOSS-LOCAL-USER SASL mechanism which is based on the client being able to read a challenge file (e.g. ''jboss6/standalone/tmp/auth/challenge-6842367'') to prove that it is local. That means if you have only that option configured in realm, remote clients are rejected. However they can access endpoint through ''ssh -L9999:127.0.0.1:9999 10.0.0.1'' - Start local X server: \\ {{jboss_xserver.png|Start local X server}} - Enable X11 forwarding: \\ {{jboss_xforwarding.png|Enable X11 forwarding for SSH session}} - Start SSH session and launch jConsole: \\ ''user@server:/local/jboss/bin> ./jconsole.sh'' \\ {{ jboss_jconsole_remote.png?500|jConsole running remotely}} {{jboss_jconsole_remote_start.png|jConsole running remotely}} To enable access for remote users, one should create/use management user. When adding a user make sure it is added to correct realm: $ ./jboss6/bin/add-user.sh What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): a **The remoting endpoint** is configured using the following configuration snippet: For simplicity one may wish to remove authentication (less hassle with adding users via ''bin/add-user.sh''): --- jboss6/standalone/configuration/standalone.xml.orig 2015-08-11 19:14:52.000000000 +0200 +++ jboss6/standalone/configuration/standalone.xml 2015-08-11 19:34:12.000000000 +0200 @@ -340,7 +340,7 @@ - + To enable remoting endpoint, apply the following patch (if not yet applied): --- jboss6/standalone/configuration/standalone.xml.orig 2015-08-11 19:14:52.000000000 +0200 +++ jboss6/standalone/configuration/standalone.xml 2015-08-11 19:34:12.000000000 +0200 @@ -267,7 +267,7 @@ - + Now the connection should work: ''%%jconsole.bat service:jmx:remoting-jmx://10.0.0.1:4447%%'' ''%%jvisualvm.bat --openjmx service:jmx:remoting-jmx://10.0.0.1:4447%%'' If JBoss server is not directly accessible but there is SSH-access to the zone, one can use socks proxy: > ssh -D 1080 184.3.2.1 > jconsole.bat -J-DsocksProxyHost=localhost -J-DsocksProxyPort=1080 service:jmx:remoting-jmx://10.0.0.1:4447 {{ jboss_jconsole_local.png?500}} **Troubleshooting:** From [[http://planet.jboss.org/post/jmx_connections_to_jboss_as|JMX connections to JBoss AS]]:
The native management endpoint is exposed by default on port 9999. The remoting endpoint is exposed by default on port 4447. By default you can connect to JBoss AS to access JMX using the native management interface. To use the remoting interface you need to manually change the JBoss AS configuration. When you decide to change the configuration and use the remoting endpoint for JMX access, the native management endpoint will stop working. You cannot use both endpoints on one host.
See also: * [[https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole|Troubleshooting connection problems in JConsole]] * [[https://docs.oracle.com/javase/7/docs/technotes/guides/security/troubleshooting-security.html|Troubleshooting Security]] * [[stackoverflow>25046317|JConsole remote connection to JBoss EAP]] The given exception javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:367) at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:229) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180) at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) means that all authentication methods have failed. Make sure that the corresponding security realm has enough means to authenticate the user (e.g. property file is correctly configured). To start JConsole with logging enabled use this: ''%%jconsole.bat -debug -J-Djavax.net.debug=all -J-Djava.security.debug=gssloginconfig,configfile,configparser,logincontext,policy -J-Djava.util.logging.config.file=logging.properties service:jmx:remoting-jmx://10.0.0.1:4447%%'' # Comma separated list of log Handler classes that will be installed during VM startup. #java.util.logging.ConsoleHandler, handlers = java.util.logging.FileHandler # Default global logging level. .level = INFO # Handler specific properties. java.util.logging.FileHandler.level = FINEST java.util.logging.FileHandler.pattern = jconsole.log java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL %4$s [%2$s] %5$s%n # Facility specific properties. javax.management.level = FINEST javax.management.remote.level = FINEST #sun.rmi.level = FINEST If Visual VM fails with such log: TRACE [org.jboss.remoting3.remote.RemoteConnectionProvider connect] Attempting to connect to "/10.0.0.1:4447" with options {org.xnio.Options.SASL_DISALLOWED_MECHANISMS=>[JBOSS-LOCAL-USER],org.xnio.Options.SASL_POLICY_NOANONYMOUS=>false,org.xnio.Options.SASL_PROPERTIES=>[(jboss.sasl.local-user.quiet-auth=>true)],org.xnio.Options.SSL_STARTTLS=>true,org.xnio.Options.SASL_POLICY_NOPLAINTEXT=>false,org.xnio.Options.SSL_ENABLED=>true} TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener handleEvent] Setting read listener to org.jboss.remoting3.remote.ClientConnectionOpenListener$Greeting@74a069ce TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Greeting handleEvent] Client received greeting TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Greeting handleEvent] Client received server name: 10.0.0.1 TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener sendCapRequest] Client sending capabilities request TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capabilities response TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: version 1 TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: SASL mechanism ANONYMOUS TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] SASL mechanism ANONYMOUS added to allowed set TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: message close protocol supported TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: remote version is "3.3.4.Final-redhat-1" TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: remote channels in is "40" TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client received capability: remote channels out is "40" TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities handleEvent] Client initiating authentication using mechanism ANONYMOUS TRACE [org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities$2 run] Client authentication failed: javax.security.sasl.SaslException: Authentication name is empty DEBUG [org.jboss.remoting3.remote.RemoteConnection handleException] JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms try to enable //Do not require SSL connection// option in //Add JMX Connection// dialog.
=== How to enable Reasteasy 3 on JBoss 6 running Reasteasy 2? === Two prerequisites: * Module ''javaee.api'' has to be excluded, because that module explicitly depends on ''javax.ws.rs.api'' (and many others). * All providers (even those which are **not used by the application**) have to be excluded. The problem is that during the application startup, RESTEasy scans the classpath for ''META-INF\services\javax.ws.rs.ext.Providers''. If JBoss-wide provider is available in classpath, the API 2.x classes this module is compiled against are loaded. Other classes not used by that module but maybe referenced later by 3.x provider will be loaded from application dependency API 3.x. After that happens the classpath contains the deadly mixture of classes from both APIs, hence it might be that for these two classes org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider extends AbstractEntityProvider { ... } org.jboss.resteasy.plugins.providers.AbstractEntityProvider implements MessageBodyReader, MessageBodyWriter { ... } the expression ''MessageBodyReader.class.isAssignableFrom(AbstractJAXBProvider.class)'' would be ''false'', because there are two ''MessageBodyReader'' interfaces (2.x and 3.x) in classpath. Complete solution: References: * [[http://java.dzone.com/articles/jboss-modules-suck-it%E2%80%99s|JBoss Modules Suck, It’s Impossible To Use Custom Resteasy/JAX-RS Under JBoss 7]] * [[https://community.jboss.org/thread/241502#877023|You cannot do much if the JBoss server modules cannot be updated]] * [[https://access.redhat.com/site/discussions/711843|Impossible to ignore module javax.ws.rs.api and use other than bundled RestEasy]] * [[stackoverflowa>17872480/267197|RestEasy 3.0 keeps throwing NoSuchMethodError]] === How to import Sun JDK packages into classpath? === When deploying the application with included dependency ''com.sun.xml.messaging.saaj:saaj-impl'', the following exception is thrown: Caused by: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_24] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) [rt.jar:1.6.0_24] at java.lang.ClassLoader.defineClass(ClassLoader.java:616) [rt.jar:1.6.0_24] Use the following ''jboss-deployment-structure.xml'': or better remove this dependency and export it from module: References: * [[http://openam.forgerock.org/openam-documentation/openam-doc-source/doc/webhelp/install-guide/prepare-jboss-7.html|Preparing OpenAM & JBoss AS 7 / EAP 6]] * [[stackoverflowa>14892892/267197|java.lang.NoClassDefFoundError com/sun/net/ssl/internal/ssl/Provider in Jboss 7]] * [[http://gis.stackexchange.com/a/95037|Deploying Geoserver 2.5 using JBoss 7.1.1]] * [[https://community.jboss.org/message/641326#723349|JBoss 7.1 Beta1 no longer has the system module]] {{tag>JBoss}}