File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes JNDI in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI in tomcat" Watch "JNDI in tomcat" New topic
Author

JNDI in tomcat

sivaraman subbiah
Greenhorn

Joined: Dec 29, 2008
Posts: 7
Hi ,

I am using LDAP authentication in tomcat 5.5

my settings are as below in server.xml :

<Host>
...


<Realm className="org.apache.catalina.realm.JNDIRealm"
debug="99" connectionURL="ldap://IP here:389/"
userPattern="{0}"
connectionName="MyNameHere"
connectionPassword="MyPasswordHere" />



</Host>

Settings in web.xml :

<security-constraint>

<web-resource-collection>
<web-resource-name>Logging Area</web-resource-name>
<description>
Only registered members can access this area.
</description>
<url-pattern>/*</url-pattern>

<http-method>GET</http-method>

<http-method>POST</http-method>

</web-resource-collection>

<auth-constraint>
<role-name>*</role-name>
</auth-constraint>

</security-constraint>
<security-role>
<role-name>*</role-name>
</security-role>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>
please type User name format as:
</realm-name>
</login-config>


If I dont give my connectionName and connectionPassword I get "cannot bind" exception. So, probably the ldap server does not accept anonymous connections.Correct me if i am wrong.

After giving connectionName and connectionPassword, I am getting this error :
SEVERE: Exception performing authentication
javax.naming.InvalidNameException: "Domain\user_Name here": [LDAP: error code 34 - 0000208F: LdapErr: DSID-0C090654, comment: Error processing name, data 0, vece ]; remaining name
''Domain\user_Name here"

at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_getAttributes(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(Unknown Source)
at javax.naming.directory.InitialDirContext.getAttributes(Unknown Source)
at org.apache.catalina.realm.JNDIRealm.getUserByPattern(JNDIRealm.java:1009)
at org.apache.catalina.realm.JNDIRealm.getUser(JNDIRealm.java:973)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:899)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:810)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI in tomcat
 
Similar Threads
css includes unrecognized in protected realm
LDAP configuration in TOmcat
after JNDI realm Authentication, need further specificity on authentication
Windows Authentication Using Tomcat 5.0
Tomcat 5.5.26 LDAP Problem