aspose file tools*
The moose likes JSP and the fly likes The value for the useBean class attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "The value for the useBean class attribute "..." is invalid." Watch "The value for the useBean class attribute "..." is invalid." New topic
Author

The value for the useBean class attribute "..." is invalid.

Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Hi,
I am using tomcat 6 and pogresql 9.0.1
I created a java bean in the package "beans" and placed it under
WEB_INF/classes directory. I am accessing the bean in my jsp page
using the following code.

<%@ page import = "beans.*, java.sql.*"%>

<jsp:useBean id="verify" scope="session" class="PasswordEncryptService" />

This is giving me the error as follows.

org.apache.jasper.JasperException: /apps/InfoMgmt/secureNew/VerifyPassword.jsp(11,0) The value for the useBean class attribute PasswordEncryptService is invalid.

Can anybody help me in solving this problem?

Regards,
Rekha
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Try beans.PasswordEncryptService.


[My Blog]
All roads lead to JavaRanch
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Hi,
Trying class=beans.PasswordEncryptService also did not work.
Regards,
Rekha
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

1. class="beans.PasswordEncryptService", not class=beans.PasswordEncryptService
2. WEB-INF, not WEB_INF
3. Does the PasswordEncryptService class have a public non-argument constructor ?
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Hi,
Yes it is class="beans.PasswordEncryptService"
It is WEB-INF and not WEB_INF.

The PasswordEncryptService has a no argument constructor.
Here is the code.

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

So you have WEB-INF/classes/beans/PasswordEncryptService.class ?
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Yes, I have WEB-INF/classes/beans/PasswordEncryptService.class
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Mmmh... It's in the same application as your JSP file, isn't it ? Also, did you try to reboot the web container ? Did you check the logs ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Ooohh. Maybe you have an exception happening in your constructor. Please check your logs.
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
I restarted tomcat. And loaded the page again.

This is the catalina.2010-11-12.log

Nov 12, 2010 1:43:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /apps/InfoMgmt/secureNew/VerifyPassword.jsp(11,0) The value for the useBean class attribute beans.PasswordEncryptService is invalid.
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Generator.generate(Generator.java:3426)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Ok. Still thinking... Even if an exception was raised in the constructor, you're just dumping the error, so that would not prevent the bean instantiation... I'm running out of gas. Can you show me your complete directory structure ? The one under webapps. Be extra careful to uppercase, lowercase, symbols...
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
webapps has these many directories
apps examples jsp-examples ROOT webdav
balancer fixPath.sh manager servlets-examples
docs host-manager OpenOfficeDocHandling tomcat-docs
And PasswordEncryptService.java and PasswordEncryptService.class
are in the following directory.

/usr/local/apache-tomcat-6.0.20/webapps/apps/WEB-INF/classes/beans
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Did you put the Apache Commons library under WEB-INF/lib ?
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Apache commons directory I have not put under WEB-INF/lib.
Right now I have left office. I will work on this issue on Monday
and get back.

Thanks and Regards,
Rekha.
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
I have copied all the *.jar files from common/lib to WEB-INF/lib.
Still I am getting the error.

Regards,
Rekha.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The value for the useBean class attribute "..." is invalid.