Category Archives: apache-directory

Apache application in subfolder

I put my application in a subfolder "subfolder" of Apache so I can use a url such as: https://myserver.com/subfolder/#/v2/login instead of https://myserver.com/#/v2/login

I'm using the following Directory configuration:

Alias /subfolder /srv/apache2/htdocs/subfolder
<Directory /srv/apache2/htdocs/subfolder>
    Order allow,deny
    Allow from all
    Options All
    AllowOverride All
    Require all granted
</Directory>

The problem is that now I have many broken links and not found resources showing errors such as:

https://myserver.com/app/v2/anotherfolder/anotherpage.html 
Failed to load resource: the server responded with a status of 404 (Not Found)

Note that such links in the errors do not contain "subfolder" in the path.

What am I missing?

Error opening ports for Apache Directory LDAP Connection?

I am configuring an Esri Geoportal Server on my machine and have installed Apache Directory Studio to set up the LDAP connection; however when checking my network parameters I receive the following error messages for connection failed. I have configured the Inbound rules via Windows Firewall for ports 389 and 10389, but to no avail. When using netstat -an in CMD I neither of these ports appear as listening or established. What is the best way to open either of these ports?

`The connection failed
 - localhost:389
  javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect]
    at com.sun.jndi.ldap.Connection.<init>(Unknown Source)
    at com.sun.jndi.ldap.LdapClient.<init>(Unknown Source)
    at com.sun.jndi.ldap.LdapClient.getInstance(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
    at com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
    at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.ldap.InitialLdapContext.<init>(Unknown Source)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$6.run(JNDIConnectionWrapper.java:898)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1305)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.doConnect(JNDIConnectionWrapper.java:940)
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.connect(JNDIConnectionWrapper.java:209)
    at org.apache.directory.studio.connection.core.jobs.CheckNetworkParameterRunnable.run(CheckNetworkParameterRunnable.java:80)
    at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:122)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.jndi.ldap.Connection.createSocket(Unknown Source)
    ... 20 more

  localhost:389`

How to put username with backslash in org.apache.directory.ldap.client.api.LdapConnection?

I have an issue with LDAP connection. When I try to connect with apache directory studio desktop I succesfully autheticate. But when I try to do this with Java it fails. I think that the problem is in username which contains backslash "\".

LdapConnection connection = new LdapNetworkConnection(ldapIp, ldapPort);
connection.bind( "uid=foo\\bar,ou=example,dc=example,dc=com", "mysEcretpa55" );

In this case it say that

Exception in thread "main" org.apache.directory.api.ldap.model.exception.LdapInvalidDnException: unexpected token: b

When I put 4 slashes it say:

LdapErr: DSID-0C0903C8, comment: AcceptSecurityContext error, data 52e, v2580

I read that 52e is an error of bad credentials. I'll repeat again that I verified in apache directory studio desktop application and it works fine.