tomcat or 其他的jsp容器
解决方案 »
- 100分求助 下面两段代码的.action是什么意思。在哪能找到这些.action
- 几道面试题
- java servlet 给一个例子吧
- jsf的faces-config.xml中的结点 myeclipse6.5
- 关于一个循环遍历list,怎么得到内容创建select的问题 急!!!
- LookupDispathAction使用问题!!!!郁闷,请指点
- web怎么起头
- 高分咨询:关于工作流项目的入手、开发工具选择问题?
- 谁能提供一些webmail的资料(内详),走过路过都进来看看啊!!!
- resin-2.1.9版如何加载到windowXP的服务里?
- 求教:如何在jsp页面生成柱状图?
- !!!有承接网站建设的公司和个人?
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
import java.util.ArrayList;public class DoThingsTestClient1
extends Object {
private static final String ERROR_NULL_REMOTE = "Remote interface reference is null. It must be created by calling one of the Home interface methods first.";
private static final int MAX_OUTPUT_LINE_LENGTH = 100;
private boolean logging = true;
private DoThingsHome doThingsHome = null;
private DoThings doThings = null; //Construct the EJB test client
public DoThingsTestClient1() {
initialize();
} public void initialize() {
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
} try {
//get naming context
Context context = getInitialContext(); //look up jndi name
Object ref = context.lookup("DoThings");
//look up jndi name and cast to Home interface
doThingsHome = (DoThingsHome) PortableRemoteObject.narrow(ref,
DoThingsHome.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access through Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch (Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}
} private Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS,
password == null ? "" : password);
} return new InitialContext(properties);
}
catch (Exception e) {
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
}
}以前的程序的一部分希望对你有帮助]