2 Replies Latest reply on Oct 14, 2003 9:19 AM by jfox

    Can't get beans to work -- Newbie needs help!

    jfox Newbie

      I can't get JBOSS 3.2.1 to work with a basic javabean.

      I have taken the basic bean example from "Java for the Web with Servlets, JSP, and EJB: A Developer's Guide to J2EE Solutions"

      I have created the directory beantest.war under the deploy directory.


      Here is index.jsp
      <jsp:useBean id="theBean" class="com.brainysoftware.CalculatorBean"/>

      int i = 4;
      int j = theBean.doubleit(i);
      out.print ("2*4="+j);


      Here is CalculatorBean.class
      package com.brainysoftware;
      public class CalculatorBean{
      public int doubleit(int number);
      return 2 * number;

      The error message that I get is:
      HTTP ERROR: 500 Unable to compile class for JSP An error occurred at line: 0 in the jsp file: /index.jsp Generated servlet error: [javac] Compiling 1 source file [javac] /tmp/Jetty_0_0_0_0_8080__beantest/index_jsp.java:41: cannot access com.brainysoftware.CalculatorBean [javac] bad class file: /home/jfox/jboss/server/default/deploy/beantest.war/WEB-INF/classes/com/brainysoftware/CalculatorBean.class [javac] illegal start of class file [javac] Please remove or make sure it appears in the correct subdirectory of the classpath. [javac] com.brainysoftware.CalculatorBean theBean = null; [javac] ^ [javac] 1 error