LDAP communication error - java

I am using this below code to connect to the ldap and assigning roles to the users.
IdentityStoreFactoryBuilder builder =
new IdentityStoreFactoryBuilder();
IdentityStoreFactory oidFactory = null;
IdentityStore oidStore = null;
Hashtable factEnv = new Hashtable();
Hashtable storeEnv = new Hashtable();
factEnv.put(OIDIdentityStoreFactory.ST_SECURITY_PRINCIPAL, "Obu");
factEnv.put(OIDIdentityStoreFactory.ST_SECURITY_CREDENTIALS,
"password123");
factEnv.put(OIDIdentityStoreFactory.ST_LDAP_URL,
"ldap://localhost:3060/");// here i'm getting exception
oidFactory =
builder.getIdentityStoreFactory("oracle.security.idm.providers.oid.OIDIdentityStoreFactory",
factEnv);
storeEnv.put(OIDIdentityStoreFactory.ADF_IM_SUBSCRIBER_NAME,
"dc=us,dc=oracle,dc=com");
oidStore = oidFactory.getIdentityStoreInstance(storeEnv);
Exception stack trace is:
Exception in thread "main" oracle.security.idm.ConfigurationException: javax.naming.CommunicationException: localhost:3060 [Root exception is java.net.ConnectException: Connection refused: connect]
at oracle.security.idm.providers.stdldap.TestConnectionPool.execute(LDIdentityStoreFactory.java:1026)
at oracle.security.idm.providers.stdldap.LDIdentityStoreFactory.setupConnPool(LDIdentityStoreFactory.java:620)
at oracle.security.idm.providers.stdldap.LDIdentityStoreFactory.setup(LDIdentityStoreFactory.java:333)
at oracle.security.idm.providers.oid.OIDIdentityStoreFactory.<init>(OIDIdentityStoreFactory.java:56)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at oracle.security.idm.IdentityStoreFactoryBuilder.getIdentityStoreFactory(IdentityStoreFactoryBuilder.java:128)
at view.AddRolesToUsers.main(AddRolesToUsers.java:60)
Caused by: javax.naming.CommunicationException: localhost:3060 [Root exception is java.net.ConnectException: Connection refused: connect]
at com.sun.jndi.ldap.Connection.<init>(Connection.java:210)
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
at oracle.security.idm.providers.stdldap.TestConnectionPool.run(LDIdentityStoreFactory.java:1006)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:352)
at com.sun.jndi.ldap.Connection.<init>(Connection.java:187)

Nothing listening at the port. Where did you get port 3060 from? The usual LDAP port is 389, or 636 for LDAPS.

java.net.ConnectException: Connection refused means The port name you have specified for the LDAP server is incorrect. Also check for other parameters you are passing those are making it unreachable.

I got the same error. coz I did not give some below props in application.properties. please do not forget to give those props.
spring.ldap.embedded.ldif = classpath:test-server.ldif
spring.ldap.embedded.base-dn = dc=springframework,dc=org
spring.ldap.embedded.port = 8389

Related

java.sql.SQLException: Could not open connection to jdbc:hive2://localhost:10000/default: java.net.SocketException: Connection reset

I am trying to setup a jdbc connection to the my hive! I am facing this error while trying to connect to the hiveserver2.
Any help over this would be really helpful! thanks
Also, here is my jdbc driver and the connection URL
Exception in thread "main" java.sql.SQLException: Could not open connection to jdbc:hive2://localhost:10000/default: java.net.SocketException: Connection reset
at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:206)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:178)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at play.readere.main(readere.java:98)
Caused by: org.apache.thrift.transport.TTransportException: java.net.SocketException: Connection reset
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:129)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:178)
at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:288)
at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:203)
... 5 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:127)
... 10 more
Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hive", "");
"org.apache.hive.jdbc.HiveDriver"

LdapContext socket closed exception when server url is up and running

