2009-02-25 129 views
4

我在Tomcat server.xml文件的Tomcat安全領域中引用LDAP。然而,我收到了一個不尋常的錯誤:Tomcat沒有啓動,進入日誌我發現它無法連接到localhost:389 - Tomcat的默認LDAP URL。配置LDAP時出現Tomcat錯誤

然而,Tomcat的配置來點不同的URL(不在同一臺機器的外部URL;不同的一個完全),像這樣:

<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99" 
     connectionURL="ldap://XXX.XX.XX.XXX:389" 
     userSubtree="true" 
     userPattern="(cn={0},ou=XXXXXXXX,ou=XXXXX,o=XXX)" 
     roleBase="ou=XXXXXXXX,o=XXX" 
     roleName="cn" 
     roleSearch="member={0}" 
     connectionName="cn=XXXXXXXX,ou=XXXXXXXX,o=XXX" 
     connectionPassword="XXXXXXXX"/> 

,基本上我不知道爲什麼它的仍在看本地主機:389。如果有人遇到過這個,我會很感激一些幫助!我已經搜索了一段時間,但是當人們將錯誤粘貼到頁面中時,似乎沒有多少答案。如果有人有任何建議,我會很感激。

這裏的日誌文件:

24-Feb-2009 11:38:45 org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-8443 
Starting service Tomcat-Standalone 
Apache Tomcat/4.1.31 
Catalina.start: LifecycleException: Exception opening directory server connection:  
javax.naming.CommunicationException: localhost:389 
    [Root exception is java.net.ConnectException: Connection refused: connect] 
LifecycleException: Exception opening directory server connection: 
javax.naming.CommunicationException: localhost:389 
    [Root exception is java.net.ConnectException: Connection refused: connect] 
at org.apache.catalina.realm.JNDIRealm.start(JNDIRealm.java:1558) 
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126) 
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316) 
at org.apache.catalina.core.StandardService.start(StandardService.java:450) 
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:463) 
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) 
at org.apache.catalina.startup.Catalina.process(Catalina.java:129) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:324) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156) 
----- Root Cause ----- 
javax.naming.CommunicationException: localhost:389 
    [Root exception is java.net.ConnectException: Connection refused: connect] 
at com.sun.jndi.ldap.Connection.<init>(Connection.java:204) 
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:119) 
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1668) 
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2599) 
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290) 
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:53) 
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.catalina.realm.JNDIRealm.open(JNDIRealm.java:1482) 
at org.apache.catalina.realm.JNDIRealm.start(JNDIRealm.java:1556) 
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126) 
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316) 
at org.apache.catalina.core.StandardService.start(StandardService.java:450) 
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:463) 
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) 
at org.apache.catalina.startup.Catalina.process(Catalina.java:129) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:324) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156) 
Caused by: java.net.ConnectException: Connection refused: connect 
at java.net.PlainSocketImpl.socketConnect(Native Method) 
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) 
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) 
at java.net.Socket.connect(Socket.java:452) 
at java.net.Socket.connect(Socket.java:402) 
at java.net.Socket.<init>(Socket.java:309) 
at java.net.Socket.<init>(Socket.java:124) 
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:346) 
at com.sun.jndi.ldap.Connection.<init>(Connection.java:181) 
... 24 more 
Stopping service Tomcat-Standalone 
Catalina.stop: LifecycleException: Coyote connector has not been started 
LifecycleException: Coyote connector has not been started 
at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1296) 
at org.apache.catalina.core.StandardService.stop(StandardService.java:499) 
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2178) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:494) 
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350) 
at org.apache.catalina.startup.Catalina.process(Catalina.java:129) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:324) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156) 
+0

你確定server.xml是你配置的唯一地方嗎?據我所知, – tehvan 2009-02-25 09:57:47

+0

。我正在進入已禁用的現有安裝,我不認爲它是其他任何地方。哪裏會是好看的地方? 乾杯 – 2009-03-02 10:19:29

回答

1
  • 許多雄貓配置元素的支持調試屬性。嘗試將debug =「99」添加到領域配置。 (見雄貓realm-howto的例子,搜索調試=「99」
  • 作出額外額外肯定它不是一個錯字,例如在連接大寫的URL
  • 查看conf/server.xml中是否有其他提及「localhost」(或「127.0」)的信息
  • 查看是否有任何提及的「localhost」(或「127.0」)在conf/*/*/*。xml(儘管這不應該導致tomcat不啓動:它只會影響該應用程序)
  • 從最小的server.xml開始 - 如果使用tomcat 5.xa文件「server-minimal .xml「的交付方式比默認的server.xml更易讀
  • 請確保您不受server.xml中各種xml註釋的影響 - 我多次被它們咬傷。
2

嘗試添加與alternateURL具有相同值的'alternateURL'屬性。出於某種原因,當我遇到類似問題時,這對我有用。

2

我知道這是一個非常老的帖子,但是我最近遇到了這個問題,問題在於我將我的JNDIRealm嵌套在LockoutRealm中。

通過將JNDIRealm作爲我的頂級領域,我不再有所描述的問題。如果你確實需要鎖定領域,這個解決方案是沒有用的。

相關問題