You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Norbet Reilly <nr...@gmail.com> on 2006/02/22 06:38:23 UTC

Apparent ClassCastException with ADS RC1

This ClassCastException problem went away after Ersin Er's commit
378449, but seems to be back again after I updated today (although no
recent commits seem to touch the problem classes). Now when I run the
vanilla UberJarMain I get the following stacktrace:

org.apache.directory.server.core.interceptor.InterceptorException:
Unexpected exception. [Root exception is java.lang.ClassCastException]
	at org.apache.directory.server.core.interceptor.InterceptorChain.throwInterceptorException(InterceptorChain.java:1504)
	at org.apache.directory.server.core.interceptor.InterceptorChain.access$700(InterceptorChain.java:49)
	at org.apache.directory.server.core.interceptor.InterceptorChain$2.hasEntry(InterceptorChain.java:1328)
	at org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:131)
	at org.apache.directory.server.core.interceptor.InterceptorChain$2.hasEntry(InterceptorChain.java:1320)
	at org.apache.directory.server.core.authn.AuthenticationService.hasEntry(AuthenticationService.java:252)
	at org.apache.directory.server.core.interceptor.InterceptorChain$2.hasEntry(InterceptorChain.java:1320)
	at org.apache.directory.server.core.normalization.NormalizationService.hasEntry(NormalizationService.java:187)
	at org.apache.directory.server.core.interceptor.InterceptorChain.hasEntry(InterceptorChain.java:885)
	at org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy.hasEntry(DirectoryPartitionNexusProxy.java:535)
	at org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy.hasEntry(DirectoryPartitionNexusProxy.java:523)
	at org.apache.directory.server.core.jndi.ServerContext.<init>(ServerContext.java:127)
	at org.apache.directory.server.core.jndi.ServerDirContext.<init>(ServerDirContext.java:76)
	at org.apache.directory.server.core.jndi.ServerLdapContext.<init>(ServerLdapContext.java:61)
	at org.apache.directory.server.core.DefaultDirectoryService.getJndiContext(DefaultDirectoryService.java:167)
	at org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:121)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
	at javax.naming.InitialContext.init(InitialContext.java:219)
	at javax.naming.InitialContext.<init>(InitialContext.java:195)
	at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:80)
	at org.apache.directory.server.Service.init(Service.java:93)
	at org.apache.directory.server.UberjarMain.main(UberjarMain.java:54)
Caused by: java.lang.ClassCastException
	at org.apache.directory.shared.ldap.name.LdapDN.normalize(LdapDN.java:1222)
	at org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy.lookup(DirectoryPartitionNexusProxy.java:487)
	at org.apache.directory.server.core.authz.AuthorizationService.hasEntry(AuthorizationService.java:571)
	at org.apache.directory.server.core.interceptor.InterceptorChain$2.hasEntry(InterceptorChain.java:1320)
	... 20 more

and again it seems like ServerContext.java:127 is ultimately
responsible to passing in an LdapName dn which is eventually coerced
to an LdapDN by the NormalizationService.

I'm running JDK1.4 now and have a vague feeling I may have been
running JDK1.5 while everything was working, so it's possible the
problem relates to the choice of JDK. I'll try a clean build, and then
investigate the JDK possibility if the problem persists.

Re: Apparent ClassCastException with ADS RC1

Posted by Norbet Reilly <nr...@gmail.com>.
Ok, I completely blew off my Maven 2.0.2 repository and checked out a
brand new build of trunks (rev 381205) and found the following:

--------------------------------------------------------------------------------------
1. mvn clean and recompile using JDK1.4
	2. SAR build failed as below (releases must be being built with
JDK1.5 in 1.4 compatibility mode ?):
    <<<<<
[INFO] [compiler:compile]
Compiling 2 source files to D:\src\adt\apacheds\server-sar\target\classes
[INFO] -------------------------------------------------------------------------
---
[ERROR] BUILD FAILURE
[INFO] -------------------------------------------------------------------------
---
[INFO] Compilation failure

D:\src\adt\apacheds\server-sar\src\main\java\org\apache\directory\server\sar\DirectoryService.java:[47,24]
package javax.management does not exist

D:\src\adt\apacheds\server-sar\src\main\java\org\apache\directory\server\sar\Dir
ectoryService.java:[65,7] cannot access
javax.management.NotificationBroadcasterSupport
file javax\management\NotificationBroadcasterSupport.class not found
public class DirectoryService extends ServiceMBeanSupport implements
DirectoryServiceMBean, MBeanRegistration
   >>>>
	3. so I commented SAR build out from JDK1.4 profile in
apacheds/pom.xml and "mvn install" worked fine
	4. run failed because of missing xml-apis.jar (again implies release
was done using JDK1.5 in 1.4 compatibility mode as these classes are
built into 1.5), so added a .jar manually and added to apacheds.bat
that I am using to run)
	5. when run it, I traced the ClassCastException back to the patch I
made to GlobalRegistries.java, although I haven't pinned down exactly
how the changes I made are related to the observed behaviour as there
is no logical connection. Anyway, that's definitely my problem to sort
out.
--------------------------------------------------------------------------------------

*** My conclusions
  1. Seems like build/run with JDK1.4 is broken due to extra SAR and
xml-apis dependencies missing for JDK1.4 profile.
   2. Maybe the JDK 1.4 profile could use at least one integration
sanity test as part of the default build (like SSL test run under
JDK1.5) that actually fires up the server so the build breaks when a
runtime problem (like my mysterious ClassCastException) is present.

Re: Apparent ClassCastException with ADS RC1

Posted by Norbet Reilly <nr...@gmail.com>.
Thanks for checking.

I'm on the trunks. I did try a "svn switch" to the rc1 branch a few
days ago, but SVN got itself in a twist (parsing of internal .svn/
files failed) and I had to start a new dev dir and repatch everything
again with my local mods.

When I try to build with JDK1.5 I see the same error appear in the
attached unit test.

If you're not seeing the problem then I'm thinking it must be a stale
dependency in my maven repository or something, or possibly caused by
my local mods in some way. I'll investigate further tomorrow.

Re: Apparent ClassCastException with ADS RC1

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi Norbert,

Norbet Reilly a écrit :

>Even after a "mvn clean; mvn install; cd apacheds\server-main; mvn
>assembly:assembly" the problem persists (using JDK 1.4). Note the
>exception occurs immediately at start-up.
>
>I'll try rebuilding and running with JDK1.5 now...
>
>  
>
I just checked out the trunks yesturday, and buit it, it works like a 
champ for me...

I deleted the previous directory content just before.

Are you using another branch ? sandobox/akarasulu/rc1 ? In this case, 
you have to know that the server.xml is whacked in this branch.

Oh, btw, this branch has been merged back in trunks.

Hope it helps

Emmanuel

Re: Apparent ClassCastException with ADS RC1

Posted by Norbet Reilly <nr...@gmail.com>.
Even after a "mvn clean; mvn install; cd apacheds\server-main; mvn
assembly:assembly" the problem persists (using JDK 1.4). Note the
exception occurs immediately at start-up.

I'll try rebuilding and running with JDK1.5 now...