Skip to content

LDAP API Error "does not contain a URL" java.naming.provider.url property does not contain a URL #8336

Closed

Description

@tamoorahmedntu
ISSUE TYPE
  • Bug Report
COMPONENT NAME
Management server, API
CLOUDSTACK VERSION
18.01
CONFIGURATION

Advanced networking, LDAP integration

OS / ENVIRONMENT

Ubuntu 22

SUMMARY

running code under API get error message

searchLdap query="username"
STEPS TO REPRODUCE
  • Add LDAP information

  • Global Settings > Access > LDAP ( Using Microsoft AD )

  • Global Settings > LDAP configuration

  • Run command for API

searchLdap query="username"
EXPECTED RESULTS

return search query information

ACTUAL RESULTS
2023-12-08 16:26:19,911 DEBUG [o.a.c.a.StaticRoleBasedAPIAccessChecker] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) RoleService is enabled. We will use it instead of StaticRoleBasedAPIAccessChecker.
2023-12-08 16:26:19,912 DEBUG [o.a.c.r.ApiRateLimitServiceImpl] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) API rate limiting is disabled. We will not use ApiRateLimitService.
2023-12-08 16:26:19,919 DEBUG [o.a.c.l.LdapContextFactory] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) initializing ldap with provider url: 
2023-12-08 16:26:19,919 DEBUG [o.a.c.l.LdapManagerImpl] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) ldap Exception: 
javax.naming.ConfigurationException: java.naming.provider.url property does not contain a URL
        at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:110)
        at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
        at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
        at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
        at java.naming/javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
        at org.apache.cloudstack.ldap.LdapContextFactory.createInitialDirContext(LdapContextFactory.java:62)
        at org.apache.cloudstack.ldap.LdapContextFactory.createBindContext(LdapContextFactory.java:51)
        at org.apache.cloudstack.ldap.LdapContextFactory.createBindContext(LdapContextFactory.java:45)
        at org.apache.cloudstack.ldap.LdapManagerImpl.searchUsers(LdapManagerImpl.java:359)
        at org.apache.cloudstack.api.command.LdapUserSearchCmd.execute(LdapUserSearchCmd.java:76)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163)
        at com.cloud.api.ApiServer.queueCommand(ApiServer.java:782)
        at com.cloud.api.ApiServer.handleRequest(ApiServer.java:603)
        at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:347)
        at com.cloud.api.ApiServlet$1.run(ApiServlet.java:154)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
        at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:151)
        at com.cloud.api.ApiServlet.doGet(ApiServlet.java:105)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
        at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:516)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
        at java.base/java.lang.Thread.run(Thread.java:829)
