jimsons原创
第一个错 NextIdBean代码中的错误
此错误会造成部署发生错误不能完成,将<INSTALL>/j2eetutorial14/examples/bank/src/com/sun/ebank/ejb/util/目录下的NextIdBean.java文件打开,找到下面这行代码
public Object ejbCreate() throws CreateException {
将方法ejbCreate()的返回类型由Object更改为String,再重新编译,并在deploytool中更新此文件,重新部署即可成功
第二个错 Web模块中的错误
打开Web客户端,输入用户名密码然后提交可能会抛出javax.servlet.jsp.JspTagException错误,请根据以下步骤进行更正:
1. 用文本编辑器新建java文档命名为CustomerHackFilter,保存到<INSTALL>/j2eetutorial14/examples/bank/src/com/sun/ebank/web目录下,内容如下:
package com.sun.ebank.web;import javax.servlet.*;
import javax.servlet.http.*;
import com.sun.ebank.util.Debug;
import com.sun.ebank.web.*;
import java.io.IOException;/**
* this is a dumb hack. update 4 seems to broken unless a
* CustomerBean is placed in the request linked to the BeanManager.
* Naturally, we need to add a BeanManager to the session here,
* doing some of the work the dispatcher should have done.
*/
public class CustomerHackFilter implements Filter
{
private FilterConfig filterConfig = null;
public void init(FilterConfig filterConfig)
throws ServletException
{
this.filterConfig = filterConfig;
} public void destroy() {
this.filterConfig = null;
} public void doFilter(ServletRequest req, ServletResponse response,
FilterChain chain)
throws IOException,
ServletException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpSession session = request.getSession(); BeanManager beanManager =
(BeanManager) session.getAttribute("beanManager"); if (beanManager == null) {
Debug.print("hack - Creating bean manager.");
beanManager = new BeanManager();
session.setAttribute("beanManager", beanManager);
} CustomerBean customerBean = new CustomerBean();
customerBean.setBeanManager(beanManager);
request.setAttribute("customerBean", customerBean);
Debug.print("hack - added customerBean to request"); chain.doFilter(request, response);
}
}
2. 重新编译源代码
3. 选中DukesBankWAR模块,编辑内容,找到com/sun/ebank/web/ CustomerHackFilter.class,将它添加到包中.
4. 选中DukesBankWAR模块,在Filter Mapping标签,点击Edit Filter List,在弹出的对话框中点击Add Filter,在Filter Class下拉列表中选中com.sun.ebank.web.CustomerHackFilter,Filter Name为CustomerHack,选择OK
5. 还是在这个标签在,点击Add,弹出 “Add Servlet Filter Mapping”,在Filter Name下拉列表中选CustomerHack,下面选中 “Filter this Servlet”,选OK
6.保存这个模块并重新部署运行即可修正错误
第一个错 NextIdBean代码中的错误
此错误会造成部署发生错误不能完成,将<INSTALL>/j2eetutorial14/examples/bank/src/com/sun/ebank/ejb/util/目录下的NextIdBean.java文件打开,找到下面这行代码
public Object ejbCreate() throws CreateException {
将方法ejbCreate()的返回类型由Object更改为String,再重新编译,并在deploytool中更新此文件,重新部署即可成功
第二个错 Web模块中的错误
打开Web客户端,输入用户名密码然后提交可能会抛出javax.servlet.jsp.JspTagException错误,请根据以下步骤进行更正:
1. 用文本编辑器新建java文档命名为CustomerHackFilter,保存到<INSTALL>/j2eetutorial14/examples/bank/src/com/sun/ebank/web目录下,内容如下:
package com.sun.ebank.web;import javax.servlet.*;
import javax.servlet.http.*;
import com.sun.ebank.util.Debug;
import com.sun.ebank.web.*;
import java.io.IOException;/**
* this is a dumb hack. update 4 seems to broken unless a
* CustomerBean is placed in the request linked to the BeanManager.
* Naturally, we need to add a BeanManager to the session here,
* doing some of the work the dispatcher should have done.
*/
public class CustomerHackFilter implements Filter
{
private FilterConfig filterConfig = null;
public void init(FilterConfig filterConfig)
throws ServletException
{
this.filterConfig = filterConfig;
} public void destroy() {
this.filterConfig = null;
} public void doFilter(ServletRequest req, ServletResponse response,
FilterChain chain)
throws IOException,
ServletException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpSession session = request.getSession(); BeanManager beanManager =
(BeanManager) session.getAttribute("beanManager"); if (beanManager == null) {
Debug.print("hack - Creating bean manager.");
beanManager = new BeanManager();
session.setAttribute("beanManager", beanManager);
} CustomerBean customerBean = new CustomerBean();
customerBean.setBeanManager(beanManager);
request.setAttribute("customerBean", customerBean);
Debug.print("hack - added customerBean to request"); chain.doFilter(request, response);
}
}
2. 重新编译源代码
3. 选中DukesBankWAR模块,编辑内容,找到com/sun/ebank/web/ CustomerHackFilter.class,将它添加到包中.
4. 选中DukesBankWAR模块,在Filter Mapping标签,点击Edit Filter List,在弹出的对话框中点击Add Filter,在Filter Class下拉列表中选中com.sun.ebank.web.CustomerHackFilter,Filter Name为CustomerHack,选择OK
5. 还是在这个标签在,点击Add,弹出 “Add Servlet Filter Mapping”,在Filter Name下拉列表中选CustomerHack,下面选中 “Filter this Servlet”,选OK
6.保存这个模块并重新部署运行即可修正错误
PACKAGE-EJB does not exist in this project ,我看了一下build.xml文件,的确没有这方面的部署信息。于是我把tutorial-1.3的bank例子的build.xml复制过来,可以打包了,但是又出现没有main方法的错误提示。我请大虾详细的说说怎么运行出tutorial1.4的bank这个例子。非常感谢。我真的急死了!
classpath要加入j2ee的几个包
请问你可以留下QQ给我吗,我想详细问一下你,谢谢,或者请你加我QQ:14658879。非常感谢!!
你在哪里,等着联系你呢?请回复!谢谢
你的功能可以用马?