Couchbase timeout on bucket operation when in K8S pod - java

I was able to narrow down my problem to the following case:
I'm creating Kubernetes pod with two containers:
couchbase - initialized version with one bucket from offical Couchbase 3.1 image
my java app that tries to connect to Couchbase and use this bucket
My app's code is as follows (full content of main function):
CouchbaseEnvironment ce = DefaultCouchbaseEnvironment.builder()
.connectTimeout(10000)
.build();
CouchbaseCluster cluster = CouchbaseCluster.create(ce, "127.0.0.1");
Bucket bucket = cluster.openBucket("my_user", "some_pass");
JsonObject jo = JsonObject.empty();
jo.put("SomeName", "someValue");
bucket.upsert(JsonDocument.create("my_id", jo));
It fails on last command with timeout:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:93)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:267)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:262)
at CConfig.main(CConfig.java:19)
... 6 more
Caused by: java.util.concurrent.TimeoutException
... 10 more
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
... 1 more
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:93)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:267)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:262)
at CConfig.main(CConfig.java:19)
... 6 more
Caused by: java.util.concurrent.TimeoutException
... 10 more
I don't know how to fix this or get to the root cause as timeout is very unlikely as the Couchbase is having only one, empty bucket.
PS when configured logs for Couchbase client I was able to see keep-alive entries working just fine.
I'm using official Couchbase java client in version 2.1.0. Also tried 2.1.6 and 2.2.5 but no luck.

The problem was created by me - the bucket I have created didn't had password set and I tried to connect to it with password...
I wanted to delete whole answer but I thought that it might be helpful in case someone else have similar problem

Related

java.util.ConcurrentModificationException starting ear files with the release of Apache Tomee Plus 7.1.2

With the release of Apache TomEE Plus 7.1.2, our application is not starting. It starts in 7.1.1. I narrowed it down to this code change in org.apache.openejb.assembler.classic.Assembler.createApplication method at line 829. It seems to only happen when there are multiple web modules defined in the application.xml. I can't find any doc on why this was introduced.
for (Map.Entry entry : appContext.getProperties().entrySet()) {
if (Module.class.isInstance(entry.getValue())) {
appContext.getProperties().remove(entry.getKey());
}
}
One thing to note is if I put the 7.1.1 version of the openejb-core jar, the error goes away. Here is the stacktrace.
org.apache.openejb.OpenEJBException: Creating application failed: C:\apps\apache-tomee-plus-7.1.2\apps\ourApplication: null
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1101)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:755)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:633)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:485)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:307)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:247)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:168)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:137)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Caused by: java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:752)
at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:750)
at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1042)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:829)
... 18 more

Not able to initialize opennms database postgres after downloading all the packages in ubuntu 14.04

Following error is arriving while I initailize after downloading the packages of opennms:
PLease tell me what I am doing wrong or any suggestions how to resolve this issue
OpenNMS Installer
Configures PostgreSQL tables, users, and other miscellaneous settings.
15:48:58.468 [Main] WARN org.opennms.install.Installer - Could not create file: /usr/share/opennms/etc/libraries.properties
- using SQL directory... /usr/share/opennms/etc
- using create.sql... /usr/share/opennms/etc/create.sql
15:48:58.496 [Main] INFO org.opennms.core.schema.Migrator - validating database version
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:525)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.opennms.core.schema.MigrationException: an error occurred getting the version from the database
at org.opennms.core.schema.Migrator.getDatabaseVersion(Migrator.java:183)
at org.opennms.core.schema.Migrator.validateDatabaseVersion(Migrator.java:211)
at org.opennms.install.Installer.install(Installer.java:245)
at org.opennms.install.Installer.main(Installer.java:991)
... 6 more
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:446)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:220)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:55)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:219)
at org.postgresql.Driver.makeConnection(Driver.java:407)
at org.postgresql.Driver.connect(Driver.java:275)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.opennms.core.db.install.SimpleDataSource.getConnection(SimpleDataSource.java:113)
at org.opennms.core.schema.Migrator.getDatabaseVersion(Migrator.java:171)
... 9 more
Any suggestions?
It looks like you do not have permission to access the PostgreSQL database.
Did you edit pg_hba.conf?
I made a video on installing OpenNMS that you might find helpful. It covers the changes you need to make to PostgreSQL so that OpenNMS can access it.

"can not get class data for sun/java2d/Disposer"

