2 Questions about Beans plus a Hello World Bean Exception

I'm just trying to deploy a simple HelloWorld Bean which is called by a JSP and i'm getting a ton of errors and i'm not sure why.  Just for background, i'm running JBoss and Tomcat bundle (JBoss 3.0.6 and Tomcat 4.1.18).

I have three questions,
(1) Do I have to map the bean into my web.xml file?  I'm pretty sure I have to but of all the documentation (and the book I have), there is no mention of doing this.

(2) Since JSP are not compiled like a servlet but the bean has to be compiled first, do I have to make a WAR file to deploy it?  Reason i'm asking is, again, my book doesn't say I have to do this.  It basically says, drop it into the deploy directory in JBoss and all is fine....which didn't work for me.

(2) As stated before, i'm trying to use my bean inside a jsp and i'll explain what i've done thus far.
a. Compiled the HelloWorldBean.java into a class file and put it into my BeanTest\WEB-INF\classes directory
b. Configured web.xml to find the HelloWorldBean.class I just made as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   <servlet>
       <servlet-name>HelloWorldBean</servlet-name>
       <servlet-class>HelloWorldBean</servlet-class>
   </servlet>

   <servlet-mapping>
       <servlet-name>HelloWorldBean</servlet-name>
       <url-pattern>/HelloWorldBean</url-pattern>
   </servlet-mapping>
</web-app>

c. Then I made a jsp file called HelloWorldBeanEdition.jsp as follows:
<HTML>
<HEAD>Hello World - Bean Edition</HEAD>

<BODY>
<jsp:useBean id="hello" class="helloBean.HelloWorldBean" />
<jsp:setProperty name="hello" property="name" param="name" />
Hello, <jsp:getProperty name="hello" property="name" />
</BODY>
</HTML>

d. Then I made a war file containing everything in BeanTest
e. Stuck the war file into my deploy directory and tried to access it through the browser URL: http://localhost:8080/BeanTest/HelloWorldBeanEdition.jsp

That's when I got all the following errors - which I have been trying to fix for hours:

NOTE: I have a index.html file in my war file that works fine.

type Exception report

message

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

exception

org.apache.jasper.JasperException: helloBean.HelloWorldBean
      at org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:183)
      at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:691)
      at org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:552)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
      at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
      at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
      at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
      at org.apache.jasper.compiler.Generator.generate(Generator.java:1871)
      at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:238)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
      at java.lang.Thread.run(Thread.java:536)


root cause

java.lang.ClassNotFoundException: helloBean.HelloWorldBean
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1428)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)
      at org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:181)
      at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:691)
      at org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:552)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
      at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
      at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
      at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
      at org.apache.jasper.compiler.Generator.generate(Generator.java:1871)
      at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:238)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
      at java.lang.Thread.run(Thread.java:536)

KABOOMAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kennethxuCommented:
>> Do I have to map the bean into my web.xml file?
no!

>> do I have to make a WAR file to deploy it?
you don't have to

>> a. Compiled the HelloWorldBean.java into a class file and put it into my BeanTest\WEB-INF\classes directory
make sure you use package for your bean, for example, make this line the every first line of your HelloWorldBean.java:
package helloBean;

IMPORTANT: then compile and put class file at BeanTest\WEB-INF\classes\helloBean\HelloWorldBean.class

>> b. Configured web.xml to find the HelloWorldBean.class I just made as follows:
remove all these, only servlet need mapping in web.xml, not beans, those lines in web.xml can cause context failed to load.

restart server and try again.
0
KABOOMAuthor Commented:
Ok, I got rid of my web.xml file.  I also imported my bean in my jsp but now I get a MAPPING configuration error and i'm not sure why.

Below is my HelloWorldBeanEdition.jsp:

<%@ page import="helloBean.*" %>
<HTML>
<HEAD>Hello World - Bean Edition</HEAD>
<BODY>
<jsp:useBean id="hello"
class="helloBean.HelloWorldBean" />
<jsp:setProperty name="hello" property="name" param="name" />
Hello, <jsp:getProperty name="hello" property="name" />
</BODY>
</HTML>

This jsp resides in:
C:\jboss-3.0.6_tomcat-4.1.18\server\default\deploy\BeanTest

and I put my class file where you said (in the classes directory inside BeanTest).

0
kennethxuCommented:
hmmm, can you double check on these?
1. your web.xml should looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
</web-app>

2. make sure this is the first line of HelloWorldBean.java:
package helloBean;

3. make sure your class file is under BeanTest\WEB-INF\classes\helloBean, notice that this is helloBean subdir under classes.

4. remember to restart server.

post the stack trace if you still have problem, thanks.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

KABOOMAuthor Commented:
Hi Kennethxu.  Thanks for the help and it still didn't work.  Again, i'm still getting the mapping configuration error and can't even access the index.html file in the deploy/BeanTest directory.  Here's the exact error from JBoss as follows:
MAPPING configuration error for request URI /BeanTest/HelloWorldBeanEdition.jsp

I'll post all of my files and directory structure:
First my directory structure in deploy directory

Deploy
|-BeanTest
|--WEB-INF
|----classes
|--------helloBean
|---------------HelloWorldBean.class
|---------------HelloWorldBean.java
|----lib
|----web.xml
|--HelloWorldBeanEdition.jsp
|--index.html


WEB.XML FILE
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>


</web-app>


HELLOWORLDBEAN.JAVA
package helloBean;

public class HelloWorldBean implements java.io.Serializable
{  String name;
     
   public HelloWorldBean()
   {  this.name = "World"; }

   public String getName()
   {  return this.name; }

   public void setName(String name)
   {  this.name = name; }
}


HELLOWORLDBEANEDITION.JSP

<HTML>
<HEAD>Hello World - Bean Edition</HEAD>

<BODY>
<jsp:useBean id="hello" class="helloBean.HelloWorldBean" />
<jsp:setProperty name="hello" property="name" param="name" />
Hello, <jsp:getProperty name="hello" property="name" />
</BODY>
</HTML>
0
kennethxuCommented:
rename your BeanTest dir to BeanTest.war :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KABOOMAuthor Commented:
Wow!  That worked! I have to admit, i'm a little puzzled why that worked and all of the books i've read - didn't say to do that.  Is that a JBoss specific implementation or did I just miss reading it?

0
kennethxuCommented:
that's jboss specific, jboss's deployment scaner look for *.war, be it a dir or a war file.
0
kennethxuCommented:
this is because, tomcat only handles webapp, but jboss need to handle webapp, j2ee app and etc. so jboss uses extension to differentiate.
0
KABOOMAuthor Commented:
Your a life saver.

Thanks again.
0
kennethxuCommented:
my pleasure to help :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.