posts - 40,  comments - 187,  trackbacks - 0

          這幾天在研究Spring-LDAP,準備應用在項目中。試著調試官網上的一個例子:spring-ldap-person,結果總是在啟動服務器時報錯。

          PS:官方的例子我是通過Subversion得到了,地址是https://svn.sourceforge.net/svnroot/springframework/spring-ldap/trunk/spring-ldap-person/

          開發環境:Window XP?+?eclipse3.2 + tomcat 5.0.30 + ApacheDS 1.0.0
          系統架構:Spring + Spring Webflow + Spring-LDAP
          錯誤跟蹤:
          2007-06-21 10:10:47,218 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'serverContext' defined in ServletContext resource [/WEB-INF/apacheDsContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [javax.naming.InitialContext]: Constructor threw exception; nested exception is org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          Caused by:
          org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [javax.naming.InitialContext]: Constructor threw exception; nested exception is org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          Caused by:
          org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.init(InterceptorChain.java:274)
          at org.apache.directory.server.core.DefaultDirectoryS ervice.initialize(DefaultDirectoryService.java:822 )
          at org.apache.directory.server.core.DefaultDirectoryS ervice.startup(DefaultDirectoryService.java:229)
          at org.apache.directory.server.core.jndi.AbstractCont extFactory.getInitialContext(AbstractContextFactor y.java:117)
          at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:667)
          at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:247)
          at javax.naming.InitialContext.init(InitialContext.ja va:223)
          at javax.naming.InitialContext.<init>(InitialContext. java:197)
          at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Construc tor.java:494)
          at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:85)
          at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:87)
          at org.springframework.beans.factory.support.Construc torResolver.autowireConstructor(ConstructorResolve r.java:186)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:799)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:717)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:384)
          at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 51)
          at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:156)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:248)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
          at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:287)
          at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
          at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:244)
          at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:187)
          at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
          at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3831)
          at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4323)
          at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:823)
          at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:807)
          at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:595)
          at org.apache.catalina.core.StandardHostDeployer.inst all(StandardHostDeployer.java:277)
          at org.apache.catalina.core.StandardHost.install(Stan dardHost.java:832)
          at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:701)
          at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:432)
          at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:983)
          at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:349)
          at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1091)
          at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:789)
          at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1083)
          at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:478)
          at org.apache.catalina.core.StandardService.start(Sta ndardService.java:480)
          at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:2313)
          at org.apache.catalina.startup.Catalina.start(Catalin a.java:556)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:287)
          at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:425)
          Caused by: java.lang.NullPointerException
          at org.apache.directory.server.core.ServerUtils.getAt tribute(ServerUtils.java:54)
          at org.apache.directory.server.core.partition.impl.bt ree.LeafEvaluator.evalEquality(LeafEvaluator.java: 301)
          at org.apache.directory.server.core.partition.impl.bt ree.LeafEvaluator.evaluate(LeafEvaluator.java:121)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEvaluator.evaluate(ExpressionEvaluat or.java:103)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator$2.assertCandidate(Express ionEnumerator.java:257)
          at org.apache.directory.server.core.partition.impl.bt ree.IndexAssertionEnumeration.prefetch(IndexAssert ionEnumeration.java:161)
          at org.apache.directory.server.core.partition.impl.bt ree.IndexAssertionEnumeration.<init>(IndexAssertio nEnumeration.java:66)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator.enumConj(ExpressionEnumer ator.java:270)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator.enumerate(ExpressionEnume rator.java:134)
          at org.apache.directory.server.core.partition.impl.bt ree.DefaultSearchEngine.search(DefaultSearchEngine .java:136)
          at org.apache.directory.server.core.partition.impl.bt ree.BTreePartition.search(BTreePartition.java:404)
          at org.apache.directory.server.core.partition.Default PartitionNexus.search(DefaultPartitionNexus.java:8 63)
          at org.apache.directory.server.core.referral.Referral Service.init(ReferralService.java:175)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.register0(InterceptorChain.java:436)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.register(InterceptorChain.java:395)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.init(InterceptorChain.java:260)
          ... 51 more

          解決方法:
          ??????? 我求助于Spring官網的論壇,得到了解決的方法。

          This is probably caused by the temporary apacheDS data file being corrupt. Try removing the directory Documents and settings\[user]\Local Settings\Temp\ldaptemplate_apacheds

          You could also try deleting the ldaptemplate_apacheds directory in Tomcat's temp dir, as well as the ldap-person in Tomcat's work/Catalina/localhost directory.


          這個錯誤很可能是由于ApacheDS的臨時數據文件遭到了破壞造成的,試著刪除Documents and settings\[user]\Local Settings\Temp\下的ldaptemplate_apacheds文件夾,還有Tomcat的Temp文件夾下的ldaptemplate_apacheds文件和Tomcat的work/Catalina/localhost下的應用文件夾。這樣再啟動tomcat后,ldaptemplate_apacheds文件就會重新生成,問題就解決了。


          下面貼出了原稿:http://forum.springframework.org/showthread.php?p=127663&posted=1#post127663

          Old Yesterday, 10:57 AM
          allen-zhe allen-zhe is offline
          Junior Member
          ?
          Join Date: Jun 2007
          Location: Beijing, China
          Posts: 3
          Wink Failed to initialize interceptor chain

          i got this trouble when i run the spring-ldap-person sample.
          mine env is window+tomcat.
          here is the stack:

          2007-06-21 10:10:47,218 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'serverContext' defined in ServletContext resource [/WEB-INF/apacheDsContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [javax.naming.InitialContext]: Constructor threw exception; nested exception is org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          Caused by:
          org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [javax.naming.InitialContext]: Constructor threw exception; nested exception is org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          Caused by:
          org.apache.directory.server.core.interceptor.Inter ceptorException: Failed to initialize interceptor chain. [Root exception is java.lang.NullPointerException]
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.init(InterceptorChain.java:274)
          at org.apache.directory.server.core.DefaultDirectoryS ervice.initialize(DefaultDirectoryService.java:822 )
          at org.apache.directory.server.core.DefaultDirectoryS ervice.startup(DefaultDirectoryService.java:229)
          at org.apache.directory.server.core.jndi.AbstractCont extFactory.getInitialContext(AbstractContextFactor y.java:117)
          at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:667)
          at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:247)
          at javax.naming.InitialContext.init(InitialContext.ja va:223)
          at javax.naming.InitialContext.<init>(InitialContext. java:197)
          at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Construc tor.java:494)
          at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:85)
          at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:87)
          at org.springframework.beans.factory.support.Construc torResolver.autowireConstructor(ConstructorResolve r.java:186)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:799)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:717)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:384)
          at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 51)
          at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:156)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:248)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
          at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:287)
          at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
          at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:244)
          at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:187)
          at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
          at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3831)
          at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4323)
          at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:823)
          at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:807)
          at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:595)
          at org.apache.catalina.core.StandardHostDeployer.inst all(StandardHostDeployer.java:277)
          at org.apache.catalina.core.StandardHost.install(Stan dardHost.java:832)
          at org.apache.catalina.startup.HostConfig.deployDirec tories(HostConfig.java:701)
          at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:432)
          at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:983)
          at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:349)
          at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1091)
          at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:789)
          at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1083)
          at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:478)
          at org.apache.catalina.core.StandardService.start(Sta ndardService.java:480)
          at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:2313)
          at org.apache.catalina.startup.Catalina.start(Catalin a.java:556)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:287)
          at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:425)
          Caused by: java.lang.NullPointerException
          at org.apache.directory.server.core.ServerUtils.getAt tribute(ServerUtils.java:54)
          at org.apache.directory.server.core.partition.impl.bt ree.LeafEvaluator.evalEquality(LeafEvaluator.java: 301)
          at org.apache.directory.server.core.partition.impl.bt ree.LeafEvaluator.evaluate(LeafEvaluator.java:121)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEvaluator.evaluate(ExpressionEvaluat or.java:103)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator$2.assertCandidate(Express ionEnumerator.java:257)
          at org.apache.directory.server.core.partition.impl.bt ree.IndexAssertionEnumeration.prefetch(IndexAssert ionEnumeration.java:161)
          at org.apache.directory.server.core.partition.impl.bt ree.IndexAssertionEnumeration.<init>(IndexAssertio nEnumeration.java:66)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator.enumConj(ExpressionEnumer ator.java:270)
          at org.apache.directory.server.core.partition.impl.bt ree.ExpressionEnumerator.enumerate(ExpressionEnume rator.java:134)
          at org.apache.directory.server.core.partition.impl.bt ree.DefaultSearchEngine.search(DefaultSearchEngine .java:136)
          at org.apache.directory.server.core.partition.impl.bt ree.BTreePartition.search(BTreePartition.java:404)
          at org.apache.directory.server.core.partition.Default PartitionNexus.search(DefaultPartitionNexus.java:8 63)
          at org.apache.directory.server.core.referral.Referral Service.init(ReferralService.java:175)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.register0(InterceptorChain.java:436)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.register(InterceptorChain.java:395)
          at org.apache.directory.server.core.interceptor.Inter ceptorChain.init(InterceptorChain.java:260)
          ... 51 more

          i need some help! thanks in adv.


          ? #2 ? Report Post ?
          Old Yesterday, 04:25 PM
          rasky rasky is offline
          Senior Member
          ?
          Join Date: Mar 2005
          Location: Landskrona, Sweden
          Posts: 200
          Default

          This is probably caused by the temporary apacheDS data file being corrupt. Try removing the directory Documents and settings\[user]\Local Settings\Temp\ldaptemplate_apacheds
          __________________
          Mattias Arthursson
          Jayway AB (www.jayway.se)
          Spring-LDAP project member

          ? #3 ? Report Post ?
          Old Yesterday, 05:49 PM
          allen-zheallen-zhe is offline
          Junior Member
          ?
          Join Date: Jun 2007
          Location: Beijing, China
          Posts: 3
          Wink

          thanks for ur advice, Mr. Arthursson. i tryed ur method, but it didn't work!
          i cleaned my temp files, and restored my ApahceDS, still got this error!
          got any other advice, Mr. Arthursson?

          by the way, mine ApacheDS's version is 1.0.0.

          ulsaulsa is offline
          Senior Member
          ?
          Join Date: Jul 2005
          Location: Helsingborg, Sweden
          Posts: 102
          Send a message via Skype? to ulsa
          Default

          You could also try deleting the ldaptemplate_apacheds directory in Tomcat's temp dir, as well as the ldap-person in Tomcat's work/Catalina/localhost directory.
          __________________
          Ulrik Sandberg
          Jayway AB (www.jayway.se)
          Spring-LDAP project member

          Old Today, 09:37 AM
          allen-zheallen-zhe is offline
          Junior Member
          ?
          Join Date: Jun 2007
          Location: Beijing, China
          Posts: 3
          Wink

          thanks a lot, ulsa! it works now!
          posted on 2007-06-22 16:50 小立飛刀 閱讀(2667) 評論(0)  編輯  收藏 所屬分類: LDAP

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2007年6月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          生存或毀滅,這是個必答之問題:是否應默默的忍受坎苛命運之無情打擊,還是應與深如大海之無涯苦難奮然為敵,并將其克服。此二抉擇,究竟是哪個較崇高?

          常用鏈接

          留言簿(12)

          隨筆分類(43)

          相冊

          收藏夾(7)

          朋友的博客

          電子資料

          搜索

          •  

          積分與排名

          • 積分 - 303182
          • 排名 - 193

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 和林格尔县| 延边| 安庆市| 永安市| 永丰县| 美姑县| 宁蒗| 独山县| 茌平县| 章丘市| 抚远县| 诸城市| 龙岩市| 凤山县| 鹰潭市| 原阳县| 镇康县| 罗田县| 石屏县| 筠连县| 铁岭市| 蓬安县| 安福县| 丰宁| 富民县| 延川县| 郑州市| 津市市| 文水县| 东丽区| 博湖县| 丰都县| 威海市| 商南县| 若羌县| 海原县| 江陵县| 亳州市| 寿阳县| 霍山县| 织金县|