Couchbase providers for Coldbox

I wanted to have a play around with this today and well sort of at a loss to explain why this doesn’t work.

  1. grab from github the zip file
  2. Copy provider into model directory.
  3. Copy mapping from application.cfc
  4. Copy properties and provider class to cachebox .cfc for ColdBox
  5. Restart ColdFusion

Sort of got multiple problems here.

First when browsing I get all these null pointer ORM exceptions, until I remove the mapping from step 3, which then throws an error can’t find

couchbaseApp.model.contentbox.content.basecontent

So remove the step 4 modification and reset ColdFusion and the application runs fine. So I then do the following

  1. Manually type the mapping for couchbaseApp and re-add the properties in step 4.

Again all these null pointer errors. Eventually with some fiddling and retyping I was able to then get an error that it can’t connect to couchbase, something along the lines of can’t use an interface which is the usual message that appears when there are dependency missing from the jar loading.

I haven’t tried dropping the jars into the classlib of ColdFusion as Brad showed in a connect session a month ago.

I was hoping that this method would work, but alas it has no signs of working like this. Even adding the jarPath has no effect and the jars must be added to ColdFusion.

Anyone else experience this?

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/113032480415921517411

Andrew, are you trying to use Couchbase as a secondary ORM cache or with CacheBox?

Are you following one of the blog posts in our Couchbase series? http://www.ortussolutions.com/blog/category/couchbase
I don’t think either one of those use ColdFusion mappings, so I’m a little unsure of what you’re doing.

Also, I assume you have Couchbase installed and running? Is this Adobe CF or Railo? Please paste in the full stack trace, and look in your servlet container’s "out’ log file for additional logging. Railo specifically has a bug that loses exception causes so they don’t show up in the exception thrown to the screen.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

As instructed I downloaded the project from github, in the application.cfc it has a mapping that is used for the cachebox provider classes. So your blog posts may not, but the code actually does.

Yes, from within Cachebox.

Ahh, are you talking about this mapping?

this.mappings[ “/couchbaseApp”] = COLDBOX_APP_ROOT_PATH;

That’s just some code I put in the sample app so it would work in a subfolder without any logic in the CacheBox config to determine the app mapping. It’s in no way required. By the way, here are the docs if you haven’t seen them:
http://wiki.coldbox.org/wiki/CacheBox-Couchbase.cfm

So basically, if you create a mapping or not is up to you. The important bit is that the provider path that you specify in the CacheBox config resolves to wherever you’ve put the CFCs.

So I’ve no clue about the null pointer exceptions you were getting. I’ve never seen that before so it might be completely unrelated. You would need to provide a full stack trace to determine anything further about those. You didn’t touch any ORM settings did you? Using Couchbase as your ORM secondary cache is a completely different beast than setting up the CacheBox provider.

By default, the CacheBox provider assumes that the jars are in a relative path to the CFC as long as you’ve kept the folder structure together. Can you provide this "interface’ error that you’re seeing with a full stack trace? Placing the jars in the lib folder should not be necessary. When you saw me do that in the Connect session, that was to use Couchbase as the Hibernate 2nd level cache.

Also, again-- is this CF or Railo? Have you installed anything else on this server (such as a trial of our Ortus Railo Couchbase Extension) that might have dropped a different version of the jars in the classpath somewhere?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad, I know it is not required and I added it rather than type a long path to the component in the cacheBox config.

But I think you’re missing the issue.

  1. When copying that one line to Application.cfc I get a null exception, if I manually type the line into CFBuilder then I get an error saying it can’t find a ContentBox domain model. Which happens to begin with couchbaseApp instead of contentbox when trying to load the domain model and its services…

  2. if I remove the mapping and put the full path into the cacheBox config, it at least runs to the point that it tries to connect to couchbase, but I get an error about not able to instantiate an interface.

Now I know you skipped over this, because all the answers to your questions where clearly stated.

Now my question is if I leave the jars in the model folder it is in and use couchbase providers load the jars, it won’t work as it I stated that error is usually when you are not including a required jar in the class path in ColdFusion.

But more importantly, how the hell is ContentBox appending the couchabase mapping to all the contentbox mappings?

Ok does anyone have any idea why I can’t get this couchbase provider installed on ColdFusion 10 ? Brad you make it look so easy… But there must be something missing.

All I am getting is

Everything always works on my machine :slight_smile:

The error is "Object instantiation exception. An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: "

In reality, that’s not the real error at all. The bit about the interface or abstract class is a complete guess. We need the FULL stack trace of the error. At the bottom will be a “caused by” but with the actual reason.

Double check that your jar path is correct and has all the jar in it. Also, check for any other copies of the couchbase or memcache jars on your server (this includes a trial of the Railo Extension that could be installed).

Also, have you set a password in your config? I don’t see one in the error message, but you may have just removed it prior to posting.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad, as I stated very clearly the only time I have ever seen this message, with JavaLoader is that a dependency library is missing.

That’s great Andrew. Provide the full stack trace or I can’t help you though. That is a generic Java error and can mean anything.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

