| 发表于:2007-06-08 12:45:37 楼主 |
写了一个简单的ejb3.0的程序,并且部署到了jfox中,想在tomcat中通过servlet调用,请问怎么调用?最好给个简单servlet的例子. 以下是我写的ejb3.0的小例子 ------------------------------------------------ package com.test; public interface hello { public string hello(); } ------------------------------------------------ import javax.ejb.remote; import javax.ejb.stateless; @stateless @remote(hello.class) public class hellomyconfig implements hello { public string hello() { string strresult = " "; try { strresult = "hello world. "; system.out.println(strresult); } catch (exception ex) { ex.printstacktrace(); strresult = "error "; } return strresult; } } ---------------------------------------- 我的客户端掉用(在jboss中跑过) --------------------------------------- import javax.naming.context; import javax.naming.initialcontext; public class helloclient { public static void main(string[] args) throws exception { context ctx = new initialcontext(); hello hello = (hello) ctx.lookup( "hellomyconfig/remote "); system.out.println(hello.hello()); } } |
|
|
|
|