Solved

Why is the value for the useBean class attribute invalid?

Posted on 2008-06-23
16
2,810 Views
Last Modified: 2013-11-24
I am able to deploy and run this Web Application locally, but when I upload it to a server, I get the error below.  I am using Java 1.6.0_06.  I do have to compile using javac -source 1.5 -target 1.5 QuadraticEquationAlgorithm.java before uploading to the server, which I have done.  My files are attached.  Thank you in advance!
HTTP Status 500 - 
 

--------------------------------------------------------------------------------
 

type Exception report
 

message 
 

description The server encountered an internal error () that prevented it from fulfilling this request.
 

exception 
 

org.apache.jasper.JasperException: /QuadEquTest/quadEquation.jsp(4,0) The value for the useBean class attribute javaBeans.QuadraticEquationAlgorithm is invalid.

	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)

	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
 

root cause 
 

org.apache.jasper.JasperException: /QuadEquTest/quadEquation.jsp(4,0) The value for the useBean class attribute javaBeans.QuadraticEquationAlgorithm is invalid.

	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)

	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)

	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)

	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)

	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)

	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)

	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)

	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)

	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)

	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)

	org.apache.jasper.compiler.Generator.generate(Generator.java:3320)

	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)

	org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)

	org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)

	org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)

	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)

	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)

	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
 

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.

Open in new window

QuadEquTest.zip
0
Comment
Question by:CharleneS77
  • 8
  • 5
  • 2
  • +1
16 Comments
 
LVL 10

Expert Comment

by:krishna kishore mellacheruvu venkata
Comment Utility
Check whether  the following class javaBeans.QuadraticEquationAlgorithm  is in classpath or not?
0
 
LVL 10

Expert Comment

by:krishna kishore mellacheruvu venkata
Comment Utility
Please check the following link for <jsp:useBean> tag

http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html
0
 
LVL 92

Assisted Solution

by:objects
objects earned 100 total points
Comment Utility
the class files has a .txt extension which should not be there. remove it so the file is named QuadraticEquationAlgorithm.class
Also make sure u upload (to the server) in binary format and not ascii format
0
 

Author Comment

by:CharleneS77
Comment Utility
>>>>the class files has a .txt extension which should not be there. remove it so the file is named QuadraticEquationAlgorithm.class

All of the zipped files have the txt extension.  The other files (.jsp, .java, and .class) are not supported for upload here.  Remove the txt extension from the filename.
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 400 total points
Comment Utility
I tested your web app locally on windows and I tested it on the web on a Linux server.  It worked in both cases. What kind of server are you using ?   The only mistake I can see is that you have neglected to add a web.xml file to your WEB-INF folder. Since you are using Tomcat 5.5.20, you should use the Servlet 2.4 root tag.

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
    version="2.4">

</web-app>
0
 

Author Comment

by:CharleneS77
Comment Utility
The server is an IIS server.  I've added the web.xml file and I still get the same error.
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 400 total points
Comment Utility
It should work.
Did you try your other web app to see if it can find its bean ?    
Also double check that you have the proper file structure.
Check to see if the class file is at
yourTomcatHome/webapps/QuadEquaTest/WEB-INF/classes/javaBeans/QuadraticEquationAlgorithm.class
0
 

Author Comment

by:CharleneS77
Comment Utility
>>>>Did you try your other web app to see if it can find its bean ?    

The other web app gives me the same error when I upload it to the server, but again, I am able to run it locally.

>>>>Also double check that you have the proper file structure.

It has the same file structure as the attachment in my original post.

>>>>Check to see if the class file is at
yourTomcatHome/webapps/QuadEquaTest/WEB-INF/classes/javaBeans/QuadraticEquationAlgorithm.class

The class file is there.

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 27

Assisted Solution

by:rrz
rrz earned 400 total points
Comment Utility
The only difference between my set up ( where it is working )  and your is that I am running Tomcat 6. But definately doesn't matter. It should work with your Tomcat 5.5  .
All I can suggest is to make some changes or additions until you find the error.
One thing you do is build a simple test page and keep building from there until you get a problem.  
Here start with this page.  See if it works.

<jsp:useBean id="test" class="java.lang.String" />
test page...
<%
  test = "testing bean tag";
%>
String bean contains <%=test%>



0
 

Author Comment

by:CharleneS77
Comment Utility
>>>>The only difference between my set up ( where it is working )  and your is that I am running Tomcat 6. But definately doesn't matter. It should work with your Tomcat 5.5.

I have Tomcat 6 on my machine and it works.  The server has Tomcat 5.5 and it doesn't work.  

>>>>All I can suggest is to make some changes or additions until you find the error.
One thing you do is build a simple test page and keep building from there until you get a problem.  
Here start with this page.  See if it works.

I'll keep messing with it until I get it figured out.  Yes, the test page you posted does work on the server.
0
 

Author Comment

by:CharleneS77
Comment Utility
OK, I have figured out what the problem was.  I had my jsp files one directory too deep on the server.  I already have a folder that was set up for me to upload to.  I did not think that it would matter if I included another directory level (such as QuadEquTest of DistanceCalculator2).  Can someone give me some more info on this?
0
 

Accepted Solution

by:
CharleneS77 earned 0 total points
Comment Utility
Actually, I was wrong.  The I believe the solution is a minor change to the web.xml file for UTF-8 encoding.

Would that have been the problem?

0
 
LVL 27

Expert Comment

by:rrz
Comment Utility
I don't think either of those changes could have solved the problem.  Do you have it working now ?
0
 

Author Comment

by:CharleneS77
Comment Utility
Yes both are working on the server.  Thank you all for your responses.
0
 

Author Comment

by:CharleneS77
Comment Utility
Should I award points for responses or just close this one?
0
 
LVL 27

Expert Comment

by:rrz
Comment Utility
If you found your own solution, then accept your own comment as the answer.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now