EJB를 만들었습니다. 2. JBoss-IDE 1.6에 배포 한 다음 액세스하기 위해 JUnit 테스트를 만들었습니다. 여기에 내가 클라이언트에 사용되는 코드입니다 :EJB 클라이언트 오류
public class DossierBeanTest extends TestCase {
protected DossierHome dossierHome;
protected Dossier dossier;
public DossierBeanTest(String argo){
super(arg0);
}
protected void setUp() throws Exception {
super.setUp();
Hashtable env=new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
env.put(Context.PROVIDER_URL,"jnp://localhost:1199");
Context context=new InitialContext(env);
Object finderRef=context.lookup(dossierHome.JNDI_NAME);
dossierHome=(DossierHome)PortableRemoteObject.narrow(finderRef,DossierHome.class);
dossier=dossierHome.create();
}
public void testGetString() throws RemoteException {
assertEquals("Test",dossier.getTest());
}
하지만 문제는이 클라이언트가 오류와 함께 실패한다는 것입니다 : 당신이 사용하는 추측에는 요
javax.naming.CommunicationException: Could not obtain connection to any of these
urls: localhost:1199 and discovery failed with error :
javax.naming.CommunicationException: Receive timed out [Root Exception is
java.net.SocketTimeoutException: Receive timed out][Root exception is
javax.naming.CommunicationException: Failed to connect to server localhost:1199
....
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1416)
....
구성 파일을 변경해야합니까? – Attilah
"jboss-service.xml"파일을보고 에 있습니다. –
tangens