2015-01-30 7 views
0

지역 JBoss 서버에 연결하는 동안이 예외 (wildfly-8.2.0.Final)서버를 JBOSS에 연결할 수 없습니다 - 동작 상태가

javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING] 
    at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36) 
    at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121) 
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) 
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) 
    at javax.naming.InitialContext.init(InitialContext.java:244) 
    at javax.naming.InitialContext.<init>(InitialContext.java:216) 
    at com.sample.CalculatorIntegrationTestCase.obtainProxyReferences(CalculatorIntegrationTestCase.java:34) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309) 
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160) 
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) 
Caused by: java.lang.RuntimeException: Operation failed with status WAITING 
    at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89) 
    at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56) 
    at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166) 
    at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139) 
    at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104) 
    ... 18 more 

JNDI 특성은 다음과 같습니다있어 기다리고 실패했습니다

@BeforeClass 
    public static void obtainProxyReferences() throws Throwable { 

     Properties properties = new Properties(); 
     properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); 
     properties.put(Context.PROVIDER_URL, "remote://localhost:4447"); 
     properties.put("jboss.naming.client.ejb.context", true); 
     properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); 
     properties.put(Context.SECURITY_PRINCIPAL, "testuser"); 
     properties.put(Context.SECURITY_CREDENTIALS, "!Test1"); 
     namingContext = new InitialContext(properties); 

     bean = (MeBeanImpl) namingContext.lookup(JNDI_NAME); 
    } 

텔넷은 또한 포트 4447을 사용하여 서버에 연결할 수 없다고 말합니다. 방화벽에서이 포트를 열었지만 도움이되지 않았습니다.

답변

0

기본적으로 WildFly는 원격 포트로 8080을 사용합니다. EJB 클라이언트 API는 원격 호출을 위해 서버와 통신하기 위해 http 업그레이드 기능과 함께 http 포트를 사용합니다.

예 :

Properties jndiProps = new Properties(); 
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); 
jndiProps.put(Context.PROVIDER_URL,"http-remoting://localhost:8080"); 
jndiProps.put("jboss.naming.client.ejb.context", true); 
jndiProps.put(Context.SECURITY_PRINCIPAL, "testuser"); 
jndiProps.put(Context.SECURITY_CREDENTIALS, "!Test1"); 

// create a context passing these properties 
Context ctx = new InitialContext(jndiProps); 
// lookup 
ctx.lookup(JNDI_NAME); 

참조 : Remote EJB invocations via JNDI - EJB client API or remote-naming project

+1

javax.naming.NamingException : 서버에 연결하지 못했습니다. 시도한 서버 : [http-remoting : // localhost : 8080] – Dmitrii

0

당신이 받는다는을 사용하는 경우는,이 ​​종속성 추가하는 것을 잊지 마세요 : JMS를 들어

<dependency> 
    <groupId>org.wildfly</groupId> 
    <artifactId>wildfly-ejb-client-bom</artifactId> 
    <version>8.0.0.Final</version> 
    <type>pom</type> 
    </dependency> 

를, 당신이 필요합니다 이들도 마찬가지입니다 :

<dependency> 
    <groupId>org.hornetq</groupId> 
    <artifactId>hornetq-jms-client</artifactId> 
    <version>2.2.13.Final</version> 
    </dependency> 
    <dependency> 
    <groupId>org.hornetq</groupId> 
    <artifactId>hornetq-core-client</artifactId> 
    <version>2.2.13.Final</version> 
    </dependency> 

이것은 필요한 유일한 종속 항목이어야합니다. 사용하는 대신

0

"원격 : // 로컬 호스트 : 4447"사용 "HTTP-원격 : // localhost를 : 8080"당신이 코드에서 JNDI 속성을 구성 할 때

properties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080"); 

, 조회 이름은 포함되지 않아야합니다 ejb:

JNDI_NAME = "ear-name/ejb-name/beanClass!beanInterface.fullpath"); 
0

변화 재산

properties.put (Context.PROVIDER_URL, "원격 : // 로컬 호스트 : 4447");

properties.put에

(Context.PROVIDER_URL, "HTTP-원격 : // 로컬 호스트 : 4447");