Java client 2.0 + JSF 2.2 OperatingSystemMXBean error on connect to Cluster

trying a simple connection to Couchbase Server 3.0.0 from java-client 2.0 and 2.0.0-beta2 throws following error :

15:44:51,334 INFO  [com.couchbase.client.core.CouchbaseCore] (MSC service thread 1-9) CoreEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword='null', queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=12, computationPoolSize=12, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, packageNameAndVersion=couchbase-java-client/2.0.0-beta2 (git: 2.0.0-beta2)}
15:44:51,335 ERROR [] (MSC service thread 1-9) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$ [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( [rt.jar:1.7.0_55]
	at java.util.concurrent.ThreadPoolExecutor$ [rt.jar:1.7.0_55]
	at [rt.jar:1.7.0_55]
Caused by: java.lang.NoClassDefFoundError: com/sun/management/OperatingSystemMXBean
	at com.couchbase.client.core.env.Diagnostics.systemInfo(
	at com.couchbase.client.core.env.Diagnostics.collect(
	at com.couchbase.client.core.env.Diagnostics.collectAndFormat(
	at com.couchbase.client.core.CouchbaseCore.<init>(
	at com.myproject.testproject.ApplicationContextListener.connectToCouchbase(
	at com.myproject.testproject.ApplicationContextListener.contextInitialized(
	at io.undertow.servlet.core.ApplicationListeners.contextInitialized(
	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService( [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	at org.jboss.msc.service.ServiceControllerImpl$ [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
	... 3 more
Caused by: java.lang.ClassNotFoundException: from [Module "deployment.TestProject-1.0-SNAPSHOT.war:main" from Service Module Loader]
	at org.jboss.modules.ModuleClassLoader.findClass( [jboss-modules.jar:1.3.3.Final]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked( [jboss-modules.jar:1.3.3.Final]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked( [jboss-modules.jar:1.3.3.Final]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass( [jboss-modules.jar:1.3.3.Final]
	at org.jboss.modules.ConcurrentClassLoader.loadClass( [jboss-modules.jar:1.3.3.Final]
	... 20 more

line 35 of ApplicationContextListener is :

Cluster cluster = CouchbaseCluster.create( );

any help appreciated.

Oh, this could be a bug we’ve not anticipated. It looks like the OperatingSystemMXBean is not available.

I’ve created a ticket to get this fixed (
But can you please tell us the OS and JVM you are using? I’m curious

Oh, this could be a bug we’ve not anticipated. It looks like the OperatingSystemMXBean is not available.

Can you tell us which JVM and app server you are using?
We need to get this more resilient, thanks for raising it (

OS X 10.9.4
java jdk1.7.0_55
java-client 2.0 and 2.0.0-beta2

thanks much, would it be possible that you share a code example on github or as a zip package here? Just something that I can run as a app on wildfly to verify a fix is working. Very much appreciated!

Nevermind, got it running on my own.

I’m glad to report that I’ve reproduced the issue and already fixed it on master. We have a 2.0.1 release due tomorrow, please grab this version and you should be good. If you find any other issues after that let me know as well.

cool. sounds good will do. thanks

2.0.1 is out already, please give it a shot @testingCbJava2

@daschl just finished migrating an entire JSF 2.2 app from couchbase-client 1.4.4 to couchbase java-client 2.0.1

everything is working, good stuff!

1 Like

@testingCbJava2 that is awesome to hear! Is it by chance open source so I can take a look? If not, I’d love to get in touch so I can take a look nevertheless, I want to learn more about how people are approaching the 2.0 SDK and close the feedback loop.

@daschl of course!
the classes used to handle everything to and from couchbase are opensource.
code at

the main java-client 2+ files being :
//handles main connections (cluster / buckets)
//anything that needs CRUD on couchbase extends…
and com.devstackio.maven.couchbase.ContractCbDao’s convert method, to demo how all extended classes should look

Great, thanks!

A few things of notice:

thanks alot!
new version updated
: initCluster method added to initialize single cluster connection
: addBucketToCluster method added to add individual buckets
:convertToRawJsonDoc method added to skip extra step of converting JsonDoc
:updated crud methods that used JsonDoc to use RawJsonDocument instead

the disconnect on the single cluster was already there as closeClusterConnection()

thanks again!