2023-12-08 16:26:19,919 DEBUG [o.a.c.a.c.LdapUserSearchCmd] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) No users matching: username
2023-12-08 16:26:19,921 DEBUG [c.c.a.ApiServlet] (qtp989447607-19:ctx-4b97cae5 ctx-1bbaaae5) (logid:36242760) ===END===  152.71.155.35 -- GET  command=searchLdap&query=username&response=json&sessionkey=fFIHT3UmAgiUVAxks-t25wAvJlE
2023-12-08 16:26:21,467 DEBUG [c.c.a.m.AgentManagerImpl] (AgentManager-Handler-3:null) (logid:) SeqA 21-89: Processing Seq 21-89:  { Cmd , MgmtId: -1, via: 21, Ver: v1, Flags: 11, [{"com.cloud.agent.api.ConsoleProxyLoadReportCommand":{"_proxyVmId":"158","_loadInfo":"{

Activity

  1. DaanHoogland commented on Dec 28, 2023

    @DaanHoogland
    Contributor

    @tamoorahmedntu this is the exception you get when you have no ldap configured. It looks like you have an ommision in your ldap configured in cloudstack. Please check the values for

    "ldap.basedn"
    "ldap.bind.principal"
    "ldap.group.object"
    "ldap.nested.groups.enable"
    "ldap.provider"
    "ldap.read.timeout"
    "ldap.request.page.size"
    "ldap.search.group.principle"
    "ldap.user.object"
    "user.authenticators.order"
    

    and list your ldap configurations?

  2. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author
  3. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author

    Capture
    ee

  4. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    @tamoorahmedntu the ldap configuration you have configured is domain specific. If you add a configuration without domain, the search command should work.

    NOTE the searchLdap API is only meant for manual import not for autoimport or autosync configurations.

  5. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author

    @tamoorahmedntu the ldap configuration you have configured is domain specific. If you add a configuration without domain, the search command should work.

    NOTE the searchLdap API is only meant for manual import not for autoimport or autosync configurations.

    I'm really sorry but are you talking about the top pic or bottom ?

  6. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    text would be easier ;)
    I am talking about the picture describing the ldap configurations , the top one.

  7. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    that said, I will have to trust the basedn and bind principal as I cannot read those in the bottom picture. The error indicates nothing about that however.
    The global settings are global and only used as defaults for a domain as configured in the ldapconfiguration.

  8. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author

    Unfortunately that still does not work maybe I'm doing something wrong.
    Configuration > LDAP configuration

    host = my server name port = my port Domain = left alone

    Is this correct?

  9. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    yes that is correct. Does it give the same error?

  10. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author

    yes that is correct. Does it give the same error?

    yes
    2024-01-03 09:49:39,411 DEBUG [o.a.c.l.LdapManagerImpl] (qtp989447607-19:ctx-541c510b ctx-e0ab4db8) (logid:a0cf2671) ldap Exception: javax.naming.ConfigurationException: java.naming.provider.url property does not contain a URL at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:110) at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730) at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305) at java.naming/javax.naming.InitialContext.init(InitialContext.java:236) at java.naming/javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154) at org.apache.cloudstack.ldap.LdapContextFactory.createInitialDirContext(LdapContextFactory.java:62) at org.apache.cloudstack.ldap.LdapContextFactory.createBindContext(LdapContextFactory.java:51) at org.apache.cloudstack.ldap.LdapContextFactory.createBindContext(LdapContextFactory.java:45) at org.apache.cloudstack.ldap.LdapManagerImpl.searchUsers(LdapManagerImpl.java:359) at org.apache.cloudstack.api.command.LdapUserSearchCmd.execute(LdapUserSearchCmd.java:76) at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163) at com.cloud.api.ApiServer.queueCommand(ApiServer.java:782) at com.cloud.api.ApiServer.handleRequest(ApiServer.java:603) at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:347) at com.cloud.api.ApiServlet$1.run(ApiServlet.java:154) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52) at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:151) at com.cloud.api.ApiServlet.doGet(ApiServlet.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:645) at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) at java.base/java.lang.Thread.run(Thread.java:829) 2024-01-03 09:49:39,412 DEBUG [o.a.c.a.c.LdapUserSearchCmd] (qtp989447607-19:ctx-541c510b ctx-e0ab4db8) (logid:a0cf2671) No users matching: username

  11. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    ok that will require some debugging than. No idea what else could be wrong.

  12. DaanHoogland commented on Jan 3, 2024

    @DaanHoogland
    Contributor

    can you import users?

  13. tamoorahmedntu commented on Jan 3, 2024

    @tamoorahmedntu
    Author

    can you import users?

    to make sure I do it properly, could you confirm how to do this
    i would use importLdapUsers

  14. 13 remaining items

  15. DaanHoogland commented on Jun 13, 2024

    @DaanHoogland
    Contributor

    @tamoorahmedntu , I tried to reproduce using https://www.forumsys.com/2022/05/10/online-ldap-test-server/ as the ldapserver. my configuration seems to work:

    image

    my ldap configuration:

    image

    and connection:

    image

    The only thing I can think of next is that you don't use a standard port (3268) and cloudstack cannt handle that. Can you test with ports 389 and 636 to see if those work, please?

  16. DaanHoogland commented on Jun 21, 2024

    @DaanHoogland
    Contributor

    @tamoorahmedntu do you have any progress / furhter information?

  17. tamoorahmedntu commented on Jun 21, 2024

    @tamoorahmedntu
    Author
  18. DaanHoogland commented on Jun 21, 2024

    @DaanHoogland
    Contributor

    @tamoorahmedntu you could run a test server against your LDAP and against https://www.forumsys.com/2022/05/10/online-ldap-test-server/ and see if there is a difference in results?

  19. locked and limited conversation to collaborators on Nov 8, 2024
  20. converted this issue into a discussion #9914 on Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions