为什么我的TOMCAT下的JavaBean不能运行呢?但是Servlet运行是成功的。

Impylm 2003-10-10 12:28:43
为什么我的TOMCAT下的JavaBean不能运行呢?但是Servlet运行是成功的。
代码是没有问题的,网上的类似的帖子也很多,但是我怀疑是TOMCAT的配置问题吗?
我的操作系统是LINUX。需要注意什么事项吗?

请帮忙提供一些TOMCAT在linux下配置TOMCAT的文章。我的程序就是javabean不能运行,真是奇怪!
...全文
41 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
mfc42d 2003-10-10
  • 打赏
  • 举报
回复
必须建立package,放在classes中
etre 2003-10-10
  • 打赏
  • 举报
回复
有没有错误信息先。
Impylm 2003-10-10
  • 打赏
  • 举报
回复
help
liad 2003-10-10
  • 打赏
  • 举报
回复
Constructor Summary
ServletException()
Constructs a new servlet exception.
ServletException(java.lang.String message)
Constructs a new servlet exception with the specified message.
ServletException(java.lang.String message, java.lang.Throwable rootCause)
Constructs a new servlet exception when the servlet needs to throw an exception and include a message about the "root cause" exception that interfered with its normal operation, including a description message.
ServletException(java.lang.Throwable rootCause)
Constructs a new servlet exception when the servlet needs to throw an exception and include a message about the "root cause" exception that interfered with its normal operation.
wangwd 2003-10-10
  • 打赏
  • 举报
回复
<jsp:useBean id="" class="" scope="">
中添加一个type属性
Impylm 2003-10-10
  • 打赏
  • 举报
回复
请大家看看,这是我的bean的源码
===================
package webbeans;

import java.io.Serializable;

public class modifyPWD implements Serializable
{
private String PhoneNumber;
private String OldPWD;
private String NewPWD;

public modifyPWD(){}

public String getPhoneNumber(){
return this.PhoneNumber;
}

public void setPhoneNumber(String PhoneNumber){
this.PhoneNumber=PhoneNumber;
}

public String getOldPWD(){
return this.OldPWD;
}

public void setOldPWD(String OldPWD){
this.OldPWD=OldPWD;
}

public String getNewPWD(){
return this.NewPWD;
}

public void setNewPWD(String NewPWD){
this.NewPWD=NewPWD;
}

}
wangwd 2003-10-10
  • 打赏
  • 举报
回复
在你的bean中,添加一个默认的构造器,这个构造器是不能省的,即使它是空的
Impylm 2003-10-10
  • 打赏
  • 举报
回复
楼上的两位请仔细看看好了,我在开发linux下短信平台的系统,后台大部分是servlet完成的,后来有些小功能用javaBean,结果调试通不过。相信我不会犯包的错误了吧。
Impylm 2003-10-10
  • 打赏
  • 举报
回复
网上的帖子是在太多了,但是绝不是包的问题,放在import里是成功的,错误在
<jsp:useBean id="" class="" scope="">
<jsp:setProperty name="" property="*"/>
</jsp:useBean>
生成该bean的实例时发生错误。问题的终结在哪里呢?
不要就事论事的答案,而是寻求问题的真正原因
Impylm 2003-10-10
  • 打赏
  • 举报
回复
错误提示如下:
Generated servlet error:
[javac] Compiling 1 source file
[javac] /root/www/jakarta-tomcat-4.1.12/work/Standalone/localhost/_/mpwd_jsp.java:62: Wrong number of arguments in constructor.
[javac] throw new ServletException("Cannot create bean of class " + "webbeans.modifyPWD", exc);
[javac] ^
[javac] 1 error
Yanbin_Q 2003-10-10
  • 打赏
  • 举报
回复
楼上说得对,javabean必须放在包中。
programeyonger 2003-10-10
  • 打赏
  • 举报
回复
我不看就知道了是包的路径问题拉!
注意的.class文件的路径吧!找相关的帖子看看吧!!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