提问者:小点点

org.jboss.naming.remote.client.InitialContextFactory maven依赖性


我在程序中使用了以下代码,这是jboss7客户端的jndi查找。

public static Context getInitialContext() throws NamingException {
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY,
              "org.jboss.naming.remote.client.InitialContextFactory");
      properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      properties.put(Context.PROVIDER_URL, "remote://localhost:4447");
      return new InitialContext(properties);
}

当我从eclipse运行我的程序时-

我需要在maven依赖项中包含相同的jar。

“org.jboss.nameing.remote.client.InitialContextFactory”的maven依赖性pom是什么?我在哪里可以找到依赖性pom。

谢谢


共2个答案

匿名用户

使用此依赖关系:

<dependency>
  <groupId>org.jboss</groupId>
  <artifactId>jboss-remote-naming</artifactId>
  <version>1.0.7.Final</version>
</dependency>

匿名用户

检查下面具有相关性的链接

mvnrepository.com/artifact/jboss/jboss-client

如果这不是您要查找的 jar,请在命令提示符下执行以下命令将 jar 文件添加到 Maven 存储库。

call mvn install:install-file -Dfile=jboss\jboss-client\1.0\jboss-client.jar -DgroupId=jboss-client -DartifactId=jboss-client -Dversion=1.0 -Dpackaging=jar

-dfile-应该是jar文件所在的路径。-DgroupId-组ID(根文件夹)-DartifactId-Jar文件名(将在根文件夹中创建一个子文件夹)-Dversion=1.0-jar的版本(将在文件名文件夹中创建另一个子文件夹)

如果您没有更改maven存储库的位置,那么这样做会将一个新的存储库添加到maven存储(.m2)中。