I have used a script successfully in the past and the JDK did not change, but for some reason in this instance I was unable to convert a core dump to a hprof;
Attaching to core my.core from executable /opt/jdk1.8.0_31/bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.31-b07
Dumping heap to my.hprof ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.utilities.AssertionFailure: can not get class data for sun/java2d/Disposer$$Lambda$10x00000001002e8428
at sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeInstance(HeapHprofBinWriter.java:803)
at sun.jvm.hotspot.utilities.AbstractHeapGraphWriter$1.doObj(AbstractHeapGraphWriter.java:95)
at sun.jvm.hotspot.oops.ObjectHeap.iterateLiveRegions(ObjectHeap.java:353)
at sun.jvm.hotspot.oops.ObjectHeap.iterate(ObjectHeap.java:171)
at sun.jvm.hotspot.utilities.AbstractHeapGraphWriter.write(AbstractHeapGraphWriter.java:51)
at sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:433)
at sun.jvm.hotspot.tools.HeapDumper.run(HeapDumper.java:62)
at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
... 6 more
The Partial heap won't load with visualvm.
What could cause this?
Is this a known bug?
Is there a workaround?
This is a known bug and has been fixed starting with Java 8 Update 60.
See https://bugs.openjdk.java.net/browse/JDK-8044416
Java 8 ticket: https://bugs.openjdk.java.net/browse/JDK-8077507

web app on machine (on local computer works correctly)

I have an error:
Exception in thread "TCPSelector" java.lang.NoClassDefFoundError: org/eclipse/net4j/channel/ChannelException
at org.eclipse.net4j.internal.tcp.TCPAcceptor.createConnector(TCPAcceptor.java:218)
at org.eclipse.net4j.internal.tcp.TCPAcceptor.handleAccept(TCPAcceptor.java:188)
at org.eclipse.net4j.internal.tcp.TCPSelector.handleSelection(TCPSelector.java:230)
at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.java:179)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.eclipse.net4j.channel.ChannelException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 5 more
Exception in thread "TCPSelector" java.lang.ExceptionInInitializerError
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
at org.eclipse.internal.net4j.buffer.Buffer.write(Buffer.java:306)
at org.eclipse.net4j.internal.tcp.TCPConnector.handleWrite(TCPConnector.java:311)
at org.eclipse.net4j.internal.tcp.TCPSelector.handleSelection(TCPSelector.java:264)
at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.java:179)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Too many open files
at sun.nio.ch.FileDispatcherImpl.init(Native Method)
at sun.nio.ch.FileDispatcherImpl.<clinit>(FileDispatcherImpl.java:35)
... 9 more
Exception in thread "TCPSelector" java.lang.NoClassDefFoundError: Could not initialize class sun.nio.ch.FileDispatcherImpl
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
at org.eclipse.internal.net4j.buffer.Buffer.write(Buffer.java:306)
at org.eclipse.net4j.internal.tcp.TCPConnector.handleWrite(TCPConnector.java:311)
at org.eclipse.net4j.internal.tcp.TCPSelector.handleSelection(TCPSelector.java:264)
at org.eclipse.net4j.internal.tcp.TCPSelector.run(TCPSelector.java:179)
at java.lang.Thread.run(Thread.java:745)
On local computer (local tomcat) it works fine. On machine I have this error. I'm confused, because I don't have any ideas why it doesn't work.
It looks like your operating system has run out of file descriptors:
java.io.IOException: Too many open files
if you are running on linux have a look at the ulimit command

NPE caused by Modena.class.getResource("TestApp.css")

I'm trying to run the java-fx sample Modena that can be found here. I use Netbeans 8.0 Beta, JDK8 last release on Windows 8. I wonder why I can't even compile it.
In fact the first exception that happens is this.
I note to be a newbie in JavaFX.
The line of exception in the program is:
private static final String testAppCssUrl = Modena.class.getResource("TestApp.css").toExternalForm();
I assert that I verified and the file existed. And the example jar file can be run on my computer with my Java default configuration which is explained above.
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at com.sun.javafx.application.LauncherImpl$2.run(LauncherImpl.java:330) at com.sun.javafx.application.LauncherImpl$2.run(LauncherImpl.java:330)
at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:331) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:331)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:297)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:294)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
at modena.Modena.<clinit>(Modena.java:100)
... 13 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:362)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
... 5 more
The problem was with running only the main file with Shift+F6. I should have used F6 to run the project instead. F6 runs the project but Shift+F6 only runs the file containing the static main method without considering the project configuration.

Categories

Resources