I cannot tell if its a credentials/SSL issue or an LDAP configuration issue on the server. I tried accessing the local version and i had no problem (then again local Ldap and server setup is a little different). The socket is definitely not closed as we are using that url in our processing system and it is not down.
Code is failing at this line:
NamingEnumeration<?> namingEnum = ctx.search("dc=barney,dc=com", "(objectclass=person)", getSimpleSearchControls());
Code block:
final String ldapAdServer = "ldap://myspecialhost.barney.us:389";
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ldapAdServer);
LdapContext ctx = new InitialLdapContext(env, null);
ctx.setRequestControls(null);
NamingEnumeration<?> namingEnum = ctx.search("dc=barney,dc=com", "(objectclass=person)", getSimpleSearchControls());
And the stacktrace is here:
javax.naming.ServiceUnavailableException: tiffany.barney.ca:389; socket closed; remaining name 'dc=barney,dc=com'
at com.sun.jndi.ldap.Connection.readReply(Connection.java:437)
at com.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:613)
at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:536)
at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1965)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1827)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1752)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248)
at com.barney.shopping.tiffany.LDAPImpTest.main(LDAPImplTest.java:154)
EDIT 1:
I tried using a different url and i get a connection timed out. Does this new url seem more right and i'm getting closer to the correct url perhaps?
EDIT 2:
new stacktrace
javax.naming.CommunicationException: possibleURL:389 [Root exception is java.net.ConnectException: Connection timed out: connect]
at com.sun.jndi.ldap.Connection.<init>(Connection.java:209)
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:116)
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1582)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2678)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:296)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
at blablalbla.LDAPInterfaceTest.main(LDAPInterfaceTest.java:154)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:351)
at com.sun.jndi.ldap.Connection.<init>(Connection.java:186)
... 13 more

jedis connection exception: socket write error

Using jedis client to save data to redis localhost.
Once I connect to redisHost using jedis, I am not disconnecting as long as I get messages Is that an issue? Tried to change the timeout from default 2000 to 6000 but still the same error!
connecting and sending data:
if (jedis == null)
jedis = new Jedis(redisHost);
if (!jedis.isConnected())
jedis.connect();
if (jedis.isConnected())
jedis.zadd("someKey", doubleTime, "someValue");
following is the stack trace of the error receiving:
redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Software caused connection abort: socket write error
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:92)
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:72)
at redis.clients.jedis.Connection.sendCommand(Connection.java:80)
at redis.clients.jedis.BinaryClient.zadd(BinaryClient.java:387)
at redis.clients.jedis.Client.zadd(Client.java:327)
at redis.clients.jedis.Jedis.zadd(Jedis.java:1468)
at com.comcast.xre.WebSocketServer.saveLogToDB(WebSocketServer.java:105)
at com.comcast.xre.WebSocketServer.access$000(WebSocketServer.java:27)
at com.comcast.xre.WebSocketServer$1$1.onFullTextMessage(WebSocketServer.java:69)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:138)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:134)
at io.undertow.websockets.core.BufferedTextMessage.read(BufferedTextMessage.java:87)
at io.undertow.websockets.core.AbstractReceiveListener.readBufferedText(AbstractReceiveListener.java:134)
at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:72)
at io.undertow.websockets.core.AbstractReceiveListener.onText(AbstractReceiveListener.java:52)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:26)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:15)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:632)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:618)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:531)
Caused by: java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:31)
at redis.clients.util.RedisOutputStream.write(RedisOutputStream.java:38)
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:78)
... 23 more
Issue was with Jedis connection. It's connected but after few messages, connection is broken.
After each save to DB, I am disconnecting and removing the jedis client completely and creating a new client and connection. Looks awkward but it solves the issue.

Sending Email Exception in Play! 2

