Lucee 6 createObject() returns instance from another project

Hey everybody, I’m running into a strange problem on our first Lucee 6 instance. We’re running 2 projects there, “api-live” and “api-stage” which are basically the same project, but different git branches for production and user testing.

Inside we have

/api
  /v2
    /Application.cfc -> Handles all requests
    /index.cfm
/index.cfm -> Returns 404

If i use following line in my /api/v2/Application.cfc’s onRequestStart:
local.test = createObject('component', 'api.v2.path.to.component')

And dump local.test, getMetaData(local.test) or getComponentMetaData(local.test), all the paths, sources point to “E:\projects\api-live\api\v2\path\to\component.cfc” (live), even tho I’m dumping from “E:\projects\api-stage\api\v2\Application.cfc” (stage) and I cannot figure out why.

  • Unfortunately I cannot upgrade the Lucee Version yet due to permission
  • I saw in .CFConfig.json, that “mode” is set to “single”
  • Both Application.cfc have a unique this.name and this.applicationName
  • I tried adding an Application.cfc to the root of the project with a unique name too
  • I tried clearing component, application and function cache in the Lucee Admin
  • I tried using the new xyz() syntax

Don’t forget to tell us about your stack!

OS: Windows Server 2022 10.0.20348
Java Version: 16.0.2 (from /lucee/jre/release)
Tomcat Version: 9.0.62
Lucee Version: 6.1.0.243

does this show any clues?

We had the same problem. We ended up having to take Lucee out of single mode and that resolved the issue. Next week I will see if I can figure a way to duplicate it and share the results.

In my testing, I was able make things work by clearing the caches in the admin area in a specific order. It would then work for a bit until both sites applications were loaded.

I wasn’t able to find a pattern as to why, but some cfcs would load correctly, while other CFC/functions would load from the other site.

I know this wasn’t exactly helpful in figuring out what is going on, but wanted to share my experience.

I see there is a test suite for this. Single Mode Test Suite I will expand on that.

Hey everyone, sorry for the late reply.

@Zackster ComponentCacheList() also returns the absolute paths from the other project.

@randy-johnson I will have a look with our server admin.

Thanks for both of your inputs!
Greetings, Boris

I have created a ticket to track this problem

https://luceeserver.atlassian.net/browse/LDEV-5536

On the admin overview page, at the bottom, what does the web context listing look like? (single mode still has lightweight mini web contexts for each site, I know the screenshot is from multi mode, single mode still has them)

@Zackster We have 2 Projects and each has Stage and Live and then there’s the Lucee Admin.

So there are 5 entries under “Web Contexts”:

  1. https:/ /project-1-stage:0000
    C:\projects\project-1-stage-root
    C:\lucee\tomcat\lucee-server\context.CFConfig.json
  2. https:/ /project-1:0000
    C:\projects\project-1-live-root
    C:\lucee\tomcat\lucee-server\context.CFConfig.json
  3. https:/ /project-2-stage:0000
    C:\projects\project-2-stage-root
    C:\lucee\tomcat\lucee-server\context.CFConfig.json
  4. http:/ /localhost:0000
    C:\lucee\tomcat\webapps\root
    C:\lucee\tomcat\lucee-server\context.CFConfig.json
  5. https:/ /project-2:0000
    C:\projects\project-2-live-root
    C:\lucee\tomcat\lucee-server\context.CFConfig.json

Note: I added the space after https:/ / because otherwise it would treat them as links and I can only post 2, as I am a new user.

So far I can see:

  • The URLs and Webroots are all what they should be.
  • The websites run under different ports.
  • They all share the same Configuration File
  • All values in the column “Labels” are unique.

Edit: There is a backslash before .CFConfig.json, but the forums don’t display it.

For anyone with the same problem: Using a relative path to a CFC works correctly.

a = new my.component(); // wrong instance
b = createObject("component", "my.component"); // wrong instance
c = createObject("component", "/my/component.cfc"); // correct instance

Keep in mind, that when switching from the new keyword to createObject, your init-function is not automatically invoked.

1 Like

this is a super helpful insight!!!

using markdown style backticks single for inline, or 3 for code blocks works either single c:/lucee\whatever/CFconfig.json
or three

c:/lucee\whatever/CFconfig.json

I have just updated a server to 6.2.1.122 and are also seeing this problem. We have put server into multi mode to get around it, but am aware that multi mode will be disappearing with version 7.

I know that this does not help, but I just wanted to let people know that others are seeing this too.

OS : Debian 12
Java Version : 21.0.7 (Eclipse Adoptium) 64bit
Tomcat Version : 11.0.6
Lucee Version : 6.2.1.122

from what version are you upgrading from?

could you describe the cfcs which are conflicting

  • using createobject or new syntax?
  • are they loaded via a mapping or relative to the webroot

as soon as I can get repo, we can solve it

trying a few more variations

ahhh finally :slight_smile: bingo, happy dance!

Looks like you beat me to it! I used your single mode test suite to run more tests like you and got the same/similar result.

definitely getting somewhere, Lucee mappings are quite complex so we have been working on improving the test coverage before we make changes

Please try 6.2.2.11-SNAPSHOT or 7.0.0.226-SNAPSHOT, we have deployed a fix for this problem

And report back if it’s working or not working :sunglasses:

1 Like