1
glassfish v3 서버에서 구성된 JNDI의 일부 속성을 조회하고자합니다. 나는 봄을 사용하여 그것을하고 싶다. 내가 sun-web.xml에와의 web.xml 파일에 jndi/ws_properties
을 매핑 한Spring 3 glassfish3에서의 JNDI 검색
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<!--
JNDI look ups.
!-->
<jee:jndi-lookup id="properties"
jndi-name="java:comp/env/jndi/ws_properties"
expected-type="java.util.Properties"/>
</beans>
: 여기 내 스프링 구성입니다. 문제는이 조회가 항상 나에게 null 속성을 제공한다는 것입니다. 하지만 자바 코드로하면 :
try {
InitialContext context = new InitialContext();
properties = (Properties) context.lookup("jndi/ws_properties");
} catch (NamingException e) {
LOGGER.error("", e);
}
괜찮습니다. 내 속성 키와 값이 표시됩니다.
누군가 여기서 문제가 어디 있는지 말해 줄 수 있습니까?
네가 말했듯이 네가 고맙다. –