JSP cant find bean Class using “” modifiers

不问归期 提交于 2019-12-12 15:17:05

问题


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: 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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/5035879/jsp-cant-find-bean-class-using-modifiers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!