|
} catch (Exception e) {
}
finally {
if(rs!=null) rs.close();
if(st!=null) st.close();
if(conn!=null) conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return resl;
}
2. 部署EJB
3. 测试SessionBean
public class test{
public void run() {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
try {
Context ctx = new InitialContext(p);
Object obj = ctx.lookup("testBean");
testHome home = (testHome) PortableRemoteObject.narrow(obj, testHome.class);
test t = home.create();
System.out.println("test...");
String str = t.testDS();
System.out.println("received: \n" + str);
System.out.println("test finished!\n");
} catch (Exception e) {
e.printStackTrace();
}
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页 |