Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build 132 not allowing MongoDb to be used as a cache provider #35

Open
stewartmcguire opened this issue Aug 25, 2022 · 12 comments
Open

Comments

@stewartmcguire
Copy link
Contributor

stewartmcguire commented Aug 25, 2022

When I install build 3.12.8.132 the MongoDb cache provider is not available in the "Type" dropdown under "Create a new cache connection". If I downgrade to 3.12.8.131 I then get "MongoDB (Beta)" in the Type dropdown as shown below. This is using Lucee 5.3.9.141.

image

@sjdaniels
Copy link
Contributor

sjdaniels commented Aug 29, 2022 via email

@sjdaniels
Copy link
Contributor

sjdaniels commented Aug 30, 2022 via email

@stewartmcguire
Copy link
Contributor Author

stewartmcguire commented Aug 30, 2022 via email

@sjdaniels
Copy link
Contributor

sjdaniels commented Aug 30, 2022 via email

@stewartmcguire
Copy link
Contributor Author

stewartmcguire commented Aug 30, 2022 via email

@sjdaniels
Copy link
Contributor

sjdaniels commented Aug 30, 2022 via email

@stewartmcguire
Copy link
Contributor Author

stewartmcguire commented Jan 20, 2023 via email

@sjdaniels
Copy link
Contributor

sjdaniels commented Jan 24, 2023

Hey Stewart. Are you able to try to define the cache connection programmatically in Application.cfc instead of in the Lucee admin? I'm curious if that would work or if you'd get an exception. You can do this like so:

this.cache.connections["mongocache"] = getMongoCache();

private struct function getMongoCache() {
	if (!application.keyExists("MongoCacheConfig")) {
		var result =  {
				class: 'org.lucee.mongodb.cache.MongoDBCache'
			, storage: false
			, custom: {"uri":"mongodb://localhost","collection":"cache_documents","database":"mongo_cache","persist":true}
			, default: "template"
		}
		
		application["MongoCacheConfig"] = result;
	}

	return application["MongoCacheConfig"];
}

(Just modify your uri accordingly)

@sjdaniels
Copy link
Contributor

@michaeloffner any idea why the cache stopped appearing as an option in the Lucee admin?

@stewartmcguire
Copy link
Contributor Author

Hey Stewart. Are you able to try to define the cache connection programmatically in Application.cfc instead of in the Lucee admin? I'm curious if that would work or if you'd get an exception. You can do this like so:

this.cache.connections["mongocache"] = getMongoCache();

private struct function getMongoCache() {
	if (!application.keyExists("MongoCacheConfig")) {
		var result =  {
				class: 'org.lucee.mongodb.cache.MongoDBCache'
			, storage: false
			, custom: {"uri":"mongodb://localhost","collection":"cache_documents","database":"mongo_cache","persist":true}
			, default: "template"
		}
		
		application["MongoCacheConfig"] = result;
	}

	return application["MongoCacheConfig"];
}

(Just modify your uri accordingly)

I didn't know you could do that. I will try adding that configuration to my application.cfc and see what happens.
--Stewart

@stewartmcguire
Copy link
Contributor Author

Hey Stewart. Are you able to try to define the cache connection programmatically in Application.cfc instead of in the Lucee admin? I'm curious if that would work or if you'd get an exception. You can do this like so:

I am able to define the cache in the application.cfc but it also failed with the same error. I have done some troubleshooting and got the following results:

  • My colleague created a lucee instance on an Azure static web site that the mongodb extension (your build 144) works perfectly on, no errors.
  • I compared his instance with my local instance and I found that his instance had a mongodb driver jar file that mine didn't have (org-mongodb-mongo-java-driver-3-12-8.jar). Mine only had org.mongodb.bson-3.12.8.jar, org.mongodb.driver-3.12.8.jar, and org.mongodb.driver-core-3.12.8.jar. I did a beyond compare of those jar files and found that the one he has is an exact combination of the 3 that I have (and are included in the mongodb extension lex file). Note that he also had the same 3 jar files I had as well.
  • I copied that missing jar file into my local instance and restarted the instance and lo and behold, it works now! I am not sure why Lucee could find the classes in that one jar file when it couldn't find them in the split up 3 jar files.

Any idea where that other jar file might have come from? I scoured the maven repo for mongodb jar files and couldn't find it there.

--Stewart

@stewartmcguire
Copy link
Contributor Author

Follow up on the missing jar file ... I was able to find the jar file but the big mystery is that the jar file has a slightly different name ([mongo-java-driver-3.12.8.jar](mongo-java-driver-3.12.8.jar vs. org-mongodb-mongo-java-driver-3-12-8.jar). Also, the jar files in the lex file are not named the same as the jar files in the gitHub repo for this extension. They all have "org." as a prefix on them that doesn't exist in the repo. Is the build process renaming the jar files based on the Bundle-SymbolicName in the MANIFEST.MF file inside the jar file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants