Hi, orbat
我改写了SUN petstore 1.1.2 的一个最小应用mailerapp
1. 类装载器问题
现在应用被打包成两个包
jfoxpetstore-mailweb.war (放在jfox\webapps下)
jfoxpetstore-mailejb-1.1.2.jar (放在jfox\apps下)
启动后部署成功,敲击
http://localhost:8080/http://localhost:8080/jfoxpetstore
-mailweb 进入
进入发送页面后,填写内容,点击发送出现以下错误(见邮件附件)
ERROR 1中表描述
由于mailweb中的
MailWebHelper 有如下代码
/**
* A helper method which creates and returns an
instance of the
* Mailer EJB component.
*/
private Mailer createMailerEJB()
throws NamingException, CreateException,
RemoteException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup("/" +
MailerHome.class.getName().replace('.', '/'));
//Object objref = initial.lookup(MAILER_EJBHOME);
MailerHome home = (MailerHome)
PortableRemoteObject.narrow(objref,
MailerHome.class);
EJBMetaData meta = home.getEJBMetaData();
return (Mailer) home.create();
}
而jfoxpetstore-mailejb-1.1.2.jar 被部署在apps下。
问题:
1. 当JFox在一个JVM上运行时,为什么EJB Container装载的
类,Web Container(Jetty)里的应用 看不到(不能调用)?
2. 当我把jfoxpetstore-mailejb-1.1.2.jar 中的部分类也打包到
jfoxpetstore-mailweb.war 重新发布后,出现,错误ERROR2
(详细信息请参见附件log.txt) , 请解释一下。