java.net.UnknownHostException:http-remoting:// localhost on lookup

时间:2018-03-20 05:54:56

标签: java ejb wildfly

我正在尝试查找ejb。 server是wildfly 10,jdk 8,以下是代码片段

         InitialContext initialContext = null;
         Properties properties = new Properties();
         properties.put("java.naming.factory.initial",
                    "org.jnp.interfaces.NamingContextFactory");
         properties.put("java.naming.factory.url.pkgs",
                    "org.jboss.naming:org.jnp.interfaces");
         properties.put("jboss.naming.client.ejb.context",
                    "true");
         properties.put("java.naming.provider.url","http-remoting://localhost:9080");
        initialContext = new InitialContext(properties);
        initialContext.lookup("ejb:earname/jarname/bean!fullyqualifiedname");

我正处于异常

之下
javax.naming.CommunicationException: Could not obtain connection to any of these urls: http-remoting://localhost:9080 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
    at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1690)
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1761)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.elitecore.cwfe.core.BaseBL.BaseBL.lookup(BaseBL.java:127)
    at com.elitecore.cwfe.bl.delegates.BaseBusinessDelegate.lookup(BaseBusinessDelegate.java:158)
    at com.elitecore.cwfe.bl.delegates.system.user.UserBD.getFacade(UserBD.java:55)
    at com.elitecore.cwfe.bl.delegates.system.user.UserBD.doLogin(UserBD.java:76)
    at com.elitecore.cwfe.test.base.BaseTestCase.getBDSessionContext(BaseTestCase.java:24)
    at com.elitecore.cwfe.test.system.internal.SystemModuleTestCase.setUp(SystemModuleTestCase.java:25)
    at junit.framework.TestCase.runBare(TestCase.java:139)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)
    at   org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:422)
    at   org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:785)
Caused by: java.net.SocketTimeoutException: Receive timed out
    at java.net.PlainDatagramSocketImpl.receive0(Native Method)
    at       java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:144)
    at java.net.DatagramSocket.receive(DatagramSocket.java:812)
    at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1659)

我有主持人

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
在startup.sh文件中的

我为preferIPv4Stack

配置了JAVA_OPTS
  

JAVA_OPTS =“ - Djava.net.preferIPv4Stack = true”

我的服务器已启动并运行,在java.naming.provider.url的属性中,我每次遇到同样的问题时都尝试将url更改为localhost:9080/http:localhost:9080/jnp:localhost:9080。如何解决上述问题。

0 个答案:

没有答案