开发者

JSP cant find bean Class using "" modifiers

Hey I'm using Netbeans for my IDE and I'm getting an error when I try to run my EJB program. I get an error when I declare and give the path of the class in my JSP to a bean.

<jsp:useBean id="book" class="BookBean.Book" scope="application" />
<jsp:setProperty name="book" property="*" />

When I run the program I get this error

javax.servlet.ServletException: java.lang.InstantiationException开发者_如何学JAVA: class BookBean.Book : java.lang.IllegalAccessException: Class java.beans.Beans can not access a member of class BookBean.Book with modifiers ""

and

java.lang.InstantiationException: class BookBean.Book : java.lang.IllegalAccessException: Class java.beans.Beans can not access a member of class BookBean.Book with modifiers ""

I removed the "" and put in '' to see if that works, but it doesn't. Any idea? I also put a breakpoint there and it def. is the root of the problem. Thanks.


I figured it out. My constructor was not public....


Your class BookBean.Book needs to have a public parameterless constructor. My guess is that your constructor has no access modifier and is thus package private.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