Getting unknown exception with Spring framework


#1

org.springframework.data.couchbase.core.CouchbaseQueryExecutionException: Unable to execute query due to the following n1ql errors:
at org.springframework.data.couchbase.core.CouchbaseTemplate.findByN1QL(CouchbaseTemplate.java:453) ~[spring-data-couchbase-2.2.12.RELEASE.jar!/:?]
at org.springframework.data.couchbase.repository.query.AbstractN1qlBasedQuery.executeCollection(AbstractN1qlBasedQuery.java:155) ~[spring-data-couchbase-2.2.12.RELEASE.jar!/:?]
at org.springframework.data.couchbase.repository.query.AbstractN1qlBasedQuery.executeDependingOnType(AbstractN1qlBasedQuery.java:130) ~[spring-data-couchbase-2.2.12.RELEASE.jar!/:?]
at org.springframework.data.couchbase.repository.query.AbstractN1qlBasedQuery.execute(AbstractN1qlBasedQuery.java:105) ~[spring-data-couchbase-2.2.12.RELEASE.jar!/:?]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:494) ~[spring-data-commons-1.13.12.RELEASE.jar!/:?]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477) ~[spring-data-commons-1.13.12.RELEASE.jar!/:?]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56) ~[spring-data-commons-1.13.12.RELEASE.jar!/:?]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.data.couchbase.repository.support.ViewPostProcessor$ViewInterceptor.invoke(ViewPostProcessor.java:87) ~[spring-data-couchbase-2.2.12.RELEASE.jar!/:?]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.12.RELEASE.jar!/:?]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.sun.proxy.$Proxy95.findByNotifTime(Unknown Source) ~[?:?]


#2

When we run N1QL query directly using CBQ or Web console it executes successfully. When run from webapplication it fails randomly.


#3

Is it possible to get the exact couchbase server side exception or there any other ways to troubleshoot and find out what is going on here causing random failure?


#4

What version of Couchbase Server are you using?

I’d probably recommend turning up the log level so you can see the conversation between the client and server. There are also some statistics available from the query service via CLI and REST. Also @subhashni may have some more ideas.


#5

Couchbase server version pasted from the console : Enterprise Edition 5.5.1 build 3511 ‧ IPv4
Can you give some pointers as to where the logging param can be changed. It looks like the static_config file is already set to debug for several of the components.

cat /opt/couchbase/etc/couchbase/static_config
{error_logger_mf_dir, “/opt/couchbase/var/lib/couchbase/logs”}.
{path_config_bindir, “/opt/couchbase/bin”}.
{path_config_etcdir, “/opt/couchbase/etc/couchbase”}.
{path_config_libdir, “/opt/couchbase/lib”}.
{path_config_datadir, “/opt/couchbase/var/lib/couchbase”}.
{path_config_tmpdir, “/opt/couchbase/var/lib/couchbase/tmp”}.
{path_config_secdir, “/opt/couchbase/etc/security”}.

{nodefile, “/opt/couchbase/var/lib/couchbase/couchbase-server.node”}.

{loglevel_default, debug}.
{loglevel_couchdb, info}.
{loglevel_ns_server, debug}.
{loglevel_error_logger, debug}.
{loglevel_user, debug}.
{loglevel_menelaus, debug}.
{loglevel_ns_doctor, debug}.
{loglevel_stats, debug}.
{loglevel_rebalance, debug}.
{loglevel_cluster, debug}.
{loglevel_views, debug}.
{loglevel_mapreduce_errors, debug}.
{loglevel_xdcr, debug}.
{loglevel_access, info}.

{disk_sink_opts,
[{rotation, [{compress, true},
{size, 41943040},
{num_files, 10},
{buffer_size_max, 52428800}]}]}.

{disk_sink_opts_json_rpc,
[{rotation, [{compress, true},
{size, 41943040},
{num_files, 2},
{buffer_size_max, 52428800}]}]}.

{net_kernel_verbosity, 10}.
{ipv6, false}.


#6

Which version of the couchbase-java-client are you using?

The debug level logging for spring query class can be enabled by
<logger name=“org.springframework.data.couchbase.repository.query” level=“debug”/>

to see the N1ql queries that are being generated by SDC and for more finer tracing logs which contain the request and responses use
<logger name="com.couchbase.client.core" level="trace">
in a logback.xml configuration


#7

We are using spring-data-couchbase-2.2.12.RELEASE.jar, that is internally using java-client-2.2.8.jar. I believe that it means client version is 2.2.8.


#8

Spring data couchbase wraps the spring programming model over the java-client, it would have pulled in the default client that ships with Ingalls 2.2.8 where you can manually override to the latest version 2.7.2 (and also pull in the java-couchbase-encryption dependency as Spring inspects the classes making it a required) or you can upgrade to the latest lovelace release (3.1.x).


#9

Understood, thanks. Changing the version is a heavy lift on our part as lot of the dev activities are in advanced stage. So if we could figure out what’s happening and take appropriate action based on that it will be ideal. We are going to try the two logger statements you provided and see what it logs.