Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add fallback to http-remoting for wildfly JNDI
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Sep 2, 2014
1 parent 8acc6d3 commit df8c6d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
@@ -1,5 +1,6 @@
package org.zanata.util;

import com.google.common.base.Throwables;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.junit.rules.ExternalResource;
Expand Down Expand Up @@ -55,15 +56,25 @@ public static String getDocumentStoragePath() {
.lookup("zanata/files/document-storage-directory");
}
catch (NamingException e) {
// TODO wildfly jndi remoting is not working
URL testClassRoot =
Thread.currentThread().getContextClassLoader()
.getResource("setup.properties");
File targetDir =
new File(testClassRoot.getPath()).getParentFile();
storagePath =
new File(targetDir, "zanata-documents")
.getAbsolutePath();
try {
// wildfly uses 'http-remoting:' not 'remote:'
rmiPort = 8080+portOffset;
env.put(Context.PROVIDER_URL, "http-remoting://localhost:" + rmiPort);
remoteContext = new InitialContext(env);
storagePath =
(String) remoteContext
.lookup("zanata/files/document-storage-directory");
} catch (NamingException e1) {
// fall back option:
URL testClassRoot =
Thread.currentThread().getContextClassLoader()
.getResource("setup.properties");
File targetDir =
new File(testClassRoot.getPath()).getParentFile();
storagePath =
new File(targetDir, "zanata-documents")
.getAbsolutePath();
}
}
}
return storagePath;
Expand Down
Expand Up @@ -298,7 +298,7 @@
<subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
<subsystem xmlns="urn:jboss:domain:remoting:2.0">
<endpoint worker="default"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm" />
<http-connector name="http-remoting-connector" connector-ref="default" />
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"/>
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
Expand Down Expand Up @@ -451,4 +451,4 @@
</outbound-socket-binding>
</socket-binding-group>

</server>
</server>

0 comments on commit df8c6d6

Please sign in to comment.