6 Replies Latest reply on Aug 16, 2003 11:08 AM by Steve Ahlstrom

    Help with deploying a war

    Steve Ahlstrom Newbie

      Background ... extensive experience working with J2EE app servers as a developer, not an administrator. Lots of experiece with Bluestone, HP-AS, Weblogic 6.x, and JRun 4.

      I've got a war that I've successfully deployed in both Weblogic 6.x and JRun4. It uses MySQL as it's database.

      For JBOSS (jboss-3.2.1_tomcat-4.1.24.zip) I've configured a mysql datasource and deployed it. I dropped my war file into the deploy directory. The console seems to indicate that the war has been deployed ... the ObjectName field in the MBean View shows " jboss.management.local:J2EEApplication=null,J2EEServer=Local,j2eeType=WebModule,name=idea.war".
      So my assumption is that this thing is deployed.

      The problem comes with I try to access this app from the browser, I get a 500 error and exceptions ...

      org.apache.jasper.JasperException: Could not dereference object
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
      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)


      javax.servlet.ServletException: Could not dereference object
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
      at org.apache.jsp.notice_jsp._jspService(notice_jsp.java:568)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

      Can anyone help guide me through the process of getting this to work?


        • 1. Re: Help with deploying a war
          Jon Barnett Master

          This is not particularly a JBoss-related issue as such. There are third-party servlet containers that come with JBoss - you either have the embedded Tomcat or the embedded Jetty distribution. Both of these servlet containers use Jasper to compile and run JSPs - http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html for some information about Jasper.

          The servlet container is complaining about running the JSP and gives you the line number in the Java code created from the JSP - notice_jsp.java:568.

          You will need to look for this Java code. Usually for Jetty, this is created in the /tmp directories (or the Windows temp directories). For Tomcat, this is usually in the JBoss temp directories.

          If you examine this code, it should tell you more about the nature of the run-time exception. I suspect it will be with respect to the javax.naming (DataSource JNDI reference may be wrong) but you will need to confirm the code fragment before we can get any further.

          • 2. Re: Help with deploying a war
            Steve Ahlstrom Newbie

            Interesting ...

            The error appears to be in generated code. The problem code is ....

            } catch (Throwable t) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
            if (pageContext != null) pageContext.handlePageException(t);
            } finally {
            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);

            with line 568 starting with "if (pageContext != null)"

            What can I do about that? (Again, this war works as is in JRun4 and Weblogic 6.1)

            • 3. Re: Help with deploying a war
              Jon Barnett Master

              OK. You'll need to go further back in the code. The exception is being caught but not handled properly for some reason.

              However, you'll want to go back and look at the code that caused the exception in the first place. Perhaps, it might be easier to add some System.out.println statements in your JSP, notice.jsp to see how far along it gets. Primitive, but effective in trapping around your JSP when it isn't clear on the nature of the actual offending code.

              • 4. Re: Help with deploying a war
                Steve Ahlstrom Newbie

                Looks like you're right ... I get nailed the first time I try to access my data access ojbect. Guess it's back to the doc to figure out how I screwed up my data source declaration.

                Just for kicks, here it is .... see anything wrong?


                • 5. Re: Help with deploying a war
                  Jon Barnett Master

                  The DataSource configuration itself seems fine. Assuming your JDBC driver is in the server/instance/lib directory, you should egt a connection fine.

                  The JNDI binding is going to be java:/jdbc/idea or should be anyway. You can check the JBoss JMX console and get a listing from the JNDI view. This will list all bindings to confirm your set up. Most likely this is the issue. The JMX console can be accessed from your JBoss via http://localhost:8080/jmx-console or whatever is correct for your web configuration.

                  • 6. Re: Help with deploying a war
                    Steve Ahlstrom Newbie


                    Thanks for your help ... I got it working.

                    Seems the problem was the following line ...

                    datasource = (DataSource)initialcontext.lookup("java:comp/env/jdbc/" + appl);

                    That works with Weblogic and JRun ... JBoss doesn't like it, I changed it to ...

                    datasource = (DataSource)initialcontext.lookup("java:jdbc/" + appl);

                    and now all is fine.

                    Thanks again!