I am trying to send an email in the Play! Framework v 2.1.1.
In build.scala I have:
"com.typesafe" %% "play-plugins-mailer" % "2.1.0"
In conf/application.conf I have:
smtp.host=smtp.gmail.com
smtp.port= "587"
smtp.ssl=true
smtp.tls=true
smtp.user="dylanrboudro#gmail.com"
smtp.password="xxxxxx"
I have also tried smtp.port = "465"
The method to send the email is:
public void Email() {
MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email();
mail.setSubject("test");
mail.addRecipient("dylanrboudro#gmail.com");
mail.addFrom("DevOpsNotifications#gmail.com");
String body = "this is the first email sent by the devops requestor";
mail.sendHtml(body);
I am getting this error:
[RuntimeException: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:587]
And this stack trace:
! #6f9o6gmj8 - Internal server error, for (POST) [/request] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: org.apache.
commons.mail.EmailException: Sending the email to the following server failed :
smtp.gmail.com:587]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_
2.10.jar:2.1.1]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_
2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$ha
ndle$1.apply(PlayDefaultUpstreamHandler.scala:144) [play_2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$ha
ndle$1.apply(PlayDefaultUpstreamHandler.scala:140) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise
.scala:113) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise
.scala:113) [play_2.10.jar:2.1.1]
java.lang.RuntimeException: org.apache.commons.mail.EmailException: Sending the
email to the following server failed : smtp.gmail.com:587
at play.libs.F$Promise$6.apply(F.java:401) ~[play_2.10.jar:2.1.1]
at scala.concurrent.Future$$anonfun$map$1.liftedTree2$1(Future.scala:253
) ~[scala-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scal
a-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scal
a-library.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) ~[scala-
library.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.liftedTree1$1(Bat
chingExecutor.scala:67) ~[akka-actor_2.10.jar:na]
Caused by: org.apache.commons.mail.EmailException: Sending the email to the foll
owing server failed : smtp.gmail.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242) ~[comm
ons-email-1.2.jar:1.2]
at org.apache.commons.mail.Email.send(Email.java:1267) ~[commons-email-1
.2.jar:1.2]
at com.typesafe.plugin.CommonsMailer.send(MailerPlugin.scala:242) ~[play
-plugins-mailer_2.10-2.1.0.jar:2.1.0]
at com.typesafe.plugin.MailerBuilder$class.sendHtml(MailerPlugin.scala:2
04) ~[play-plugins-mailer_2.10-2.1.0.jar:2.1.0]
at com.typesafe.plugin.CommonsMailer.sendHtml(MailerPlugin.scala:215) ~[
play-plugins-mailer_2.10-2.1.0.jar:2.1.0]
at models.V1Project.Email(V1Project.java:211) ~[na:na]
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.g
mail.com, port: 465
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391) ~
[mail-1.4.1.jar:1.4.1]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:41
2) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.Service.connect(Service.java:310) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.Service.connect(Service.java:169) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.Service.connect(Service.java:118) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.Transport.send0(Transport.java:188) ~[mail-1.4.1.jar:1.4.1
]
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.7.0_
07]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI
mpl.java:69) ~[na:1.7.0_07]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
va:339) ~[na:1.7.0_07]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket
Impl.java:200) ~[na:1.7.0_07]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:182) ~[na:1.7.0_07]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157) ~[na:1.7.0
_07]
Anyone have any idea? Thanks so much!
You need to remove quotes from smtp.port settings.
It should be smtp.port = 587.
I'm not using quotes for the smtp.password field and it is working for me.
Here is a sample app that does what you need:
https://github.com/jamesward/play-emailer
Perhaps try that app and see if it works. If not, then your problem is likely that your network doesn't allow the outbound connection.

Connection refused to LDAP (Java)

I am connecting to LDAP, which is working fine. However, I need to change the value of one attribute. I am able to read the current value, but I can't modify the value. This is my code:
I have tried many things from the internet, but all cause in one error:
[Root exception is java.net.ConnectException: Connection refused: connect] (It's always in the "executing" line of code).
at com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:74)
at com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:132)
at com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:410)
at com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:357)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(ComponentContext.java:596)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(PartialCompositeContext.java:183)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(PartialCompositeContext.java:173)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at Client.connect(Client.java:80)
at Main.main(Main.java:22)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:570)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:371)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:71)
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:597)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:316)
at com.sun.jndi.ldap.Connection.<init>(Connection.java:186)
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:116)
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2678)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:296)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:134)
at com.sun.jndi.url.ldap.ldapURLContextFactory.getObjectInstance(ldapURLContextFactory.java:35)
at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:584)
at javax.naming.spi.NamingManager.processURL(NamingManager.java:364)
at javax.naming.spi.NamingManager.processURLAddrs(NamingManager.java:344)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:316)
at com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:93)
This is what I tried - what am I doing wrong? Please give me some suggestions.
Attribute mod0 = new BasicAttribute("attribute", "AAA");
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
authContext.modifyAttributes("correctDn", mods);
Later, I tried this one:
Attribute acl = new BasicAttribute( "attribute", "asdf");
authContext.modify( entryDN, new LDAPModification(LDAPModification.ADD, acl));
EDITED This is a connection refusal while processing a referral. You are talking to an LDAP slave that has sent you a referral to the master, and you can't connect to the master, either because the slave configuration has given you the wrong referral information or because there is a firewall in the way of the master LDAP server.

Categories

Resources