coldfusion.runtime.CustomException: There was an error connecting to the Couchbase server. Config: {“BUCKET”:“default”,“OPTIMEOUT”:5000,“OBJECTDEFAULTTIMEOUT”:15,“SERVERS”:[“http://127.0.0.1:8091/pools”],“OPQUEUEMAXBLOCKTIME”:5000,“TIMEOUTEXCEPTIONTHRESHOLD”:5000,“USERNAME”:"",“IGNORECOUCHBASETIMEOUTS”:true,“PASSWORD”:"",“JARPATH”:“D:\Projects\ColdFusion\ContentBox\model\providers\Couchbase\jars/”}
at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
at cfCouchbaseProvider2ecfc81393320$funcCONFIGURE.runFunction(D:\Projects\ColdFusion\ContentBox\model\providers\Couchbase\CouchbaseProvider.cfc:251)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfCacheFactory2ecfc872477428$funcREGISTERCACHE.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\cache\CacheFactory.cfc:643)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659)
at cfCacheFactory2ecfc872477428$funcCREATECACHE.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\cache\CacheFactory.cfc:599)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:518)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2624)
at cfCacheFactory2ecfc872477428$funcCONFIGURE.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\cache\CacheFactory.cfc:165)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659)
at cfCacheFactory2ecfc872477428$funcINIT.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\cache\CacheFactory.cfc:97)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfLoaderService2ecfc1941503082$funcCREATECACHEBOX.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\web\services\LoaderService.cfc:210)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659)
at cfLoaderService2ecfc1941503082$funcLOADAPPLICATION.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\web\services\LoaderService.cfc:74)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfColdbox2ecfc232480061$funcLOADCOLDBOX.runFunction(D:\Projects\ColdFusion\ContentBox\coldbox\system\Coldbox.cfc:71)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfApplication2ecfc624837150$funcONAPPLICATIONSTART.runFunction(D:\Projects\ColdFusion\ContentBox\Application.cfc:78)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108)
at coldfusion.runtime.AppEventInvoker.onApplicationStart(AppEventInvoker.java:231)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:309)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:112)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:204)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Sorry, I should have been more specific. That stack trace is just for the throw() which isn’t going to have the original Java exception. The two lines before that are:

e.printStackTrace();
logger.error(“There was an error connecting to the Couchbase server.”, e);

That should print the original Java error out to your CF logs, and also log to LogBox (which I think includes the stack trace).

Please try find the original error in your ColdBox/Java/Servlet container logs as it will contain the “caused by” part with the original Java error.

Alternatively, you could temporarily remove the try/catch/throw in the code to let the original error bubble up.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

This is the error, and is in the stack trace.

at cfCouchbaseProvider2ecfc81393320$funcCONFIGURE.runFunction(D:\Projects\ColdFusion\ContentBox\model\providers\Couchbase\CouchbaseProvider.cfc:251)

If you bothered to look at the above line you will see there is just one line of code inside a try / catch block, it doesn’t take an Einstein to work out that what I have clearly stated every single time is correct.

Just so I don’t sound like a smart arse, why do you not comment that one line out and try to run it? If you did you will notice that it doesn’t error.

The code is

try{
// Instantiate the client with out connection factory. This is in a separate try catch to help differentiate between
// Java classpath issues versus Couchbase connection issues.
/setCouchbaseClient( CouchbaseClientClass.init( CouchbaseConnectionFactory ) );/
}
catch(any e) {
e.printStackTrace();
instance.logger.error(“There was an error connecting to the Couchbase server. Config: #serializeJSON(config)#: #e.message# #e.detail#”, e );
throw(message=‘There was an error connecting to the Couchbase server. Config: #serializeJSON(config)#’, detail=e.message & " " & e.detail);
}

And you can see that I have commented the offending code out, you will also notice that if you run the code like this it will not throw an error.

And I will make this very clear one more time, the fact that when you try to instantiate a java object with this error message, clearly is a missing dependency.

Sorry Brad, if you have been dealing with JavaLoader and this error message, you will know what this error means. It is all over Google if you Google

coldfusion The class must not be an interface or an abstract class

You will see all the people who have had this issue for the last 7 years or more, the answer is always the same. You are missing other required libraries for it to run.

Yes, if you remove the only line of code in the “try” block it will not error. What else did you expect? I have read all your replies and I am also very familiar with the code on line 251, I wrote it myself. No one is arguing with you about the line of code that is producing the error.

The actual Java class is being created on line 235 though. I’m not instantiating it until line 246 and as the comments state, that’s so I can try to differentiate between class loader issues and configuration errors. Errors from the Couchbase Java SDK can be a bit confusing. For instance, if I supply an incorrect password, I simply get a null pointer exception. Unfortunately, I have no control over the Java error handling.

Please remove the try/catch entirely and let the underlying error be thrown without being caught and provide the full stack trace here.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Brad,

I am not going to go back and forth on this with you, if you read how ColdFusion provides wrappers then you will know that line 246 is the actual error and is also the error that I commented out. I am done trying to explain this to you and I don’t have the patience to go back and forth with this error.

Whether the try catch is there or not, we both agree that the code on line 246 is causing the error, but you know this because you clearly stated that you don’t instatiate the object till line 246, line 246 is the line that I commented out. And is the line that is causing the issue.

I have done my job, reported it and told you what the issue is. I am done trying to explain to you how and why that error occurs.

And if I knew what other Jars that are needed to be added to the jars folder to get this to run, I would do that. But I don’t have the time to research what libraries are needed to be added to that folder.

Why do you refuse to follow such simple instructions Andrew? The line of code is irrelevant and I don’t even know why you keep going on about it. I can’t do a single thing to help you without the ORIGINAL FULL STACK TRACE. If you won’t provide me with that, I can do nothing to help you. Just remove the try/catch and report back the error. I’ve never said you are wrong, just that I need more information.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

And people wonder what sets me off so f’ing easily when I have to deal with attitudes like this Brad.

The stack trace is the same, the error message is the same. It doesn’t excuse the fact that there is another external library needed to the jars that you have provided.

I have seen this error message enough to know what it means.

But because you are damn stubborn on this here is the new stack trace.

AND NOW TELL ME HOW THIS IS ANY DIFFERENT TO WHAT I ALREADY POSTED…

Oh and if you want to use the original error in ColdFusion, may I suggest you use rethrow and not throw!!!

That’s not the full trace. The full trace shows the actual Java methods, not just the cfm/cfc templates.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I am done…