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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19094468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:02:59  来源:igfitidea点击:

org.jboss.naming.remote.client.InitialContextFactory maven dependancy

javamavenjboss

提问by Surendran Duraisamy

I am using following code in my program, which is jndi lookup for jboss 7 client.

我在我的程序中使用以下代码,这是 jboss 7 客户端的 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);
}

when I run my program from eclipse->Run as java application it works fine provided I give jboss/bin/client/jboss-client.jar in my classpath.

当我从 eclipse->Run as java application 运行我的程序时,它工作正常,前提是我在我的类路径中提供了 jboss/bin/client/jboss-client.jar。

I need to include the same jar in my maven dependency.

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

What is the maven dependancy pom for "org.jboss.naming.remote.client.InitialContextFactory" or where can I find the dependency pom.

“org.jboss.naming.remote.client.InitialContextFactory”的maven依赖pom是什么,或者我在哪里可以找到依赖pom。

Thanks.

谢谢。

回答by Samy

Check the link below which has the dependency

检查下面具有依赖关系的链接

mvnrepository.com/artifact/jboss/jboss-client

mvnrepository.com/artifact/jboss/jboss-client

If that is not the jar you are looking for, add the jar file to Maven repository by executing the below command in command prompt.

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

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

-Dfile - Should be the path where you jar file is. -DgroupId - Group ID (Root folder) -DartifactId - Jar file name (A sub folder will be created inside root folder) -Dversion=1.0 - Version of the jar ( Another sub folder will be created inside file name folder)

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

Doing this will add a new repository to your maven repository (.m2) if you have not changed the maven repository location.

如果您尚未更改 Maven 存储库位置,则这样做会向您的 Maven 存储库 (.m2) 添加一个新存储库。

回答by Fabricio Lemos

Use this dependency:

使用此依赖项:

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