Bug 1265877 - [GSS] (6.4.z) ClassNotFoundException due to ldap config for HornetQ
[GSS] (6.4.z) ClassNotFoundException due to ldap config for HornetQ
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Class Loading (Show other bugs)
6.4.0
Unspecified Unspecified
unspecified Severity unspecified
: CR1
: EAP 6.4.6
Assigned To: Ivo Studensky
: Reopened
Depends On:
Blocks: 1235746
  Show dependency treegraph
 
Reported: 2015-09-23 23:02 EDT by Hisanobu Okuda
Modified: 2017-01-17 06:43 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-01-17 06:43:58 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2181131 None None None 2016-02-29 02:37 EST

  None (edit)
Description Hisanobu Okuda 2015-09-23 23:02:37 EDT
When configuring hornetQ for authenticating against ldap,the following errors are seen:

13:42:25,418 TRACE [org.jboss.as.domain.management.security] (Old I/O server worker (parentId: -131658747, [id: 0xf8270c05, /127.0.0.1:5445])) Unable to verify identity.: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory com.sun.jndi.ldap.LdapCtxFactory from classloader ModuleClassLoader for Module "org.jboss.as.messaging:main" from local module loader @5703a7f (finder: local module finder @b106aa3 (roots: jboss-home\modules,jboss-home\modules\system\layers\base)) [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.jboss.as.messaging:main" from local module loader @5703a7f (finder: local module finder @b106aa3 (roots: jboss-home\modules,jboss-home\modules\system\layers\base))]]
	at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:126) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at org.jboss.as.naming.InitialContext.init(InitialContext.java:107) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:153) [rt.jar:1.7.0_72]
	at org.jboss.as.naming.InitialContext.<init>(InitialContext.java:98) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:44) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) [rt.jar:1.7.0_72]
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) [rt.jar:1.7.0_72]
	at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_72]
	at javax.naming.InitialContext.<init>(InitialContext.java:216) [rt.jar:1.7.0_72]
	at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:101) [rt.jar:1.7.0_72]
	at org.jboss.as.domain.management.connections.ldap.LdapConnectionManagerService.getConnection(LdapConnectionManagerService.java:262)
	at org.jboss.as.domain.management.connections.ldap.LdapConnectionManagerService.getConnection(LdapConnectionManagerService.java:179)
	at org.jboss.as.domain.management.connections.ldap.LdapConnectionManagerService.getConnection(LdapConnectionManagerService.java:175)
	at org.jboss.as.domain.management.security.LdapConnectionHandler.getConnection(LdapConnectionHandler.java:78)
	at org.jboss.as.domain.management.security.LdapUserSearcherFactory$LdapUserSearcherImpl.search(LdapUserSearcherFactory.java:119)
	at org.jboss.as.domain.management.security.LdapUserSearcherFactory$LdapUserSearcherImpl.search(LdapUserSearcherFactory.java:67)
	at org.jboss.as.domain.management.security.LdapCacheService$NoCacheCache.search(LdapCacheService.java:225)
	at org.jboss.as.domain.management.security.UserLdapCallbackHandler$LdapCallbackHandler.handle(UserLdapCallbackHandler.java:204)
	at org.jboss.as.domain.management.security.SecurityRealmService$1.handle(SecurityRealmService.java:177)
	at org.jboss.as.security.RealmDirectLoginModule.handle(RealmDirectLoginModule.java:175) [jboss-as-security-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at org.jboss.as.security.RealmDirectLoginModule.validatePassword(RealmDirectLoginModule.java:206) [jboss-as-security-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:283) [picketbox-4.1.1.Final-redhat-1.jar:4.1.1.Final-redhat-1]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_72]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_72]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_72]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext.invoke(LoginContext.java:762) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688) [rt.jar:1.7.0_72]
	at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687) [rt.jar:1.7.0_72]
	at javax.security.auth.login.LoginContext.login(LoginContext.java:595) [rt.jar:1.7.0_72]
	at org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:424) [picketbox-infinispan-4.1.1.Final-redhat-1.jar:4.1.1.Final-redhat-1]
	at org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:363) [picketbox-infinispan-4.1.1.Final-redhat-1.jar:4.1.1.Final-redhat-1]
	at org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:351) [picketbox-infinispan-4.1.1.Final-redhat-1.jar:4.1.1.Final-redhat-1]
	at org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:156) [picketbox-infinispan-4.1.1.Final-redhat-1.jar:4.1.1.Final-redhat-1]
	at org.jboss.as.messaging.HornetQSecurityManagerAS7.validateUser(HornetQSecurityManagerAS7.java:61) [jboss-as-messaging-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:131) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:980) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:150) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:78) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:641) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:557) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:533) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:587) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:72) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:71) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_72]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_72]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_72]
Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.jboss.as.messaging:main" from local module loader @5703a7f (finder: local module finder @b106aa3 (roots: jboss-home\modules,jboss-home\modules\system\layers\base))]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_72]
	at java.lang.Class.forName(Class.java:274) [rt.jar:1.7.0_72]
	at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:121) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	... 66 more	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:281) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-client-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
	at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:71) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_72]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_72]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_72]
Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.jboss.as.messaging:main" from local module loader @5703a7f (finder: local module finder @b106aa3 (roots: jboss-home\modules,jboss-home\modules\system\layers\base))]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
	at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_72]
	at java.lang.Class.forName(Class.java:274) [rt.jar:1.7.0_72]
	at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:121) [jboss-as-naming-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
	... 66 more


Steps to reproduce:

1. configure ApplicationRealm with <ldap/> like:-

            <security-realm name="ApplicationRealm">
                <authentication>
                    <ldap connection="ldapconnection" base-dn="o=xxx" recursive="true">
                        <username-filter attribute="cn"/>
                    </ldap>
                </authentication>
                <authorization>
                    <ldap connection="ldapconnection">
                        <username-to-dn force="true">
                            <username-filter base-dn="o=#####" recursive="true" user-dn-attribute="dn" attribute="uid"/>
                        </username-to-dn>
                        <group-search group-name="SIMPLE" iterative="false" group-dn-attribute="dn" group-name-attribute="cn">
                            <group-to-principal search-by="DISTINGUISHED_NAME" base-dn="ou=########" recursive="true">
                                <membership-filter principal-attribute="member"/>
                            </group-to-principal>
                        </group-search>
                    </ldap>
                </authorization>
            </security-realm>

2. restart EAP

3. access hornetq then you will get the error
Comment 1 Hisanobu Okuda 2015-09-23 23:05:18 EDT
Adding <module name="sun.jdk"/> to the module.xml resolves the issue.
Comment 2 Clebert Suconic 2015-09-23 23:35:15 EDT
Next time you open a bug, please look at where it's failing...


On this case your failure is way bellow hornetq... so it would be either a failure on security or a configuration issue, what it turned out to be the case.
Comment 3 Hisanobu Okuda 2015-09-23 23:53:13 EDT
Clebert, thank you for the suggestion. However, it is an issue on class loading of HornetQ module in EAP6. Therefore, I added "HornetQ" and "Class Loader" to the "Component". It should be fixed same as https://issues.jboss.org/browse/WFLY-3205.
Comment 5 Miroslav Novak 2016-01-20 05:28:51 EST
Issue was reproduced on EAP 6.4.5.CP. If traces are enabled then in log there is: 
11:23:25,304 TRACE [org.jboss.as.domain.management.security] (Old I/O server worker (parentId: 2050620633, [id: 0x7a39fcd9, /127.0.0.1:5445])) Unable to verify identity.: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory com.sun.jndi.ldap.LdapCtxFactory from classloader ModuleClassLoader for Module "org.jboss.as.messaging:main" from local module loader @16f65612 (finder: local module finder @311d617d (roots: /home/mnovak/tmp/jboss-eap-6.4/modules,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base/.overlays/layer-base-jboss-eap-6.4.5.CP,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base)) [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.jboss.as.messaging:main" from local module loader @16f65612 (finder: local module finder @311d617d (roots: /home/mnovak/tmp/jboss-eap-6.4/modules,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base/.overlays/layer-base-jboss-eap-6.4.5.CP,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base))]]
....
Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory from [Module "org.jboss.as.messaging:main" from local module loader @16f65612 (finder: local module finder @311d617d (roots: /home/mnovak/tmp/jboss-eap-6.4/modules,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base/.overlays/layer-base-jboss-eap-6.4.5.CP,/home/mnovak/tmp/jboss-eap-6.4/modules/system/layers/base))]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.7.Final-redhat-1]

On EAP 6.4.6.CP.CR2 there is no ClassNotFoundException any more and client connecting to HornetQ authenticated successfully.

Setting as verified.
Comment 10 Petr Penicka 2017-01-17 06:43:58 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Note You need to log in before you can comment on or make changes to this bug.