2013-12-17 4 views
0

InitialContext을 초기화하고 문자열을 찾을 수 없습니다. 여기 내 코드입니다 : JBoss AS 7.1에서 InitialContext를 초기화 할 수 없습니다.

java.util.Hashtable env = new java.util.Hashtable(); 
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory"); 
env.put("java.naming.provider.url","remote://localhost:4447"); 
env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); 
try 
    {  
    if(env != null) 
     ic = new InitialContext(env); 
    else 
     ic = new InitialContext(); 

this.connectionFactory = (ConnectionFactory)ic.lookup("java:/ConnectionFactory"); 
this.queue = (javax.jms.Queue)ic.lookup("java:jboss/exported/jms/queue/test"); 

}catch(Exception e){ 
e.printStackTrace(); 
} 

항상 ic가 null되고있는 나는 예외 NullPointer Exception을 얻고있다. 누구나 내가 잘못했거나 구성을 잘못했는지 말할 수 있습니까? 어떤 제안/조언도 받아 들일 수 있습니다.

편집 : 당신이 당신의 클래스 패스에 InitialContextFactory 클래스가없는 것 1

20:19:01,678 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) 
javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory 
org.jboss.naming.remote.client.InitialContextFactory from classloader 
ModuleClassLoader for Module "deployment.TRH_SAS_V2.war:main" from Service Module 
Loader 
20:19:01,682 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) 
at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64) 

20:19:01,684 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) 

20:19:01,686 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) 

20:19:01,688 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) at javax.naming.InitialContext.init(Unknown Source) 

20:19:01,690 ERROR [stderr] (http-localhost-127.0.0.1-8080-5) at javax.naming.InitialContext.<init>(Unknown Source) 

답변