EJB JAR 로 만들 프로젝트
package com.j2eearchitect.helloworld;
import javax.ejb.Remote;
@Remote // proxy 생성
public interface HelloWorld {
String sayHello(String name);
}
package com.j2eearchitect.ejb3.util;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.util.Properties;
public class JNDIHelper {
public static Context getJNDIContext() {
try {
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7001");
return new InitialContext(p);
} catch (NamingException e) {
e.printStackTrace();
}
return null;
}
public static Context getJNDIContext(String user, String password) {
try {
Properties props = new Properties();
props.put(Context.SECURITY_PRINCIPAL, user);
props.put(Context.SECURITY_CREDENTIALS, password);
props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://localhost:1099");
props.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
return new InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
}
return null;
}
public static Context getJNDIContext(Properties props) {
try {
return new InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
}
return null;
}
}
마이플랫폼 인사>근태 개발한것 (0) | 2015.07.03 |
---|---|
스프링 시큐리티 적용해보기, 웹 보안이 중요 (0) | 2015.07.03 |
스프링 시큐리티 (1) | 2015.07.01 |
ireport 간단한 사용방법 (0) | 2015.06.29 |
ibatis 에서 mybatis 변경 (0) | 2015.06.23 |