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

NoSuchNodeTypeException #320

Closed
StupidSmart opened this issue Feb 7, 2024 · 4 comments
Closed

NoSuchNodeTypeException #320

StupidSmart opened this issue Feb 7, 2024 · 4 comments

Comments

@StupidSmart
Copy link

Hey, I have 3 files which I use to start my sling12 server -

  1. sling12-kickstart.jar
  2. custom-feature.json
  3. custom-script
    Now, when I start the server everything works fine, but when I go to the bin browser to try and create a node with primary type -
    vlt:PackageDefinition
    It gives me -
    Error - 400 javax.jcr.nodetype.NoSuchNodeTypeException: Node type vlt:PackageDefinition does not exist
    But when I go to the packages section in the bin browser and come back to create a node with the same type it is successful.
    First of all I don't understand the behaviour of this and how do I fix this as I want that node type on startup?
    The composum node version in my feature.json is 4.2.3!
@stoerr
Copy link
Member

stoerr commented Feb 7, 2024

Hi!
Thanks for reporting! I couldn't reproduce that so far. A wild guess: is it possible that you somehow had a space in the node type field? Then such a 400 Error would happen, and it's not easily visible. I guess I'll throw a .trim() into the code to avoid such things. If you still have the log file, you could see that when looking carefully - that happens when I put a space before it or a space after it:

    javax.jcr.nodetype.NoSuchNodeTypeException: Node type  vlt:PackageDefinition does not exist
    javax.jcr.nodetype.NoSuchNodeTypeException: Node type vlt:PackageDefinition  does not exist

That'd be visible only in the logfile - the browser compresses whitespace.

@StupidSmart
Copy link
Author

Hi, is it possible for you to try and up a new sling instance and try to create a node anywhere in the bin browser of type vlt:PackageDefinition at path - http://localhost:7501/bin/browser.html ? According to me it shouldn't work unless you go to the path - http://localhost:7501/bin/packages.html and come back to http://localhost:7501/bin/browser.html to create the node, in this case it will work.

@ist-rw
Copy link
Member

ist-rw commented Feb 8, 2024

Hi, this issue cannot be solved in our Nodes solution. The VLT extension used in the package manager UI is declaring that node type in a dynamic way. Therefore this type is available after the first use of the VLT extension and not before.

@stoerr
Copy link
Member

stoerr commented Feb 8, 2024

Right. For the record, from the Sling Mailing list:

On Wed, Feb 7, 2024 at 11:08 AM Eric Norman enorman@apache.org wrote:

Hi Rahul,

Your description wasn't clear to me, but can we assume that the node type
you are using "vlt:PackageDefinition" is coming from
the jackrabbit-filevault bundle?

I'm not an expert on jackrabbit-filevault, but a quick search of their
codebase suggests that the filevault nodetypes are possibly lazy-loaded by
their JcrPackageRegistry#initNodeTypes method (see [1]). Maybe you can
attach a debugger to your runtime and set a breakpoint there to inspect the
code path where that is invoked to reveal why interacting with the
composium ui causes it to load the node type?

https://github.com/apache/jackrabbit-filevault/blob/1f79fa06367726f378cf956b40c3c26c46ca9f9b/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/JcrPackageRegistry.java#L168

Instantiating JcrPackageRegistry in the nodes console would be some kind of workaround, but is troublesome with the current module structure. Since this seems a rather rare case where a workaround (opening the Package Manager first) is available, I'll rather not do anything about this (except adding a .trim(), though that doesn't solve this.)
Sorry, but thanks for reporting, anyway.

@stoerr stoerr closed this as completed Feb 8, 2024
stoerr added a commit that referenced this issue Feb 8, 2024
… unintelligible errors when there is a space.
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

3 participants