4 Replies Latest reply on Jul 16, 2003 1:37 AM by feuerzangenbowle

    JSP:useBean-Problem

    feuerzangenbowle Newbie

      I have a problem with the using of the JSP-Tag
      <jsp:useBean...>

      I have made a simple application using JAAS.

      If I use this code

      <%@page contentType="text/html"%>

      JSP Page



      <form method="POST"
      action='<%= response.encodeURL("j_security_check")%>'>
      <%!
      void check() throws InstantiationException, IllegalAccessException,ClassNotFoundException
      {
      }
      %>



      Username:



      Password:





      <INPUT type="button" value="PASS IS" onclick=""<%--'<%= jdbc.getOK()%>'>--%>








      pack this code in a .war-File and deploy it in JBoss, it works. This dialog appears and I can make an input.

      But if I insert the lines, here bold then
      the server don`t find the file
      .

      <%@page contentType="text/html"%>
      <%@page import="databaseConnection.CurrentTimeBean"%>
      <jsp:useBean id="time" scope="application" class="databaseConnection.CurrentTimeBean"/>

      <%--<jsp:useBean id="jdbc" scope="request" class="databaseConnection.jdbc_test"/>--%>

      JSP Page



      <form method="POST"
      action='<%= response.encodeURL("j_security_check")%>'>
      <%!
      void check() throws InstantiationException, IllegalAccessException,ClassNotFoundException
      {
      }
      %>



      Username:



      Password:





      <INPUT type="button" value="PASS IS" onclick=""<%--'<%= jdbc.getOK()%>'>--%>
      <jsp:getProperty name="time" property="minutes"/>









      Now my questions are:

      Do I have to configure something in JBoss, so he understand the JSP-Tags?

      Do I have to set any path?

      Or what else can I do to make it runnable?

      My development-environment is:

      * j2sdk1.4.1_02
      * jboss-3.2.1
      * netbeans IDE 3.5


      Many thanks for the help.

        • 1. Re: JSP:useBean-Problem
          Harald Gliebe Novice

          > But if I insert the lines, here bold then
          > the server don`t find the file
          .

          Could you also attach the exact error message you get in the server log and/or browser ?

          Regards,
          Harald

          • 2. Re: JSP:useBean-Problem
            feuerzangenbowle Newbie

            Hi Harald,

            I only post the errors.

            Error Message JBoss:

            07:13:59,820 WARN [jbossweb] WARNING: Exception:
            Compile failed; see the compiler error output for details.
            at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:844)
            at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
            at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
            at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
            .java:473)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
            .java:190)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
            95)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360
            )
            at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati
            onHandler.java:294)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5
            58)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
            at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication
            Context.java:507)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
            at org.mortbay.http.HttpServer.service(HttpServer.java:863)
            at org.jboss.jetty.Jetty.service(Jetty.java:460)
            at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
            at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
            201)
            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
            at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

            07:13:59,910 INFO [jbossweb] Exception: : Compile failed; see the compiler erro
            r output for details.
            07:13:59,920 ERROR [STDERR] Compile failed; see the compiler error output for de
            tails.
            07:13:59,930 ERROR [STDERR] at org.apache.tools.ant.taskdefs.Javac.compile(J
            avac.java:844)
            07:13:59,940 ERROR [STDERR] at org.apache.tools.ant.taskdefs.Javac.execute(J
            avac.java:682)
            07:13:59,940 ERROR [STDERR] at org.apache.jasper.compiler.Compiler.generateC
            lass(Compiler.java:317)
            07:13:59,950 ERROR [STDERR] at org.apache.jasper.compiler.Compiler.compile(C
            ompiler.java:370)
            07:13:59,950 ERROR [STDERR] at org.apache.jasper.JspCompilationContext.compi
            le(JspCompilationContext.java:473)
            07:13:59,970 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.s
            ervice(JspServletWrapper.java:190)
            07:13:59,980 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJ
            spFile(JspServlet.java:295)
            07:13:59,980 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(
            JspServlet.java:241)
            07:13:59,990 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
            rvlet.java:853)
            07:13:59,990 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handl
            e(ServletHolder.java:360)
            07:14:00,000 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationHandl
            er.dispatch(WebApplicationHandler.java:294)
            07:14:00,010 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.hand
            le(ServletHandler.java:558)
            07:14:00,010 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
            xt.java:1714)
            07:14:00,020 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationConte
            xt.handle(WebApplicationContext.java:507)
            07:14:00,020 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
            xt.java:1664)
            07:14:00,030 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServe
            r.java:863)
            07:14:00,030 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:460)

            07:14:00,040 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpC
            onnection.java:775)
            07:14:00,050 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(Ht
            tpConnection.java:939)
            07:14:00,050 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpCo
            nnection.java:792)
            07:14:00,060 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnect
            ion(SocketListener.java:201)
            07:14:00,060 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(Thread
            edServer.java:289)
            07:14:00,070 ERROR [STDERR] at org.mortbay.util.ThreadPool$PoolThread.run(Th
            readPool.java:455)
            07:14:00,090 WARN [jbossweb] WARNING: Exception for /test/login.jsp;jsessionid=
            4tup1pa88c8e6
            org.apache.jasper.JasperException: Unable to compile class for JSP

            An error occurred at line: -1 in the jsp file: null

            Generated servlet error:
            [javac] Compiling 1 source file
            [javac] C:\DOKUME~1\HECRIN~1\LOKALE~1\Temp\Jetty_0_0_0_0_8080__test\login_js
            p.java:7: package databaseConnection does not exist
            [javac] import databaseConnection.CurrentTimeBean;
            [javac] ^
            [javac] C:\DOKUME~1\HECRIN~1\LOKALE~1\Temp\Jetty_0_0_0_0_8080__test\login_js
            p.java:49: package databaseConnection does not exist
            [javac] databaseConnection.CurrentTimeBean time = null;
            [javac] ^
            [javac] C:\DOKUME~1\HECRIN~1\LOKALE~1\Temp\Jetty_0_0_0_0_8080__test\login_js
            p.java:51: package databaseConnection does not exist
            [javac] time = (databaseConnection.CurrentTimeBean) pageContext.getA
            ttribute("time", PageContext.APPLICATION_SCOPE);
            [javac] ^
            [javac] C:\DOKUME~1\HECRIN~1\LOKALE~1\Temp\Jetty_0_0_0_0_8080__test\login_js
            p.java:54: package databaseConnection does not exist
            [javac] time = (databaseConnection.CurrentTimeBean) java.beans.B
            eans.instantiate(this.getClass().getClassLoader(), "databaseConnection.CurrentTi
            meBean");
            [javac] ^
            [javac] C:\DOKUME~1\HECRIN~1\LOKALE~1\Temp\Jetty_0_0_0_0_8080__test\login_js
            p.java:99: package databaseConnection does not exist
            [javac] out.print(JspRuntimeLibrary.toString((((databaseConnection.Cur
            rentTimeBean)pageContext.findAttribute("time")).getMinutes())));
            [javac] ^
            [javac] 5 errors



            at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErro
            rHandler.java:130)
            at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher
            .java:293)
            at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
            at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
            .java:473)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
            .java:190)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
            95)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360
            )
            at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati
            onHandler.java:294)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5
            58)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
            at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication
            Context.java:507)
            at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
            at org.mortbay.http.HttpServer.service(HttpServer.java:863)
            at org.jboss.jetty.Jetty.service(Jetty.java:460)
            at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
            at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
            at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
            at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
            201)
            at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
            at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

            Many Thanks

            • 3. Re: JSP:useBean-Problem
              feuerzangenbowle Newbie

              ATTACHMENT

              The package databaseConnection is in the war-File, which I deploy and in this package is CurrentTimeBean.java. I don`t understand what path is missing.

              In NetBeans the compiling runs without errors. Only if I deploy the war-File the error occurs.

              Regards

              • 4. Re: JSP:useBean-Problem
                feuerzangenbowle Newbie

                NOW I FOUND THE ERROR

                You must take the Bean in the folder classes which is in the folder META-INF. Now the Application server find the bean and use it.